refactor: Display selected code editor over generic Editor

This commit is contained in:
Ali Houssain Sareini 2024-10-15 08:02:34 -04:00
parent 08bd7f7129
commit f96f1ae2c3
5 changed files with 12 additions and 10 deletions

View File

@ -23,7 +23,7 @@
const unsubscribeopenInEditor = listen<string>(
'menu://project/open-in-vscode/clicked',
async () => {
const path = `${$userSettings.defaultCodeEditor}://file${project.vscodePath}?windowId=_blank`;
const path = `${$userSettings.defaultCodeEditor.schemeIdentifer}://file${project.vscodePath}?windowId=_blank`;
openExternalUrl(path);
}
);

View File

@ -19,7 +19,7 @@
async function openInEditor() {
openExternalUrl(
`${$userSettings.defaultCodeEditor}://file${project.vscodePath}/?windowId=_blank`
`${$userSettings.defaultCodeEditor.schemeIdentifer}://file${project.vscodePath}/?windowId=_blank`
);
}
</script>
@ -70,7 +70,7 @@
<div class="empty-board__suggestions__link__icon">
<Icon name="vscode" />
</div>
<span class="text-12">Open in Editor</span>
<span class="text-12">`Open in {$userSettings.defaultCodeEditor.displayName}`</span>
</button>
</div>
</div>

View File

@ -166,7 +166,7 @@
async function openAllConflictedFiles() {
for (const file of conflictedFiles) {
const absPath = await join(project.vscodePath, file.path);
openExternalUrl(`${$userSettings.defaultCodeEditor}://file${absPath}`);
openExternalUrl(`${$userSettings.defaultCodeEditor.schemeIdentifer}://file${absPath}`);
}
}
</script>
@ -177,8 +177,8 @@
{editModeMetadata.commitOid.slice(0, 7)}
</span>
<InfoButton title="Edit Mode">
Edit Mode lets you modify an existing commit in isolation or resolve conflicts. Any
changes made, including new files, will be added to the selected commit.
Edit Mode lets you modify an existing commit in isolation or resolve conflicts. Any changes
made, including new files, will be added to the selected commit.
</InfoButton>
</h2>

View File

@ -87,14 +87,16 @@
/>
{/if}
<ContextMenuItem
label="Open in Editor"
label="Open in {$userSettings.defaultCodeEditor.displayName}"
disabled={isDeleted(item)}
on:click={async () => {
try {
if (!project) return;
for (let file of item.files) {
const absPath = await join(project.vscodePath, file.path);
openExternalUrl(`${$userSettings.defaultCodeEditor}://file${absPath}`);
openExternalUrl(
`${$userSettings.defaultCodeEditor.schemeIdentifer}://file${absPath}`
);
}
contextMenu.close();
} catch {

View File

@ -46,11 +46,11 @@
{/if}
{#if item.lineNumber}
<ContextMenuItem
label="Open in Editor"
label="Open in {$userSettings.defaultCodeEditor.displayName}"
on:click={() => {
projectPath &&
openExternalUrl(
`${$userSettings.defaultCodeEditor}://file${projectPath}/${filePath}:${item.lineNumber}`
`${$userSettings.defaultCodeEditor.schemeIdentifer}://file${projectPath}/${filePath}:${item.lineNumber}`
);
contextMenu.close();
}}