Skip to content

When renaming module, ensure rename span is just the last component of the path #27151

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

Merged
1 commit merged into from
Sep 17, 2018

Conversation

ghost
Copy link

@ghost ghost commented Sep 17, 2018

Sequel to #24702

Discussed with @mjbvz that editors don't want to handle changing complex paths, but changing just the last component is easier.

@ghost ghost force-pushed the fileToRenameSpan branch from 9a2938c to 95aae9f Compare September 17, 2018 18:22
@mjbvz
Copy link
Contributor

mjbvz commented Sep 17, 2018

Does this mean that I can trigger a rename anywhere on an import but that we should only actually rename the last component of the path? Or can I now only trigger a rename on the last component of the path.

In the first case, I believe VS Code will need to know the range of the last component of the path (we could add logic on our side to calculate it too but it would be better if this information came from TS). Adding a renameRange property to the RenameInfo could be useful for other cases too, such as allowing users to rename a class by hitting F2 on the class keyword instead of only on the class symbol name

@ghost
Copy link
Author

ghost commented Sep 17, 2018

This PR modifies exactly the property you need, triggerSpan. For some reason it looks like we weren't sending that to you before, fixed by #27160.

@ghost ghost merged commit cfd0a62 into master Sep 17, 2018
@ghost ghost deleted the fileToRenameSpan branch September 17, 2018 22:26
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants