IssueRaiser

Auto-import priority rules

# Suggestion It seems there are many folks struggling with the priority/ordering of VSCode's auto-import (intellisense) suggestions. There are a few different cases, but they seem to be all somewhat related to the general theme of how these suggestions are prioritized. - My specific case is that when coding in Vue, the import of `watch` from `fs` is always prioritized over `vue` (/cc @cabal95) - Others have issues with code from external modules being prioritized over code defined within their repo - Others have issues related to preferring aliases defined in their tsconfig - Many edge cases around specific paths suggested when dealing with monorepos... It would be fantastic if VSCode provided a way to override the priority but it seems that TypeScript's language server suggestions could use some tweaking regardless. ## ⭐ Suggestion Seems like a fairly reasonable priority would be: - code found within the repo/module (preferring aliased paths if they exist, probably preferring "closer" imports over further away in the tree?) - code found in other repos/modules defined locally within a monorepo (again preferring aliases) - code found in _explicit_ dependencies found in package.json - code found in node internals (ex: `fs`, `path`) --- ## 🔍 Search Terms import priority prioritize prioritise auto-import vscode intellisense ## 🔗 Related Issues open - https://github.com/microsoft/TypeScript/issues/31710 - https://github.com/microsoft/TypeScript/issues/43352 closed - ht

Posted by theoephraim on Oct 12, 2022, 8:36 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.2,500 issues0 comments

github (Sysadmin)

Auto-import priority rules

theoephraimOct 12, 2022, 8:36 PM

# Suggestion It seems there are many folks struggling with the priority/ordering of VSCode's auto-import (intellisense) suggestions. There are a few different cases, but they seem to be all somewhat related to the general theme of how these suggestions are prioritized. - My specific case is that when coding in Vue, the import of `watch` from `fs` is always prioritized over `vue` (/cc @cabal95) - Others have issues with code from external modules being prioritized over code defined within their repo - Others have issues related to preferring aliases defined in their tsconfig - Many edge cases around specific paths suggested when dealing with monorepos... It would be fantastic if VSCode provided a way to override the priority but it seems that TypeScript's language server suggestions could use some tweaking regardless. ## ⭐ Suggestion Seems like a fairly reasonable priority would be: - code found within the repo/module (preferring aliased paths if they exist, probably preferring "closer" imports over further away in the tree?) - code found in other repos/modules defined locally within a monorepo (again preferring aliases) - code found in _explicit_ dependencies found in package.json - code found in node internals (ex: `fs`, `path`) --- ## 🔍 Search Terms import priority prioritize prioritise auto-import vscode intellisense ## 🔗 Related Issues open - https://github.com/microsoft/TypeScript/issues/31710 - https://github.com/microsoft/TypeScript/issues/43352 closed - ht

Comments (0)

No comments yet. Start the discussion.

Comment on this issue