Skip to content

Commit d737dc1

Browse files
author
Arthur Ozga
committed
Responding To billti's comments
1 parent 0871628 commit d737dc1

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

src/server/lsHost.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ namespace ts.server {
180180
}
181181

182182
readDirectory(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[] {
183-
return this.host.readDirectory(path, exclude, exclude, include);
183+
return this.host.readDirectory(path, extensions, exclude, include);
184184
}
185185

186186
getDirectories(path: string): string[] {

src/services/completions.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -548,39 +548,39 @@ namespace ts.Completions {
548548
return undefined;
549549
}
550550

551+
const completionInfo: CompletionInfo = {
552+
isMemberCompletion: false,
553+
/**
554+
* The user may type in a path that doesn't yet exist, creating a "new identifier"
555+
* with respect to the collection of identifiers the server is aware of.
556+
*/
557+
isNewIdentifierLocation: true,
558+
entries: []
559+
};
560+
551561
const text = sourceFile.text.substr(range.pos, position - range.pos);
552562

553563
const match = tripleSlashDirectiveFragmentRegex.exec(text);
564+
554565
if (match) {
555566
const prefix = match[1];
556567
const kind = match[2];
557568
const toComplete = match[3];
558569

559570
const scriptPath = getDirectoryPath(sourceFile.path);
560-
let entries: CompletionEntry[];
561571
if (kind === "path") {
562572
// Give completions for a relative path
563573
const span: TextSpan = getDirectoryFragmentTextSpan(toComplete, range.pos + prefix.length);
564-
entries = getCompletionEntriesForDirectoryFragment(toComplete, scriptPath, getSupportedExtensions(compilerOptions), /*includeExtensions*/true, span, sourceFile.path);
574+
completionInfo.entries = getCompletionEntriesForDirectoryFragment(toComplete, scriptPath, getSupportedExtensions(compilerOptions), /*includeExtensions*/true, span, sourceFile.path);
565575
}
566576
else {
567577
// Give completions based on the typings available
568578
const span: TextSpan = { start: range.pos + prefix.length, length: match[0].length - prefix.length };
569-
entries = getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span);
579+
completionInfo.entries = getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span);
570580
}
571-
572-
return {
573-
isMemberCompletion: false,
574-
isNewIdentifierLocation: true,
575-
entries
576-
};
577581
}
578582

579-
return {
580-
isMemberCompletion: false,
581-
isNewIdentifierLocation: false,
582-
entries: []
583-
};
583+
return completionInfo;
584584
}
585585

586586
function getCompletionEntriesFromTypings(host: LanguageServiceHost, options: CompilerOptions, scriptPath: string, span: TextSpan, result: CompletionEntry[] = []): CompletionEntry[] {

0 commit comments

Comments
 (0)