-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Description
- VS Code Version: 1.55.2 and 1.56.0-insider
- OS Version: macOS Big Sur
Steps to Reproduce:
- Create a commonjs file that (default) exports an object with a property name that is a language keyword, and keep the file open in a tab (or enable javascript type checking for the project instead of keeping the tab open), e.g.
const consts = {
'break': 'break',
};
module.exports = consts;- Create another file, in which the keyword that is also a property on the exported object from previous step will be used (but don't add the keyword yet), save the file and close it, e.g.
for (let v of []) {
}- Open the file from previous step, and add the keyword and the semicolon, e.g.
break;. VS Code automatically adds the require statement, e.g.const { break } = require("./consts");, creating a syntax error with the keyword. This is the auto import feature controlled by thejavascript.suggest.autoImportssetting.
Does this issue occur when all extensions are disabled?: Yes
vscode-autoimport.mp4
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScript