angular/packages/language-service
Charles Lyding ed6df68914 refactor(language-service): use compiler for current program instance (#55097)
Within the language service, the Angular compiler instance can provide
access to the current TypeScript program via `getCurrentProgram`. By
using the compiler, the need to pass around the program driver is no longer
required and can also be removed as an instance field of the Angular language
service class. This change also provides a higher assurance that the correct
program is being used throughout each language service request.

PR Close #55097
2024-04-08 13:49:31 -07:00
..
bundles refactor(language-service): Replace tsserverlibrary -> typescript (#54726) 2024-03-07 10:49:01 -08:00
src refactor(language-service): use compiler for current program instance (#55097) 2024-04-08 13:49:31 -07:00
test refactor: fix a number of typos throughout the codebase (#55018) 2024-03-27 10:54:31 -07:00
testing refactor(language-service): Replace tsserverlibrary -> typescript (#54726) 2024-03-07 10:49:01 -08:00
api.ts refactor(compiler-cli): do not emit signal unwrap calls in versions older than 17.2 (#54423) 2024-02-13 15:53:42 -08:00
BUILD.bazel fix(language-service): ship /api entry-point (#48670) 2023-01-09 10:13:34 -08:00
build.sh fix(language-service): update packages/language-service/build.sh script to work with vscode-ng-language-service's new Bazel build (#48663) 2023-01-09 10:13:06 -08:00
index.d.ts refactor: update language-service package and tests to work with ESM (#48521) 2022-12-19 19:50:44 +00:00
index.js refactor: update language-service package and tests to work with ESM (#48521) 2022-12-19 19:50:44 +00:00
override_rename_ts_plugin.ts refactor(language-service): Replace tsserverlibrary -> typescript (#54726) 2024-03-07 10:49:01 -08:00
package.json build: update node.js engines version to be more explicate about v20 support (#52448) 2023-10-31 14:18:36 -07:00
plugin-factory.ts feat(compiler-cli): drop support for TypeScript older than 5.4 (#54961) 2024-03-21 22:07:45 -07:00
README.md feat(language-service): Provide plugin to delegate rename requests to Angular (#44696) 2022-01-21 11:18:48 -08:00

Override Rename Ts Plugin

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.