Skip to content
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

Automated imports: import style "auto" not working as expected #50622

Closed
bpasero opened this issue May 29, 2018 · 7 comments
Closed

Automated imports: import style "auto" not working as expected #50622

bpasero opened this issue May 29, 2018 · 7 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Milestone

Comments

@bpasero
Copy link
Member

bpasero commented May 29, 2018

Refs: #50488

I would expect "typescript.preferences.importModuleSpecifier": "auto" to use the style of the other imports in the file but it seems to behave differently?

@mjbvz mjbvz added this to the May 2018 milestone May 29, 2018
@mjbvz
Copy link
Collaborator

mjbvz commented May 29, 2018

Thanks. The description for "auto" is wrong here. For paths, "auto" actually tries using the shortest path instead of inferring path style like we do with quotes

@mjbvz
Copy link
Collaborator

mjbvz commented May 31, 2018

The setting documentation explains the behavior now. Note that non-relative paths also require setting a baseUrl in the tsconfig or jsconfig

@mjbvz mjbvz added the bug Issue identified by VS Code Team member as probable bug label May 31, 2018
@mjbvz mjbvz closed this as completed May 31, 2018
@bpasero
Copy link
Member Author

bpasero commented May 31, 2018

@mjbvz was there a change?

@mjbvz
Copy link
Collaborator

mjbvz commented May 31, 2018

I clarified the setting documentation. It now explicitly says that auto uses the shortest path type and that you need to set a baseUrl for non-relative paths

@bpasero
Copy link
Member Author

bpasero commented Jun 1, 2018

@mjbvz I do not see much more clarification though, I see this still:

image

@mjbvz
Copy link
Collaborator

mjbvz commented Jun 1, 2018

The part about "auto" infer the shortest path type. The entry for non-relative also now mentions baseUrl and ts/jsconfig

@RMacfarlane RMacfarlane added the verified Verification succeeded label Jun 1, 2018
@insidewhy
Copy link

insidewhy commented Jun 20, 2018

This isn't working for me at all. Even though app/util/blah is the "shortest" it chooses ../../../util/blah for me unless I change the option from auto to non-relative. app is shorter than ../../... VS Code is using typescript 2.9.1.

@vscodebot vscodebot bot locked and limited conversation to collaborators Jul 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants