adjusted remaining handlers

This commit is contained in:
TheGB0077 2024-06-03 15:33:48 -03:00
parent 908c6cdff7
commit 9b791cc986
3 changed files with 8 additions and 4 deletions

View File

@ -12,6 +12,7 @@
import { BaseBranch } from '$lib/vbranches/types'; import { BaseBranch } from '$lib/vbranches/types';
import { VirtualBranchService } from '$lib/vbranches/virtualBranch'; import { VirtualBranchService } from '$lib/vbranches/virtualBranch';
import { open } from '@tauri-apps/api/shell'; import { open } from '@tauri-apps/api/shell';
import { editor } from '$lib/utils/systemEditor';
const vbranchService = getContext(VirtualBranchService); const vbranchService = getContext(VirtualBranchService);
const branchController = getContext(BranchController); const branchController = getContext(BranchController);
@ -149,9 +150,9 @@
role="button" role="button"
tabindex="0" tabindex="0"
on:keypress={async () => on:keypress={async () =>
await open(`vscode://file${project.vscodePath}/?windowId=_blank`)} await open(`${editor.get()}://file${project.vscodePath}/?windowId=_blank`)}
on:click={async () => on:click={async () =>
await open(`vscode://file${project.vscodePath}/?windowId=_blank`)} await open(`${editor.get()}://file${project.vscodePath}/?windowId=_blank`)}
> >
<div class="empty-board__suggestions__link__icon"> <div class="empty-board__suggestions__link__icon">
<Icon name="vscode" /> <Icon name="vscode" />

View File

@ -13,6 +13,7 @@
import { LocalFile, type AnyFile } from '$lib/vbranches/types'; import { LocalFile, type AnyFile } from '$lib/vbranches/types';
import { join } from '@tauri-apps/api/path'; import { join } from '@tauri-apps/api/path';
import { open } from '@tauri-apps/api/shell'; import { open } from '@tauri-apps/api/shell';
import { editor } from '$lib/utils/systemEditor';
const branchController = getContext(BranchController); const branchController = getContext(BranchController);
const project = getContext(Project); const project = getContext(Project);
@ -89,7 +90,7 @@
if (!project) return; if (!project) return;
for (let file of item.files) { for (let file of item.files) {
const absPath = await join(project.path, file.path); const absPath = await join(project.path, file.path);
open(`vscode://file${absPath}`); open(`${editor.get()}://file${absPath}`);
} }
dismiss(); dismiss();
} catch { } catch {

View File

@ -4,6 +4,7 @@
import ContextMenuItem from '$lib/components/contextmenu/ContextMenuItem.svelte'; import ContextMenuItem from '$lib/components/contextmenu/ContextMenuItem.svelte';
import ContextMenuSection from '$lib/components/contextmenu/ContextMenuSection.svelte'; import ContextMenuSection from '$lib/components/contextmenu/ContextMenuSection.svelte';
import { getContext } from '$lib/utils/context'; import { getContext } from '$lib/utils/context';
import { editor } from '$lib/utils/systemEditor';
import { BranchController } from '$lib/vbranches/branchController'; import { BranchController } from '$lib/vbranches/branchController';
import { open } from '@tauri-apps/api/shell'; import { open } from '@tauri-apps/api/shell';
@ -36,7 +37,8 @@
<ContextMenuItem <ContextMenuItem
label="Open in VS Code" label="Open in VS Code"
on:mousedown={() => { on:mousedown={() => {
projectPath && open(`vscode://file${projectPath}/${filePath}:${item.lineNumber}`); projectPath &&
open(`${editor.get()}://file${projectPath}/${filePath}:${item.lineNumber}`);
dismiss(); dismiss();
}} }}
/> />