-
Notifications
You must be signed in to change notification settings - Fork 12.8k
auto import always uses relative (to the current file) module paths in presense of baseUri #21860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
There are two different auto import features: Also, when choosing the action to use for completions (or display first for a code fix), we will prefer the shortest path. So we will only use a relative path if we see that it is simpler then coming down from the baseUrl. |
i am talking about import on completion, because i cannot opt out from completion itself and import just comes with it there are a few reasons i don't want
so how can i get the import on completion to use absolute paths (relative to baseUri) please? |
It's possible that we could add an option in #20619 to always use baseUrl paths. |
This should be exposed in VSCode (insiders as of now) under "typescript.preferences.importModuleSpecifier": "non-relative" |
This keeps happening even with that option enabled, I read in another issue that the completion uses whichever path is shortest as a string and that you were looking into making that into an option. Any updates on that? |
@jabsatz Could you provide a concrete reproducible example? We should always use a non-relative path if possible given that option. |
jsconfig.json:
settings:
If I'm correct, this should resolve packages non-relatively, and it does, but only sometimes. Say for example my folder structure is somewhat like this:
If I write |
No, should I? |
Before that, I just noticed you're using |
That did the trick! Thank you! |
back in a day it used to be different
baseUri
how can i get the auto import to use absolute paths like it was back in the day?
The text was updated successfully, but these errors were encountered: