atom / autocomplete-plus

View and insert possible completions in the editor while typing
MIT License
960 stars 263 forks source link

Disable default provider in comments / strings? #377

Open benogle opened 9 years ago

benogle commented 9 years ago

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 commented 9 years ago

I'm admittedly not suuuper keen on this.

mehcode commented 9 years ago

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).

muchweb commented 9 years ago

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 {).

tinloaf commented 9 years ago

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?

benogle commented 9 years ago

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

joefitzgerald commented 9 years ago

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

:thumbsup:

dotmilk commented 9 years ago

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

benogle commented 9 years ago

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

Yeah, it's intentional.

slindberg commented 9 years ago

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).

mangecoeur commented 9 years ago

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.

ChrisAlvares commented 9 years ago

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

wmadden commented 9 years ago

:+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.

williamhaley commented 9 years ago

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

jcontonio commented 8 years ago

thank you @wmadden

mholt commented 8 years ago

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.

codykrieger commented 8 years ago

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

codyjk commented 8 years ago

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

willthemoor commented 8 years ago

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

WalterGR commented 7 years ago

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

Has something changed that broke this blacklisting?

WalterGR commented 7 years ago

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".

cuddihyd commented 6 years ago

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

javaboi03 commented 5 years ago

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

willthemoor commented 5 years ago

how do you blacklist something

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

PatnalaPriyanka commented 5 years ago

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