-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Fix renaming of node_modules #49568
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
Fix renaming of node_modules #49568
Conversation
@@ -8822,6 +8822,7 @@ namespace ts { | |||
readonly includeInlayPropertyDeclarationTypeHints?: boolean; | |||
readonly includeInlayFunctionLikeReturnTypeHints?: boolean; | |||
readonly includeInlayEnumMemberValueHints?: boolean; | |||
readonly allowRenameOfImportPath?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ironically, I think this always belonged in UserPreferences
, and providePrefixAndSuffixTextForRename
always should have been a per-request option. 🙃 Baby steps in the right direction...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor suggestions, plus some thoughts on avoiding the breaking change, if we think that's worthwhile.
@@ -5877,6 +5877,8 @@ declare namespace ts { | |||
getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan | undefined; | |||
getSignatureHelpItems(fileName: string, position: number, options: SignatureHelpItemsOptions | undefined): SignatureHelpItems | undefined; | |||
getRenameInfo(fileName: string, position: number, preferences: UserPreferences): RenameInfo; | |||
/** @deprecated */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment about using the other overload?
@@ -6255,6 +6257,7 @@ declare namespace ts { | |||
Insert = "insert", | |||
Remove = "remove" | |||
} | |||
/** @deprecated - consider using EditorSettings instead */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be a bad diff, but I'm seeing EditorOptions
deprecated? What changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was marked deprecated before, but with a normal comment (/* */
) as opposed to JSDoc (/** */
), just a drive-by fix.
Fixes #45668.
I think it also fixes #48681.
The rule I'm trying to implement is the following:
node_modules/
, don't allow that rename.node_modules
package, only allow renames that would not affect a different package.I'd like some feedback on the wording in the diagnostic message.
I'll update the tests'
verify.renameInfoFails()
calls once there's a definitive diagnostic message.Note: I had to change
getRenameInfo
to take a user preferences parameter, because I needed to know ifprovidePrefixAndSuffixTextForRename
(surfaced as "Use Aliases For Renames" in vscode) is set or not. Since that function was already taking as parameter another option that comes from user preferences, it made sense to me to change that. A lot of the diff is refactoring related to that change.