Skip to content

Commit c6f9e25

Browse files
committed
Refactor code to make if statements cheaper
1 parent 3354436 commit c6f9e25

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/server/editorServices.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -475,10 +475,7 @@ namespace ts.server {
475475

476476
isRoot(info: ScriptInfo) {
477477
if (this.languageServiceDiabled) {
478-
if (!this.projectOptions) {
479-
return undefined;
480-
}
481-
return forEach(this.projectOptions.files, file => toPath(file, file, createGetCanonicalFileName(this.projectService.host.useCaseSensitiveFileNames)) === info.path);
478+
return undefined;
482479
}
483480

484481
return this.compilerService.host.roots.some(root => root === info);
@@ -1421,7 +1418,7 @@ namespace ts.server {
14211418
return errors;
14221419
}
14231420
else {
1424-
if (this.exceedTotalNonTsFileSizeLimit(projectOptions.files) && projectOptions.compilerOptions && !projectOptions.compilerOptions.disableSizeLimit) {
1421+
if (projectOptions.compilerOptions && !projectOptions.compilerOptions.disableSizeLimit && this.exceedTotalNonTsFileSizeLimit(projectOptions.files)) {
14251422
project.setProjectOptions(projectOptions);
14261423
if (project.languageServiceDiabled) {
14271424
return;

0 commit comments

Comments
 (0)