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
feat(language-service): Provide plugin to delegate rename requests to Angular #44696
feat(language-service): Provide plugin to delegate rename requests to Angular #44696
Conversation
Really cool solution to the problem. I also like that you made this plugin available in the @angular/language-service so it could theoretically be used by extensions other than VSCode. Thanks for the investigation!
Given the complicated nature of the solution, I think it's a good idea to add more documentation and comments than is usually necessary. Here are a few changes I would propose:
- Add the contents of the README as a comment at the top of the
factory - Potentially add a README file here as well
- I would consider renaming the
built_in_ts_pluginto be more self-documenting in its name. Something likeoverride_rename_ts_plugin.tsordisable_native_ts_rename_plugin - Update the commit message header to describe the goal rather than the solution. i.e.
feat(language-service): Provide plugin to delegate rename requests to Angularand then add the implementation details to commit message body
I think it would also be good to get another reviewer's perspective. @clydin and @devversion - I've added you two as reviewers based on your knowledge of the general tooling/js/ts ecosystem. Feel free to un-assign yourselves if you don't have any input here.
5700f99
to
0e26959
0e26959
to
7e2f843
… Angular When the user wants to rename a symbol in the ts file VSCode will ask the rename providers for the answer in turn. If the first extension returns the result, the VSCode will break the loop and apply the result. If the first extension cannot rename the symbol, VSCode will ask the second extension in the list (built-in TS/JS extension, Angular LS extension, etc.). In other words, VSCode takes the result from only one rename provider and the order depends on registration timing, scoring. Because the built-in ts extension and Angular extension have the same high score, if the built-in ts extension is the first(depends on the time the extension was registered), the result will be provided by the built-in extension. We want Angular to provide it, so this plugin will delegate rename requests and reject the request for the built-in ts server. The Angular LS only provides the rename info when working within an Angular project. If we cannot locate Angular sources in the project files, the built-in extension should provide the rename info. This plugin will apply to the built-in TS/JS extension and delegate rename requests to the Angular LS. It provides the rename info only when it is an Angular project. Otherwise, it will return info by the default built-in ts server rename provider. See [here][1] for more info. [1]: microsoft/vscode#115354
7e2f843
to
1998da9
|
I am not good at writing. Thanks for the suggestion. You can review it again now. |
|
@atscott I just saw that you pinged Charles and myself on this directly. Sorry for the late response. I think this conceptually makes a lot of sense to me. I unfortunately do not have low-level understanding of the language service yet, but as said, conceptually that seems very reasonable until the root cause/scoring is modified. It would be cool if the doc would show an example of how this additional plugin can be wired up? or is that planned as a follow-up? |
The follow-up PR is here |
As @ivanwonder mentioned, the follow-up PR for the extension is angular/vscode-ng-language-service#1589. |
|
This PR was merged into the repository by commit 9d4af65. |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |


When the user wants to rename a symbol in the ts file VSCode
will ask the rename providers for the answer in turn. If the
first extension returns the result, the VSCode will break the
loop and apply the result. If the first extension cannot rename
the symbol, VSCode will ask the second extension in the
list (built-in TS/JS extension, Angular LS extension, etc.).
In other words, VSCode takes the result from only one rename provider
and the order depends on registration timing, scoring.
Because the built-in ts extension and Angular extension have the
same high score, if the built-in ts extension is the
first(depends on the time the extension was registered), the result
will be provided by the built-in extension. We want Angular to
provide it, so this plugin will delegate rename requests and reject
the request for the built-in ts server.
The Angular LS only provides the rename info when working within
an Angular project. If we cannot locate Angular sources in the
project files, the built-in extension should provide the rename info.
This plugin will apply to the built-in TS/JS extension and delegate
rename requests to the Angular LS. It provides the rename info only
when it is an Angular project. Otherwise, it will return info by the
default built-in ts server rename provider.
See here for more info.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information