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

Missing import codefix: Take scoped packages (@foo/bar) into consideration #17536

Merged
merged 1 commit into from
Jul 31, 2017

Conversation

minestarks
Copy link
Member

Fixes #15223

When a package name has a scope, like @angular/core, we weren't able to locate package.json correctly, only looking under the @angular directory. Which meant that we never read the 'main/`typings property in package.json which would have helped us simplify the import module specifier.

This fixes the parsing of the path so we can find package.json.

state = States.Scope;
}
else {
packageRootIndex = partEnd;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another way to express this would be goto case States.PackageContent. That would have the benefit of emphasizing that the two states are the same except for the initial check in NodeModules.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's just what I was looking for thanks, I didn't know about that.

Copy link
Member

@amcasey amcasey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@minestarks minestarks merged commit 84c5795 into microsoft:master Jul 31, 2017
@aozgaa
Copy link
Contributor

aozgaa commented Aug 4, 2017

LGTM

@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Auto-import quickfix : wrong strategy for import paths
4 participants