autocomplete-plus icon indicating copy to clipboard operation
autocomplete-plus copied to clipboard

Disable default provider in comments / strings?

Open benogle opened this issue 9 years ago • 24 comments

Opening this based on the discussion beginning from https://github.com/atom-community/autocomplete-plus/issues/351#issuecomment-91337251

@maxbrunsfeld says:

I think I'd be satisfied as long as the built-in completion provider didn't provide completions in comments (or strings, ideally) by default.

We could adjust this selector (or equiv on symbol provider) to not include comments / strings.

benogle avatar Apr 09 '15 20:04 benogle

I'm admittedly not suuuper keen on this.

benogle avatar Apr 09 '15 20:04 benogle

I like the per-provider idea. I don't even see the need for this to be user-configurable (it could still be of course).

I don't want html to be auto-completed in comments or strings. I don't want python to be auto-completed in comments or strings. I only want file paths to be auto-completed in strings.

Something like that is more of an experience defined by the provider. I don't foresee any need to change this (unless the provider is misbehaving in which case a PR would fix that).

mehcode avatar Apr 09 '15 20:04 mehcode

Yes, please at least disable completions in comments. It it annoying when typing plain text.

Although, if it is a documentation-style (i. e. yuidoc) comment, it makes sense to complete some parts of it (keywords usually start with @ or {).

muchweb avatar Apr 28 '15 11:04 muchweb

It's really easy to do this in the providers (as I've done in the autocomplete-plus-python-jedi provider), and the providers probably know a lot better when it's not applicable to provide autocompletion. When writing e.g. text documents (LaTeX, for example?) you probably want autocompletion in your comments?

tinloaf avatar Apr 29 '15 11:04 tinloaf

Yeah, I'm not in for disabling in comments wholesale, but ok with disabling the default provider in comments / strings.

benogle avatar Apr 29 '15 18:04 benogle

Yeah, I'm not in for disabling in comments wholesale, but ok with disabling the default provider in comments / strings.

:thumbsup:

joefitzgerald avatar Apr 29 '15 19:04 joefitzgerald

Text gleaned from comments also pollutes project wide suggestions. Is this intended?

dotmilk avatar May 27 '15 19:05 dotmilk

Text gleaned from comments also pollutes project wide suggestions. Is this intended?

Yeah, it's intentional.

benogle avatar May 27 '15 20:05 benogle

Also agree that autocomplete in comments is undesirable. When authoring comments and pressing enter to start a new line, it's confusing when a word gets autocompleted instead, especially when there is a slight delay.

The problem with leaving it up to the provider is when the default provider is completely suitable for your language (i.e. JavaScript).

slindberg avatar Jul 09 '15 17:07 slindberg

This is similarly a problem when editing Markdown files. You can completely disable Autocomplete, but then plugins like autocomplete-bibtext don't work. It would be nice to have a per-provider blacklist - e.g. by splitting the default provider into its own package and giving it its own settings.

mangecoeur avatar Jul 23 '15 13:07 mangecoeur

Just in case anyone wants a quick and dirty solution, you can disable Autocomplete+ in comments by adding a scope blacklist with .comment.block in the settings of autocomplete+

screen shot 2015-08-17 at 4 42 47 pm

ChrisAlvares avatar Aug 17 '15 21:08 ChrisAlvares

:+1: for disabling in comments. For what it's worth, I'd be satisfied with having to explicitly invoke autocomplete through a keyboard shortcut if I wanted to use it in a comment.

wmadden avatar Aug 25 '15 08:08 wmadden

Thanks @ChrisAlvares. That tip saved me a lot of frustration. I found that blacklisting .comment entirely was best for me.

williamhaley avatar Sep 17 '15 16:09 williamhaley

thank you @wmadden

jcontonio avatar Jan 22 '16 00:01 jcontonio

For others scratching their heads with .comment.block and wondering why suggestions still appear, try .comment -- I suspect this is because in my case most of my comments are regular // lines that aren't "block" comments. Anyway, just .comment worked for me.

I think this should be the default setting, frankly. Autocomplete in comments is annoying, not helpful.

mholt avatar Feb 09 '16 17:02 mholt

Agreed. It's frustrating that this isn't off by default.

codykrieger avatar Feb 09 '16 17:02 codykrieger

Also frustrated by this behavior. Blacklisting .comment does the trick, but it should be blacklisted by default.

codyjk avatar Jun 30 '16 18:06 codyjk

Perhaps using comments as an example under the Scope Blacklist setting would 'solve' this for most users?

willthemoor avatar Aug 17 '16 00:08 willthemoor

Blacklisting .comment is not working for me in Atom 1.15.0 in Clojure (.clj) files.

Has something changed that broke this blacklisting?

WalterGR avatar Mar 11 '17 08:03 WalterGR

Replying to myself...

Has something changed that broke this blacklisting?

Yes, it's broken. See #222 - "Scope blacklist doesn't seem to be working for me".

WalterGR avatar Mar 23 '17 22:03 WalterGR

Here's a hint specifically for autcomplete-python users:

I added .string.quoted to the Scope Blacklist box in the autocomplete-plus settings screen, and autocomplete now ignores strings -- including docstrings.

FWIW: Figuring this out was greatly aided by the article recommended in the Scope Blacklist setting descriptions

Here are my versions:

Atom 1.32.0 Electron 1.0.9 Chrome 61.0.3163.100 Node 8.9.3 autocomplete-plus 2.41.0 autocomplete-python 1.10.12

cuddihyd avatar Oct 26 '18 16:10 cuddihyd

For others scratching their heads with .comment.block and wondering why suggestions still appear, try .comment -- I suspect this is because in my case most of my comments are regular // lines that aren't "block" comments. Anyway, just .comment worked for me.

I think this should be the default setting, frankly. Autocomplete in comments is annoying, not helpful.

how do you blacklist something

javaboi03 avatar Nov 18 '18 17:11 javaboi03

how do you blacklist something

@javaboi03 Go to Settings > Packages > Autocomplete Plus. Then scroll down to 'Blacklist'

willthemoor avatar Nov 21 '18 20:11 willthemoor

How can we disable suggestions inside comments in my javascript code?

PatnalaPriyanka avatar Mar 15 '19 19:03 PatnalaPriyanka