Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/desktop/src/lib/trpc/routers/external/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { EXTERNAL_APPS, type ExternalApp } from "@superset/local-db";
const APP_NAMES: Record<ExternalApp, string | null> = {
finder: null, // Handled specially with shell.showItemInFolder
vscode: "Visual Studio Code",
"vscode-insiders": "Visual Studio Code - Insiders",
cursor: "Cursor",
xcode: "Xcode",
iterm: "iTerm",
Expand Down
56 changes: 56 additions & 0 deletions apps/desktop/src/renderer/assets/app-icons/vscode-insiders.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 54 additions & 3 deletions apps/desktop/src/renderer/components/OpenInButton/OpenInButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import rustroverIcon from "renderer/assets/app-icons/rustrover.svg";
import sublimeIcon from "renderer/assets/app-icons/sublime.svg";
import terminalIcon from "renderer/assets/app-icons/terminal.png";
import vscodeIcon from "renderer/assets/app-icons/vscode.svg";
import vscodeInsidersIcon from "renderer/assets/app-icons/vscode-insiders.svg";
import warpIcon from "renderer/assets/app-icons/warp.png";
import webstormIcon from "renderer/assets/app-icons/webstorm.svg";
import xcodeIcon from "renderer/assets/app-icons/xcode.svg";
Expand All @@ -42,19 +43,34 @@ interface AppOption {
id: ExternalApp;
label: string;
icon: string;
displayLabel?: string;
}

export const APP_OPTIONS: AppOption[] = [
{ id: "finder", label: "Finder", icon: finderIcon },
{ id: "cursor", label: "Cursor", icon: cursorIcon },
{ id: "vscode", label: "VS Code", icon: vscodeIcon },
{ id: "sublime", label: "Sublime Text", icon: sublimeIcon },
{ id: "xcode", label: "Xcode", icon: xcodeIcon },
{ id: "iterm", label: "iTerm", icon: itermIcon },
{ id: "warp", label: "Warp", icon: warpIcon },
{ id: "terminal", label: "Terminal", icon: terminalIcon },
];

export const VSCODE_OPTIONS: AppOption[] = [
{
id: "vscode",
label: "Standard",
icon: vscodeIcon,
displayLabel: "VS Code",
},
{
id: "vscode-insiders",
label: "Insiders",
icon: vscodeInsidersIcon,
displayLabel: "VS Code Insiders",
},
];

export const JETBRAINS_OPTIONS: AppOption[] = [
{ id: "intellij", label: "IntelliJ IDEA", icon: intellijIcon },
{ id: "webstorm", label: "WebStorm", icon: webstormIcon },
Expand All @@ -70,7 +86,11 @@ export const JETBRAINS_OPTIONS: AppOption[] = [
{ id: "rustrover", label: "RustRover", icon: rustroverIcon },
];

const ALL_APP_OPTIONS = [...APP_OPTIONS, ...JETBRAINS_OPTIONS];
const ALL_APP_OPTIONS = [
...APP_OPTIONS,
...VSCODE_OPTIONS,
...JETBRAINS_OPTIONS,
];

export const getAppOption = (id: ExternalApp) =>
ALL_APP_OPTIONS.find((app) => app.id === id) ?? APP_OPTIONS[1];
Expand Down Expand Up @@ -139,7 +159,7 @@ export function OpenInButton({
</Button>
</TooltipTrigger>
<TooltipContent side="bottom" showArrow={false}>
{`Open in ${currentApp.label}${showShortcuts ? " (⌘O)" : ""}`}
{`Open in ${currentApp.displayLabel ?? currentApp.label}${showShortcuts ? " (⌘O)" : ""}`}
</TooltipContent>
</Tooltip>
)}
Expand Down Expand Up @@ -175,6 +195,37 @@ export function OpenInButton({
)}
</DropdownMenuItem>
))}
<DropdownMenuSub>
<DropdownMenuSubTrigger className="flex items-center gap-2">
<img
src={vscodeIcon}
alt="VS Code"
className="size-4 object-contain"
/>
<span>VS Code</span>
</DropdownMenuSubTrigger>
<DropdownMenuSubContent className="w-48">
{VSCODE_OPTIONS.map((app) => (
<DropdownMenuItem
key={app.id}
onClick={() => handleOpenIn(app.id)}
className="flex items-center justify-between"
>
<div className="flex items-center gap-2">
<img
src={app.icon}
alt={app.label}
className="size-4 object-contain"
/>
<span>{app.label}</span>
</div>
{showShortcuts && app.id === lastUsedApp && (
<span className="text-xs text-muted-foreground">⌘O</span>
)}
</DropdownMenuItem>
))}
</DropdownMenuSubContent>
</DropdownMenuSub>
<DropdownMenuSub>
<DropdownMenuSubTrigger className="flex items-center gap-2">
<img
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src/renderer/components/OpenInButton/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export {
getAppOption,
JETBRAINS_OPTIONS,
OpenInButton,
VSCODE_OPTIONS,
} from "./OpenInButton";
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export function FileHeader({ file, worktreePath }: FileHeaderProps) {
</button>
</TooltipTrigger>
<TooltipContent side="bottom" showArrow={false}>
Open in {currentApp.label}
Open in {currentApp.displayLabel ?? currentApp.label}
</TooltipContent>
</Tooltip>
<Tooltip>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "@superset/ui/tooltip";
import { HiChevronDown } from "react-icons/hi2";
import { LuArrowUpRight, LuCopy } from "react-icons/lu";
import jetbrainsIcon from "renderer/assets/app-icons/jetbrains.svg";
import vscodeIcon from "renderer/assets/app-icons/vscode.svg";
import {
APP_OPTIONS,
getAppOption,
JETBRAINS_OPTIONS,
VSCODE_OPTIONS,
} from "renderer/components/OpenInButton";
import { shortenHomePath } from "renderer/lib/formatPath";
import { trpc } from "renderer/lib/trpc";
Expand Down Expand Up @@ -105,7 +107,7 @@ export function WorkspaceActionBarRight({
</TooltipTrigger>
<TooltipContent side="top" sideOffset={8}>
<span className="flex items-center gap-1.5">
Open in {currentApp.label}
Open in {currentApp.displayLabel ?? currentApp.label}
<kbd className="px-1.5 py-0.5 text-[10px] font-sans bg-foreground/10 rounded">
⌘O
</kbd>
Expand Down Expand Up @@ -145,6 +147,34 @@ export function WorkspaceActionBarRight({
)}
</DropdownMenuItem>
))}
<DropdownMenuSub>
<DropdownMenuSubTrigger>
<img
src={vscodeIcon}
alt="VS Code"
className="size-4 object-contain mr-2"
/>
VS Code
</DropdownMenuSubTrigger>
<DropdownMenuSubContent className="w-44">
{VSCODE_OPTIONS.map((app) => (
<DropdownMenuItem
key={app.id}
onClick={() => handleOpenInOtherApp(app.id)}
>
<img
src={app.icon}
alt={app.label}
className="size-4 object-contain mr-2"
/>
{app.label}
{app.id === lastUsedApp && (
<DropdownMenuShortcut>⌘O</DropdownMenuShortcut>
)}
</DropdownMenuItem>
))}
</DropdownMenuSubContent>
</DropdownMenuSub>
<DropdownMenuSub>
<DropdownMenuSubTrigger>
<img
Expand Down
1 change: 1 addition & 0 deletions packages/local-db/src/schema/zod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export type WorkspaceType = z.infer<typeof workspaceTypeSchema>;
export const EXTERNAL_APPS = [
"finder",
"vscode",
"vscode-insiders",
"cursor",
"sublime",
"xcode",
Expand Down
Loading