Vscode: JavaScript intellisense doesn't append `.js` to file names when importing file (node 13.2 ESM Modules)

Created on 19 Dec 2019  路  7Comments  路  Source: microsoft/vscode


  • VSCode Version: 1.41.0
  • OS Version: Windows 10

Steps to Reproduce:

  1. Intellisense doesn't add a .js to the end of files when importing a javascript module. This is using the new ESM features added to node on 13.2
  2. .js is required when importing javascript modules with the new ESM syntax


Does this issue occur when all extensions are disabled?: Yes

*duplicate javascript upstream-issue-linked

Most helpful comment

Better upstream issue: https://github.com/microsoft/TypeScript/issues/24779. It specifically tracks adding file extensions during auto import

All 7 comments

@mjbvz : Why close this issue? It's in the Visual Studio Code IDE: its "Auto Import from..." feature in JavaScript files is currently generating code that can't run without transpilation in Node and web browsers.

There's a Settings option today to use relative paths for import statments it generates. It should add a second to use full paths (with file name extensions).

Because the auto import suggestions are powered by the TypeScript project...

Will a new option in TypeScript to enable browser- and node-style ESM imports automatically propagate to a new Settings option in VS Code? Otherwise shouldn't this be left open, tracking that one as a dependency?

@mjbvz What component of TypeScript do the auto-import suggestions come from? Maybe from the Language Server?

If so, we should file a request specifically with the Language Server. I'm happy to file it, but I first want to make sure that's where the suggestions come from.

(The bug referenced earlier is about the Transpiler itself, not the Language Server ... or at least that's where the discussion on that bug has ended up.)

Better upstream issue: https://github.com/microsoft/TypeScript/issues/24779. It specifically tracks adding file extensions during auto import

Was this page helpful?
0 / 5 - 0 ratings