Handle fs error in markdown path completions (#153869)

Fixes #153867
This commit is contained in:
Matt Bierner 2022-06-30 15:32:32 -07:00 committed by GitHub
parent a449148a14
commit bbce24d8bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -287,7 +287,13 @@ export class MdVsCodePathCompletionProvider implements vscode.CompletionItemProv
const pathSegmentEnd = position.translate({ characterDelta: context.linkSuffix.length });
const replacementRange = new vscode.Range(pathSegmentStart, pathSegmentEnd);
const dirInfo = await this.workspace.readDirectory(parentDir);
let dirInfo: [string, vscode.FileType][];
try {
dirInfo = await this.workspace.readDirectory(parentDir);
} catch {
return;
}
for (const [name, type] of dirInfo) {
// Exclude paths that start with `.`
if (name.startsWith('.')) {