Skip to content

Commit ef02845

Browse files
committed
Convert to async
1 parent 1cd126f commit ef02845

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

extensions/markdown-language-features/src/commands/openDocumentLink.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,21 @@ export class OpenDocumentLinkCommand implements Command {
4343
private readonly engine: MarkdownEngine
4444
) { }
4545

46-
public execute(args: OpenDocumentLinkArgs) {
46+
public async execute(args: OpenDocumentLinkArgs) {
4747
const fromResource = vscode.Uri.parse(decodeURIComponent(args.fromResource));
4848
const targetPath = decodeURIComponent(args.path);
4949
const column = this.getViewColumn(fromResource);
50-
return this.tryOpen(targetPath, args, column).catch(() => {
50+
try {
51+
return await this.tryOpen(targetPath, args, column);
52+
} catch {
5153
if (targetPath && extname(targetPath) === '') {
5254
return this.tryOpen(targetPath + '.md', args, column);
5355
}
5456
const targetResource = vscode.Uri.file(targetPath);
55-
return Promise.resolve(undefined)
56-
.then(() => vscode.commands.executeCommand('vscode.open', targetResource, column))
57-
.then(() => undefined);
58-
});
57+
await Promise.resolve(undefined);
58+
await vscode.commands.executeCommand('vscode.open', targetResource, column);
59+
return undefined;
60+
}
5961
}
6062

6163
private async tryOpen(path: string, args: OpenDocumentLinkArgs, column: vscode.ViewColumn) {

0 commit comments

Comments
 (0)