From 3434aa0bddc81c93cbd4250f7490c2cf2f1bf337 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Wed, 14 Jan 2015 17:20:27 -0800 Subject: [PATCH] Remove getDefaultLibFilename from the LS host interface as its result is never honored by the LS. The LS operate only on a fixed list of files initialized by the host's getScriptFileNames(), if a file is not in this list, it will not be queried from the host, rather considered a missing file. Thus the result of getDefaultLibFilename()is either in the list, or will be ignored. --- src/harness/harnessLanguageService.ts | 4 ---- src/services/services.ts | 18 +++++------------- src/services/shims.ts | 5 ----- 3 files changed, 5 insertions(+), 22 deletions(-) diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index 97885bdd20e..18d55cc87c9 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -217,10 +217,6 @@ module Harness.LanguageService { return ""; } - public getDefaultLibFilename(): string { - return ""; - } - public getScriptFileNames(): string { var fileNames: string[] = []; ts.forEachKey(this.fileNameToScript, (fileName) => { fileNames.push(fileName); }); diff --git a/src/services/services.ts b/src/services/services.ts index dac3727dec0..7a2ea512517 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -853,7 +853,6 @@ module ts { getLocalizedDiagnosticMessages?(): any; getCancellationToken?(): CancellationToken; getCurrentDirectory(): string; - getDefaultLibFilename(options: CompilerOptions): string; log? (s: string): void; trace? (s: string): void; error? (s: string): void; @@ -1964,21 +1963,14 @@ module ts { function createCompilerHost(): CompilerHost { return { - getSourceFile: (filename, languageVersion) => { - return getSourceFile(filename); - }, + getSourceFile: getSourceFile, getCancellationToken: () => cancellationToken, - getCanonicalFileName: (filename) => useCaseSensitivefilenames ? filename : filename.toLowerCase(), + getCanonicalFileName: filename => useCaseSensitivefilenames ? filename : filename.toLowerCase(), useCaseSensitiveFileNames: () => useCaseSensitivefilenames, getNewLine: () => "\r\n", - getDefaultLibFilename: (options): string => { - return host.getDefaultLibFilename(options); - }, - writeFile: (filename, data, writeByteOrderMark) => { - }, - getCurrentDirectory: (): string => { - return host.getCurrentDirectory(); - } + getDefaultLibFilename: getDefaultLibraryFilename, + writeFile: (filename, data, writeByteOrderMark) => { }, + getCurrentDirectory: () => host.getCurrentDirectory() }; } diff --git a/src/services/shims.ts b/src/services/shims.ts index 01ed62ca248..d07c854bdc3 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -55,7 +55,6 @@ module ts { getLocalizedDiagnosticMessages(): string; getCancellationToken(): CancellationToken; getCurrentDirectory(): string; - getDefaultLibFilename(options: string): string; } /// @@ -275,10 +274,6 @@ module ts { return this.shimHost.getCancellationToken(); } - public getDefaultLibFilename(options: CompilerOptions): string { - return this.shimHost.getDefaultLibFilename(JSON.stringify(options)); - } - public getCurrentDirectory(): string { return this.shimHost.getCurrentDirectory(); }