Skip to content

Commit d26daaa

Browse files
committed
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 (cherry picked from commit 43bcbb7)
1 parent bbd0c60 commit d26daaa

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
@@ -96,23 +96,12 @@ export class AngularLanguageClient implements vscode.Disposable {
9696
}
9797

9898
private async isInAngularProject(doc: vscode.TextDocument): Promise<boolean> {
99-
if (this.client === null) {
100-
return false;
101-
}
102-
const uri = doc.uri.toString();
103-
if (this.fileToIsInAngularProjectMap.has(uri)) {
104-
return this.fileToIsInAngularProjectMap.get(uri)!;
105-
}
106-
107-
try {
108-
const response = await this.client.sendRequest(IsInAngularProject, {
109-
textDocument: this.client.code2ProtocolConverter.asTextDocumentIdentifier(doc),
110-
});
111-
this.fileToIsInAngularProjectMap.set(uri, response);
112-
return response;
113-
} catch {
114-
return false;
115-
}
99+
// TODO(#1330): The logic below has been found to have some race conditions. It appears that
100+
// when trying to do operations in an external while the language service is still initializing
101+
// will result in this function determining that the file is not in an Angular project.
102+
// We should disable this check (by always returning assuming the document is inside an Angular
103+
// project) until a solution is found.
104+
return true;
116105
}
117106

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

0 commit comments

Comments
 (0)