Skip to content

Add file extensions when auto-completing import paths #35730

Closed

Description

  • VSCode Version: Code 1.17.0 (be377c0, 2017-10-05T06:07:51.906Z)
  • OS Version: Darwin x64 16.7.0
  • Extensions:
Extension Author (truncated) Version
Handlebars and 0.2.0
vscode-eslint dba 1.3.2
prettier-vscode esb 0.24.0
vscode-import-cost wix 2.5.0

Steps to Reproduce:

  1. Open or create a JavaScript file
  2. Start typing import x from './ followed by the name of a sibling file

Reproduces without extensions: Yes


When you start writing a local import statement, the intellisense helper will offer up foo and bar rather than foo.js and bar.js. Extensionless imports is a Node idiom that is incompatible with browser module loaders — adding the file extension would increase browser compatibility with no ill-effect on Node apps (to the contrary, it speeds up module resolution, and I'd argue it makes code more explicit and readable).

I wonder if you would consider changing the behaviour to add file extensions by default?

Activity

  1. mjbvz commented on Oct 8, 2017

    @mjbvz
    Contributor

    This issue was moved to microsoft/TypeScript#19019

  2. added
    upstreamIssue identified as 'upstream' component related (exists outside of VS Code)
    on Oct 8, 2017
  3. locked and limited conversation to collaborators on Nov 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

feature-requestRequest for new features or functionalityjavascriptJavaScript support issuesupstreamIssue identified as 'upstream' component related (exists outside of VS Code)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions