Skip to content

Auto-imports don't respect typescript.preferences.importModuleSpecifier #28662

Closed
@dgreensp

Description

@dgreensp

Version: Deno 2.2.5

(Submitting here rather than over at denoland/vscode_deno because auto-imports seem to fall under LSP and be filed here.)

The default behavior for auto-import module specifiers in VS Code is supposed to be "shortest," as in, the relative path is used if it is shorter. This seems to not actually happen in Deno, particularly when using an import map. For example, if src/ is import-mapped, src/foo/bar.ts will import src/foo/baz.ts, not ./baz.ts, is the behavior I'm seeing with the generated paths.

I believe I've observed Deno respecting other TypeScript auto-import settings, like typescript.preferences.autoImportFileExcludePatterns. And I don't think anything about import maps changes the intent of the importModuleSpecifier setting. If someone really wanted a "shortest except in the case of import maps" setting (if that's even the problem), maybe that could be added as a Deno-specific setting.

Metadata

Metadata

Assignees

Labels

lsprelated to the language server

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions