Skip to content

importModuleSpecifierEnding does not apply for module specifier completions (manual imports) #39155

Closed
@wsmd

Description

@wsmd
  • VSCode Version: 1.44.2
  • OS Version: macOS 10.14.6

A while back, the importModuleSpecifierEnding preference was added to specify the preferred path ending for auto imports (see microsoft/vscode#90405).

{
  "javascript.preferences.importModuleSpecifierEnding": "js",
}

While this seems to work with auto imports (i.e. referencing an export of another file and letting the editor perform module importing automatically), it does not work with path completions when typing the import statement manually.

import { someFunction } from '../|';
                                 ^ when picking a file from path suggestions here,
                                   the file extension seems to always be omitted

Actual Behavior:

import { someFunction } from '../someModule';

Expected Behavior:

import { someFunction } from '../someModule.js';

Steps to Reproduce:

  1. Set javascript.preferences.importModuleSpecifierEnding to "js"
  2. Start typing an import statement of a relative js module
  3. When specifying the import source, choose a relative file path from the completions list
  4. The ".js" extension appears to be omitted

Expected Behavior:

The file chosen from the suggestions list should have the ".js" extension.


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

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: Completion ListsThe issue relates to showing completion lists in an editorGood First IssueWell scoped, documented and has the green lightHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions