Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make VS Code's auto-complete more strict?

I love Visual Studio Code, but its Intellisense auto-complete drives me crazy and I make more typos with it than it helps. So I feel I must be using it wrong.

The problem is very hard to explain, so I have a screenshot below:

VS Code auto-complete

I typed in thi. I would hope/expect/want that autocomplete would only look for anything to autocomplete that contains thi in consecutive order. But it does not. Instead it looks for anything with the letters t, h, and i in them. They needn't be next to each other, nor does the thing of interest even need to start with t.


I would like to "tame" auto-complete to only find consecutive letters. Is there a way to do this? (I use Python, Javascript, and SQL for most of my work, but I'm hoping the config is cross-language.)

Ideally, I would like the auto-complete to (a) require all letters be consecutive, (b) not require the thing of interest to start with those letters, and (c) ignore upper/lower case. But by far the most important issue to me is resolving (a).

like image 807
Mike Williamson Avatar asked Jun 21 '18 02:06

Mike Williamson


People also ask

How do I enable strict mode in VS Code?

Open command palette (Mac ⇧⌘P , Windows Ctrl+Shift+P ), search for Insert "use strict" in workspace , press Enter.

How can I improve my vs performance code?

Here's how to do it: Simply disable your extensions one at a time, and check to see if it made a difference. If your performance issues are obvious (E.g. files take 2 sec to open) than this should be quite easy. Disable → test → enable → disable the next one → test → etc.


Video Answer


1 Answers

The issue you are having is a feature added in November 2017 update. There is currently no way to turn off fuzzy autocomplete, but the issue is currently open on GitHub and the setting to change this behavior will be added.

In the meantime you can tweak your autocomplete with these settings:

"editor.wordBasedSuggestions": false,
"javascript.nameSuggestions": false,
"editor.snippetSuggestions": "bottom" / inline, none
"editor.suggestSelection: "recentlyUsedByPrefix"

From official docs:

When using the last option, recentlyUsedByPrefix, VS Code remembers which item was selected for a specific prefix (partial text). For example, if you typed co and then selected console, the next time you typed co, the suggestion console would be pre-selected.
This lets you quickly map various prefixes to different suggestions, for example:
co -> console and con -> const.

And maybe:

"editor.quickSuggestions": {
    "other": false,
    "comments": false,
    "strings": false
  },

It doesn't solve your problem completely, but it's the closest you can get without digging through VS Code source and creating an extension.

like image 141
Braca Avatar answered Oct 11 '22 04:10

Braca