angular/packages/language-service
Andrew Scott 4405725943
fix(language-service): address potential memory leak during project creation
This addresses a potential memory leak in plugin-factory.ts.
The require call inside the create function reloads the entire language
service module for every new project, which is inefficient and could be a cause of the memory leak during branch
switching. This ensures the module is loaded only once and the same
instance is shared across all projects.
2025-11-07 11:57:22 -08:00
..
bundles build: update to the latest version of devinfra and rename npm2 workspace (#63093) 2025-08-11 10:35:32 -07:00
src Revert "refactor(compiler-cli): remove deep imports from compiler-cli (#64732)" 2025-11-06 13:09:01 -08:00
test Revert "refactor(compiler-cli): remove deep imports from compiler-cli (#64732)" 2025-11-06 13:09:01 -08:00
testing Revert "refactor(compiler-cli): remove deep imports from compiler-cli (#64732)" 2025-11-06 13:09:01 -08:00
api.ts refactor(language-service): add methods for decoding classifications to public api (#62251) 2025-06-25 09:46:53 +00:00
BUILD.bazel build: remove unneeded language-service dependency (#64306) 2025-10-09 10:00:31 -07:00
build.sh build: use pnpm as the package manager instead of yarn (#62924) 2025-07-31 22:06:27 +00:00
index.d.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
index.js refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
override_rename_ts_plugin.ts build: update cross-repo angular dependencies (#64255) 2025-10-07 20:15:46 -04:00
package.json build: Export language service bundle (#62811) 2025-07-25 16:51:59 +02:00
plugin-factory.ts fix(language-service): address potential memory leak during project creation 2025-11-07 11:57:22 -08:00
README.md build: format md files 2025-11-06 10:03:05 -08:00
tsconfig.json build: add comment explaining path maps (#61584) 2025-05-21 17:27:18 +00: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.