Skip to content

Commit 6ea5c22

Browse files
committed
Also wrap getEffectiveTypeRoots in import completion code
1 parent 4af2dcd commit 6ea5c22

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/services/completions.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -575,9 +575,17 @@ namespace ts.Completions {
575575
}
576576
}
577577
else if (host.getDirectories) {
578-
const typeRoots = getEffectiveTypeRoots(options, host);
579-
for (const root of typeRoots) {
580-
getCompletionEntriesFromDirectories(host, options, root, span, result);
578+
let typeRoots: string[];
579+
try {
580+
// Wrap in try catch because getEffectiveTypeRoots touches the filesystem
581+
typeRoots = getEffectiveTypeRoots(options, host);
582+
}
583+
catch (e) {}
584+
585+
if (typeRoots) {
586+
for (const root of typeRoots) {
587+
getCompletionEntriesFromDirectories(host, options, root, span, result);
588+
}
581589
}
582590
}
583591

0 commit comments

Comments
 (0)