Skip to content

Commit b90e3ee

Browse files
committed
Fix classifier as well.
1 parent feedb6c commit b90e3ee

File tree

5 files changed

+12
-9
lines changed

5 files changed

+12
-9
lines changed

src/harness/harnessLanguageService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ namespace Harness.LanguageService {
232232
}
233233
getHost() { return this.host; }
234234
getLanguageService(): ts.LanguageService { return ts.createLanguageService(this.host); }
235-
getClassifier(): ts.Classifier { return ts.Classifier.createClassifier(); }
235+
getClassifier(): ts.Classifier { return ts.createClassifier(); }
236236
getPreProcessedFileInfo(fileName: string, fileContents: string): ts.PreProcessedFileInfo { return ts.preProcessFile(fileContents, /* readImportFiles */ true, ts.hasJavaScriptFileExtension(fileName)); }
237237
}
238238

src/server/editorServices.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1566,7 +1566,7 @@ namespace ts.server {
15661566
this.setCompilerOptions(defaultOpts);
15671567
}
15681568
this.languageService = ts.createLanguageService(this.host, this.documentRegistry);
1569-
this.classifier = ts.Classifier.createClassifier();
1569+
this.classifier = ts.createClassifier();
15701570
}
15711571

15721572
setCompilerOptions(opt: ts.CompilerOptions) {

src/services/classifier.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
/* @internal */
2-
namespace ts.Classifier {
1+
namespace ts {
32
/// Classifier
43
export function createClassifier(): Classifier {
54
const scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ false);
@@ -462,6 +461,7 @@ namespace ts.Classifier {
462461
};
463462
}
464463

464+
/* @internal */
465465
export function getSemanticClassifications(typeChecker: TypeChecker, cancellationToken: CancellationToken, sourceFile: SourceFile, classifiableNames: Map<string>, span: TextSpan): ClassifiedSpan[] {
466466
return convertClassifications(getEncodedSemanticClassifications(typeChecker, cancellationToken, sourceFile, classifiableNames, span));
467467
}
@@ -486,6 +486,7 @@ namespace ts.Classifier {
486486
}
487487
}
488488

489+
/* @internal */
489490
export function getEncodedSemanticClassifications(typeChecker: TypeChecker, cancellationToken: CancellationToken, sourceFile: SourceFile, classifiableNames: Map<string>, span: TextSpan): Classifications {
490491
const result: number[] = [];
491492
processNode(sourceFile);
@@ -614,10 +615,12 @@ namespace ts.Classifier {
614615
return result;
615616
}
616617

618+
/* @internal */
617619
export function getSyntacticClassifications(cancellationToken: CancellationToken, sourceFile: SourceFile, span: TextSpan): ClassifiedSpan[] {
618620
return convertClassifications(getEncodedSyntacticClassifications(cancellationToken, sourceFile, span));
619621
}
620622

623+
/* @internal */
621624
export function getEncodedSyntacticClassifications(cancellationToken: CancellationToken, sourceFile: SourceFile, span: TextSpan): Classifications {
622625
const spanStart = span.start;
623626
const spanLength = span.length;

src/services/services.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,22 +1601,22 @@ namespace ts {
16011601

16021602
function getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[] {
16031603
synchronizeHostData();
1604-
return Classifier.getSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span);
1604+
return ts.getSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span);
16051605
}
16061606

16071607
function getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications {
16081608
synchronizeHostData();
1609-
return Classifier.getEncodedSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span);
1609+
return ts.getEncodedSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span);
16101610
}
16111611

16121612
function getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[] {
16131613
// doesn't use compiler - no need to synchronize with host
1614-
return Classifier.getSyntacticClassifications(cancellationToken, syntaxTreeCache.getCurrentSourceFile(fileName), span);
1614+
return ts.getSyntacticClassifications(cancellationToken, syntaxTreeCache.getCurrentSourceFile(fileName), span);
16151615
}
16161616

16171617
function getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications {
16181618
// doesn't use compiler - no need to synchronize with host
1619-
return Classifier.getEncodedSyntacticClassifications(cancellationToken, syntaxTreeCache.getCurrentSourceFile(fileName), span);
1619+
return ts.getEncodedSyntacticClassifications(cancellationToken, syntaxTreeCache.getCurrentSourceFile(fileName), span);
16201620
}
16211621

16221622
function getOutliningSpans(fileName: string): OutliningSpan[] {

src/services/shims.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ namespace ts {
986986

987987
constructor(factory: ShimFactory, private logger: Logger) {
988988
super(factory);
989-
this.classifier = Classifier.createClassifier();
989+
this.classifier = createClassifier();
990990
}
991991

992992
public getEncodedLexicalClassifications(text: string, lexState: EndOfLineState, syntacticClassifierAbsent?: boolean): string {

0 commit comments

Comments
 (0)