I have been struggling with a really annoying behaviour of Visual Studio Code recently.
Whenever I try to use the JavaScript spread syntax VSCode automatically autocompletes the next piece of code (wrongly). Note I am NOT hitting TAB. Here's a demonstration of what I'm talking about:
Is there a way to disable this? This is really driving me mad... I am using Visual Studio Code 1.59.0 (which should be the latest release at the time of authoring this question).
Open the JavaScript code file in Text Editor, then use shortcut Control + Alt + N (or ⌃ Control + ⌥ Option + N on macOS), or press F1 and then select/type Run Code , the code will run and the output will be shown in the Output Window.
JavaScript in Visual Studio Code. Visual Studio Code includes built-in JavaScript IntelliSense, debugging, formatting, code navigation, refactorings, and many other advanced language features. Most of these features just work out of the box, while some may require basic configuration to get the best experience.
However, there are some cases where VS Code is limited to working only with your currently opened files and is unable to load the other files that make up your JavaScript or TypeScript project. This can happen in a few instances: You are working with JavaScript or TypeScript code on vscode.dev or github.dev and VS Code is running in the browser.
This topic describes some of the advanced JavaScript features supported by Visual Studio Code. Using the TypeScript language service, VS Code can provide smart completions (IntelliSense) as well as type checking for JavaScript.
Working with JavaScript 1 IntelliSense #. Visual Studio Code's JavaScript IntelliSense provides intelligent code completion, parameter info, references search, and many other advanced language features. 2 JavaScript projects (jsconfig.json) #. ... 3 Type checking JavaScript #. ... 4 Using tasks #. ... 5 Disable JavaScript support #. ...
VS Code allows you to leverage some of TypeScript's advanced type checking and error reporting functionality in regular JavaScript files. This is a great way to catch common programming mistakes. These type checks also enable some exciting Quick Fixes for JavaScript, including Add missing import and Add missing property.
As I mentioned in my comment elsewhere, the github issue is Typing repeated dots in js expands to first suggestion.
In that issue a couple of temporary fixes are mentioned:
"editor.suggest.showWords": false
or
"editor.acceptSuggestionOnCommitCharacter": false
The .
's are commit characters in javascript and so one of the suggestions will be selected that you do not want.
[You might be able to increase the quick suggestions delay
time as a possible fix, but I can't test that since I can't actually repro this bug on my setup.]
[If you still are facing this problem make sure to upgrade to v1.59.1, which included a fix. If that doesn't fix it for you, file an issue.]
It appears to be an issue introduced in the latest update to VSCode.
I have one laptop running the latest version that is exhibiting the issue. And another laptop that was running an older version and did not exhibit the issue. Upon updating the laptop with the older version to the latest it too now has this annoying bug...
EDIT:
As a temporary fix I just reinstalled version 1.58.2 on my laptops which has resolved the issue.
https://code.visualstudio.com/updates/v1_58
I made a user snippet to work around the issue for now:
"Spread": {
"scope": "javascript,typescript",
"prefix": "spd",
"body": ["...$1"],
"description": "spread rest operator vs code fix"
}
Basic but does the job. Just create a snippet and drop it in.
This appears to be fixed in the latest commit, which is 1.59.1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With