From 8810cbddbb3222b19f680c4836d225613abef6ed Mon Sep 17 00:00:00 2001 From: Seb Julliand Date: Wed, 13 Nov 2024 09:02:45 +0100 Subject: [PATCH] Use `vscode.openWith` only when necessary Otherwise, use `vscode.open` to let VS Code open files with the approriate editor. Signed-off-by: Seb Julliand --- src/instantiate.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/instantiate.ts b/src/instantiate.ts index c8fbfea57..fc7eb62a1 100644 --- a/src/instantiate.ts +++ b/src/instantiate.ts @@ -116,7 +116,12 @@ export async function loadAllofExtension(context: vscode.ExtensionContext) { } try { - await vscode.commands.executeCommand(`vscode.openWith`, uri, 'default', { selection: options.position } as vscode.TextDocumentShowOptions); + if(options.position){ + await vscode.commands.executeCommand(`vscode.openWith`, uri, 'default', { selection: options.position } as vscode.TextDocumentShowOptions); + } + else{ + await vscode.commands.executeCommand(`vscode.open`, uri); + } // Add file to front of recently opened files list. const recentLimit = GlobalConfiguration.get(`recentlyOpenedFilesLimit`);