Vscode: Autocomplete is out of control

Created on 16 Aug 2016  路  9Comments  路  Source: microsoft/vscode

  • VSCode Version: 1.4.0
  • OS Version: Windows 10

Autocomplete is just out of control. It tries to complete statements for me when I'm typing a comment, like if I'm adding a comment to a typescript file and I'm writing a sentence like "this service is for" and hit enter to go to a new line, it expands into a whole for statement block. This is only one example, it seems to happen a lot and is very disruptive.

It also likes to autocomplete while I'm editing markdown files for some reason, I think it might just go off of words in the file? This is very disruptive because the 'enter' key which I use in normal typing performs the completion, I'll often have errors in my file if I don't watch while I'm typing. Like I might use the word 'completed' earlier in the file, but if I want to end a line with the word 'complete', it changes to 'completed'

Steps to Reproduce:

  1. Start typing in a markdown file or in comments in typescript/javascript/html files, hit 'enter' after typing 'for' in a comment in a typescript file, or type a sentence with the word 'created' in a markdown file, and later type 'create' and hit 'enter'. I think I've noticed something in html comments as well, but I don't have a handy example.

This is in addition to the aggressive completion of all quotes and parenthesis. First, I don't understand why this is even helpful to anyone. What are you supposed to do when you're done with the parenthesis? I always have to type them anyway to move on, like if I'm saying "console.log('", I end up between the single parens in "console.log('')", but when I'm done typing I still need to type "');" to put a semicolon at the end of the line. I don't think they serve a useful purpose, and they cause errors or extra keystrokes when I want to replace things sometimes, like if I want to change quotes to a backtick for a typescript template string, or I'm using a combination of quotes in an attribute in an angular template.

*duplicate *question

Most helpful comment

You can try using the following settings:

  • editor.autoClosingBrackets: false to not get the automatic bracket closing.
  • editor.quickSuggestions: false to not get the suggestions unless you ctrl+space
  • editor.acceptSuggestionOnEnter: false to accept suggestions only on Enter.
  • editor.snippetSuggestions: "none" to never see snippets (such as the for loop)

@JasonGoemaat would these or a combination work for you?

You can find all the settings under File > Preferences > User Settings. If you look around, you might find others which would work best for you.

All 9 comments

You can try using the following settings:

  • editor.autoClosingBrackets: false to not get the automatic bracket closing.
  • editor.quickSuggestions: false to not get the suggestions unless you ctrl+space
  • editor.acceptSuggestionOnEnter: false to accept suggestions only on Enter.
  • editor.snippetSuggestions: "none" to never see snippets (such as the for loop)

@JasonGoemaat would these or a combination work for you?

You can find all the settings under File > Preferences > User Settings. If you look around, you might find others which would work best for you.

@alexandrudima Thanks for pointing to "editor.acceptSuggestionOnEnter". This setting fixed the enter-always-autocompletes issue for me

These are good workarounds, but IMO autocomplete should never happen in comments. It would be nice to see that change made. As I'm writing a large block comment, it's trying to autocomplete using every word I've typed in the comment. Very distracting.

Thanks @alexandrudima, that helps a lot. I didn't even think that autoClosingBrackets would work for quotation marks. Problem is that I like the closing brackets ( } ), it's just the closing quotes that I hate :8ball: I think I hate the issues I have with quotes more thank the auto closing brackets helped so I'll turn it off.

@alexandrudima I'd like to set all of those options (especially editor.acceptSuggestionOnEnter: false), but only when I'm inside a comment. For code, they're all quite useful. Is it possible to set them contextually?

as @ffxsam and @danvk have said, the autocomplete it's very useful and it's also good to be able to control it with different options, but IMO it should be deactivated automatically inside of a comment where a developer should be free to write whatever he wants.
editor.acceptSuggestionOnEnter: false mitigates a little the problem but it's still present...

+1, would really like to see this happen. I like using auto-complete (on enter) in code, but it's unbearable (and doesn't make sense) for it to happen in comments.

@jrieken Can this use-case be covered by the new per completion item accept character?

Closing this as dup of #10819. Plan is to extend the editor.wordBasedSuggestions-setting to something like comments, strings, everywhere instead of the current true|false.

Was this page helpful?
0 / 5 - 0 ratings