Skip to content
This repository was archived by the owner on Nov 21, 2025. It is now read-only.

Commit 43bcbb7

Browse files
authored
fix: files incorrectly determined as not being in an Angular project (#1331)
I have observed that the performance enhancement introduced in #1272 does not work in some situations. It appears that if I attempt to do operations in an external template before the language service is initialized, the template will be identified as not being inside an Angular project. The result of this incorrect determination is that we will not service requests for that file. This commit disables the check by always returning `true`, effectively marking every TS and HTML file as being inside an Angular project. There may be some performance degradation in non-Angular projects as a result due to additional file tokenization of TypeScript files. However, we do still expect this tokenization to be very fast and there should be no observable performance issues. #1330
1 parent 6eb2984 commit 43bcbb7

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

client/src/client.ts

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -134,23 +134,12 @@ export class AngularLanguageClient implements vscode.Disposable {
134134
}
135135

136136
private async isInAngularProject(doc: vscode.TextDocument): Promise<boolean> {
137-
if (this.client === null) {
138-
return false;
139-
}
140-
const uri = doc.uri.toString();
141-
if (this.fileToIsInAngularProjectMap.has(uri)) {
142-
return this.fileToIsInAngularProjectMap.get(uri)!;
143-
}
144-
145-
try {
146-
const response = await this.client.sendRequest(IsInAngularProject, {
147-
textDocument: this.client.code2ProtocolConverter.asTextDocumentIdentifier(doc),
148-
});
149-
this.fileToIsInAngularProjectMap.set(uri, response);
150-
return response;
151-
} catch {
152-
return false;
153-
}
137+
// TODO(#1330): The logic below has been found to have some race conditions. It appears that
138+
// when trying to do operations in an external while the language service is still initializing
139+
// will result in this function determining that the file is not in an Angular project.
140+
// We should disable this check (by always returning assuming the document is inside an Angular
141+
// project) until a solution is found.
142+
return true;
154143
}
155144

156145
private createVirtualHtmlDoc(document: vscode.TextDocument): vscode.Uri {

0 commit comments

Comments
 (0)