Removing resolvePath from language service host

This commit is contained in:
Richard Knoll 2016-08-16 15:18:25 -07:00
parent 2f4a855ab8
commit 310bce4459
4 changed files with 9 additions and 34 deletions

View File

@ -218,12 +218,6 @@ namespace Harness.LanguageService {
const snapshot = this.getScriptSnapshot(path);
return snapshot.getText(0, snapshot.getLength());
}
resolvePath(path: string): string {
if (!ts.isRootedDiskPath(path)) {
path = ts.combinePaths(this.getCurrentDirectory(), path);
}
return ts.normalizePath(path);
}
log(s: string): void { }
@ -329,9 +323,6 @@ namespace Harness.LanguageService {
const snapshot = this.nativeHost.getScriptSnapshot(fileName);
return snapshot && snapshot.getText(0, snapshot.getLength());
}
resolvePath(path: string): string {
return this.nativeHost.resolvePath(path);
}
log(s: string): void { this.nativeHost.log(s); }
trace(s: string): void { this.nativeHost.trace(s); }
error(s: string): void { this.nativeHost.error(s); }

View File

@ -306,11 +306,6 @@ namespace ts.server {
throw new Error("No script with name '" + filename + "'");
}
resolvePath(path: string): string {
const result = this.host.resolvePath(path);
return result;
}
fileExists(path: string): boolean {
const result = this.host.fileExists(path);
return result;

View File

@ -1159,7 +1159,6 @@ namespace ts {
useCaseSensitiveFileNames?(): boolean;
readDirectory(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[];
resolvePath(path: string): string;
readFile(path: string, encoding?: string): string;
fileExists(path: string): boolean;
@ -4589,7 +4588,7 @@ namespace ts {
}
const absolutePath = normalizeAndPreserveTrailingSlash(isRootedDiskPath(fragment) ? fragment : combinePaths(scriptPath, fragment));
const baseDirectory = host.resolvePath(getDirectoryPath(absolutePath));
const baseDirectory = getDirectoryPath(absolutePath);
const ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames());
if (directoryProbablyExists(baseDirectory, host)) {
@ -4827,7 +4826,14 @@ namespace ts {
});
}
else if (host.getDirectories && options.typeRoots) {
const absoluteRoots = map(options.typeRoots, rootDirectory => getAbsoluteProjectPath(rootDirectory, host, options.project));
const absoluteRoots = map(options.typeRoots, rootDirectory => {
if (isRootedDiskPath(rootDirectory)) {
return normalizePath(rootDirectory);
}
const basePath = options.project || host.getCurrentDirectory();
return normalizePath(combinePaths(basePath, rootDirectory));
});
forEach(absoluteRoots, absoluteRoot => getCompletionEntriesFromDirectories(host, options, absoluteRoot, result));
}
@ -4842,18 +4848,6 @@ namespace ts {
return result;
}
function getAbsoluteProjectPath(path: string, host: LanguageServiceHost, projectDir?: string) {
if (isRootedDiskPath(path)) {
return normalizePath(path);
}
if (projectDir) {
return normalizePath(combinePaths(projectDir, path));
}
return normalizePath(host.resolvePath(path));
}
function getCompletionEntriesFromDirectories(host: LanguageServiceHost, options: CompilerOptions, directory: string, result: ImportCompletionEntry[]) {
if (host.getDirectories && directoryProbablyExists(directory, host)) {
forEach(host.getDirectories(directory), typeDirectory => {

View File

@ -69,7 +69,6 @@ namespace ts {
readDirectory(rootDir: string, extension: string, basePaths?: string, excludeEx?: string, includeFileEx?: string, includeDirEx?: string, depth?: number): string;
readFile(path: string, encoding?: string): string;
resolvePath(path: string): string;
fileExists(path: string): boolean;
getModuleResolutionsForFile?(fileName: string): string;
@ -446,10 +445,6 @@ namespace ts {
return this.shimHost.readFile(path, encoding);
}
public resolvePath(path: string): string {
return this.shimHost.resolvePath(path);
}
public fileExists(path: string): boolean {
return this.shimHost.fileExists(path);
}