add readDirectory to LSHost

This commit is contained in:
Arthur Ozga 2016-09-30 16:52:28 -07:00
parent b9e5dbc6e4
commit 3e15394b90
2 changed files with 9 additions and 6 deletions

View File

@ -171,12 +171,16 @@ namespace ts.server {
return this.host.fileExists(path);
}
readFile(fileName: string): string {
return this.host.readFile(fileName);
}
directoryExists(path: string): boolean {
return this.host.directoryExists(path);
}
readFile(fileName: string): string {
return this.host.readFile(fileName);
readDirectory(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[] {
return this.host.readDirectory(path, exclude, exclude, include);
}
getDirectories(path: string): string[] {

View File

@ -330,17 +330,16 @@ namespace ts.Completions {
fragment = normalizeSlashes(fragment);
const baseName = getBaseFileName(fragment); // TODO: brittle?
const baseName = getBaseFileName(fragment);
// Remove the basename from our directory path
// TODO: (arozga) when is that used for filtering options later?
fragment = getDirectoryPath(fragment);
if (fragment === "") {
fragment = "." + directorySeparator; // TODO: (arozga) can we remove this?
fragment = "." + directorySeparator;
}
fragment = ensureTrailingDirectorySeparator(fragment); // TODO: why is this necessary?
fragment = ensureTrailingDirectorySeparator(fragment);
const absolutePath = normalizeAndPreserveTrailingSlash(isRootedDiskPath(fragment) ? fragment : combinePaths(scriptPath, fragment));
const baseDirectory = getDirectoryPath(absolutePath);