Skip to content

Commit 8420fae

Browse files
Make getLocalizedDiagnosticMessages and getCancellationToken optional
1 parent a7219e7 commit 8420fae

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/harness/harness.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,6 @@ module Harness {
636636

637637
return {
638638
getCurrentDirectory: ts.sys.getCurrentDirectory,
639-
getCancellationToken: (): any => undefined,
640639
getSourceFile: (fn, languageVersion) => {
641640
if (Object.prototype.hasOwnProperty.call(filemap, getCanonicalFileName(fn))) {
642641
return filemap[getCanonicalFileName(fn)];

src/services/services.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -894,8 +894,8 @@ module ts {
894894
getScriptVersion(fileName: string): string;
895895
getScriptIsOpen(fileName: string): boolean;
896896
getScriptSnapshot(fileName: string): IScriptSnapshot;
897-
getLocalizedDiagnosticMessages(): any;
898-
getCancellationToken(): CancellationToken;
897+
getLocalizedDiagnosticMessages?(): any;
898+
getCancellationToken?(): CancellationToken;
899899
getCurrentDirectory(): string;
900900
getDefaultLibFilename(options: CompilerOptions): string;
901901
}
@@ -2398,12 +2398,12 @@ module ts {
23982398
var useCaseSensitivefilenames = false;
23992399
var sourceFilesByName: Map<SourceFile> = {};
24002400
var documentRegistry = documentRegistry;
2401-
var cancellationToken = new CancellationTokenObject(host.getCancellationToken());
2401+
var cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken());
24022402
var activeCompletionSession: CompletionSession; // The current active completion session, used to get the completion entry details
24032403
var writer: (filename: string, data: string, writeByteOrderMark: boolean) => void = undefined;
24042404

24052405
// Check if the localized messages json is set, otherwise query the host for it
2406-
if (!localizedDiagnosticMessages) {
2406+
if (!localizedDiagnosticMessages && host.getLocalizedDiagnosticMessages) {
24072407
localizedDiagnosticMessages = host.getLocalizedDiagnosticMessages();
24082408
}
24092409

0 commit comments

Comments
 (0)