Skip to content

fix(language-service): Retain correct language service when `ts.Proje…#51912

Closed
atscott wants to merge 1 commit intoangular:mainfrom
atscott:createNgLanguageService
Closed

fix(language-service): Retain correct language service when `ts.Proje…#51912
atscott wants to merge 1 commit intoangular:mainfrom
atscott:createNgLanguageService

Conversation

@atscott
Copy link
Copy Markdown
Contributor

@atscott atscott commented Sep 26, 2023

…ct` reloads

When the ts.Project creates the language service plugin (in this case, the Angular Language Service), it sets the project's language service to the new language service returned by the plugin create: https://sourcegraph.com/github.com/microsoft/TypeScript@b12af0fa2bbd4b015e59adcfb49988cea7f919a1/-/blob/src/server/project.ts?L2035-2044

The project may be reloaded in response to various events, such as a change to the tsconfig file, which then recreates the plugin. When this happens, the language service that gets passed to the plugin create function will not be the typescript language service, but rather the previous instance of the new language service returned by the last call to create.

This commit ensures that subsequent calls to create for the NgLanguageService plugin for a project after the first call are able to retrieve and hold on to the TypeScript language service.

fixes angular/vscode-ng-language-service#1923

@atscott atscott added action: review The PR is still awaiting reviews from at least one requested reviewer area: language-service Issues related to Angular's VS Code language service target: patch This PR is targeted for the next patch release labels Sep 26, 2023
@ngbot ngbot bot modified the milestone: Backlog Sep 26, 2023
@atscott atscott requested a review from clydin September 26, 2023 17:47
@atscott atscott added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Oct 2, 2023
…ct` reloads

When the `ts.Project` creates the language service plugin (in this case,
the Angular Language Service), it sets the project's language service to
the new language service returned by the plugin create:
https://sourcegraph.com/github.com/microsoft/TypeScript@b12af0fa2bbd4b015e59adcfb49988cea7f919a1/-/blob/src/server/project.ts?L2035-2044

The project may be reloaded in response to various events, such as a
change to the tsconfig file, which then recreates the plugin. When this
happens, the language service that gets passed to the plugin `create`
function will not be the typescript language service, but rather the
previous instance of the new language service returned by the last call
to `create`.

This commit ensures that subsequent calls to `create` for the
`NgLanguageService` plugin for a project after the first call are able
to retrieve and hold on to the _TypeScript_ language service.

fixes angular/vscode-ng-language-service#1923
@atscott atscott force-pushed the createNgLanguageService branch from 3594b25 to 7a84837 Compare October 2, 2023 20:29
@atscott atscott removed the request for review from clydin October 3, 2023 17:19
@alxhub
Copy link
Copy Markdown
Member

alxhub commented Oct 4, 2023

This PR was merged into the repository by commit 08482f2.

alxhub pushed a commit that referenced this pull request Oct 4, 2023
…ct` reloads (#51912)

When the `ts.Project` creates the language service plugin (in this case,
the Angular Language Service), it sets the project's language service to
the new language service returned by the plugin create:
https://sourcegraph.com/github.com/microsoft/TypeScript@b12af0fa2bbd4b015e59adcfb49988cea7f919a1/-/blob/src/server/project.ts?L2035-2044

The project may be reloaded in response to various events, such as a
change to the tsconfig file, which then recreates the plugin. When this
happens, the language service that gets passed to the plugin `create`
function will not be the typescript language service, but rather the
previous instance of the new language service returned by the last call
to `create`.

This commit ensures that subsequent calls to `create` for the
`NgLanguageService` plugin for a project after the first call are able
to retrieve and hold on to the _TypeScript_ language service.

fixes angular/vscode-ng-language-service#1923

PR Close #51912
@alxhub alxhub closed this in 08482f2 Oct 4, 2023
@angular-automatic-lock-bot
Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Nov 4, 2023
ChellappanRajan pushed a commit to ChellappanRajan/angular that referenced this pull request Jan 23, 2024
…ct` reloads (angular#51912)

When the `ts.Project` creates the language service plugin (in this case,
the Angular Language Service), it sets the project's language service to
the new language service returned by the plugin create:
https://sourcegraph.com/github.com/microsoft/TypeScript@b12af0fa2bbd4b015e59adcfb49988cea7f919a1/-/blob/src/server/project.ts?L2035-2044

The project may be reloaded in response to various events, such as a
change to the tsconfig file, which then recreates the plugin. When this
happens, the language service that gets passed to the plugin `create`
function will not be the typescript language service, but rather the
previous instance of the new language service returned by the last call
to `create`.

This commit ensures that subsequent calls to `create` for the
`NgLanguageService` plugin for a project after the first call are able
to retrieve and hold on to the _TypeScript_ language service.

fixes angular/vscode-ng-language-service#1923

PR Close angular#51912
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: language-service Issues related to Angular's VS Code language service target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Templates ignored after saving tsconfig.json

2 participants