Also wrap getEffectiveTypeRoots in import completion code

This commit is contained in:
Richard Knoll 2016-09-12 18:17:54 -07:00
parent 4af2dcd32e
commit 6ea5c22760

View File

@ -575,9 +575,17 @@ namespace ts.Completions {
}
}
else if (host.getDirectories) {
const typeRoots = getEffectiveTypeRoots(options, host);
for (const root of typeRoots) {
getCompletionEntriesFromDirectories(host, options, root, span, result);
let typeRoots: string[];
try {
// Wrap in try catch because getEffectiveTypeRoots touches the filesystem
typeRoots = getEffectiveTypeRoots(options, host);
}
catch (e) {}
if (typeRoots) {
for (const root of typeRoots) {
getCompletionEntriesFromDirectories(host, options, root, span, result);
}
}
}