Syntax operations also need to ensure project is present for the open script infos since update could be pending to make sure open script info has project (#50418)

Also convert one relevant test case to baseline
Fixes #50131
This commit is contained in:
Sheetal Nandi
2022-08-24 10:28:23 -07:00
committed by GitHub
parent 1d4fbbb529
commit b9a5bbc9af
4 changed files with 393 additions and 16 deletions
+2 -2
View File
@@ -1868,9 +1868,9 @@ namespace ts.server {
private getFileAndLanguageServiceForSyntacticOperation(args: protocol.FileRequestArgs) {
// Since this is syntactic operation, there should always be project for the file
// we wouldnt have to ensure project but rather throw if we dont get project
// throw if we dont get project
const file = toNormalizedPath(args.file);
const project = this.getProject(args.projectFileName) || this.projectService.tryGetDefaultProjectForFile(file);
const project = this.getProject(args.projectFileName) || this.projectService.ensureDefaultProjectForFile(file);
if (!project) {
return Errors.ThrowNoProject();
}