Skip to content

Commit bbce24d

Browse files
authored
Handle fs error in markdown path completions (microsoft#153869)
Fixes microsoft#153867
1 parent a449148 commit bbce24d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

extensions/markdown-language-features/src/languageFeatures/pathCompletions.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,13 @@ export class MdVsCodePathCompletionProvider implements vscode.CompletionItemProv
287287
const pathSegmentEnd = position.translate({ characterDelta: context.linkSuffix.length });
288288
const replacementRange = new vscode.Range(pathSegmentStart, pathSegmentEnd);
289289

290-
const dirInfo = await this.workspace.readDirectory(parentDir);
290+
let dirInfo: [string, vscode.FileType][];
291+
try {
292+
dirInfo = await this.workspace.readDirectory(parentDir);
293+
} catch {
294+
return;
295+
}
296+
291297
for (const [name, type] of dirInfo) {
292298
// Exclude paths that start with `.`
293299
if (name.startsWith('.')) {

0 commit comments

Comments
 (0)