Improve files view behavior and Open In integration (#579)

* feat: open focused file in selected desktop app

* fix: make file tree indicators match active open tabs

* fix: limit preview functionality to markdown files only

* feat: add Open In action to file editor toolbar. add antigravity to openin app list
This commit is contained in:
Iuliia Ivashko
2026-03-03 01:07:03 +02:00
committed by GitHub
parent 604ac682c2
commit bcbc2646fd
7 changed files with 421 additions and 110 deletions
+34
View File
@@ -434,6 +434,40 @@ export const openDesktopPath = async (path: string, app?: string | null): Promis
}
};
export const openDesktopProjectInApp = async (
projectPath: string,
appId: string,
appName: string,
filePath?: string | null,
): Promise<boolean> => {
if (!isTauriShell() || !isDesktopLocalOriginActive()) {
return false;
}
const trimmedProjectPath = projectPath?.trim();
const trimmedAppId = appId?.trim();
const trimmedAppName = appName?.trim();
const trimmedFilePath = typeof filePath === 'string' ? filePath.trim() : '';
if (!trimmedProjectPath || !trimmedAppId || !trimmedAppName) {
return false;
}
try {
const tauri = (window as unknown as { __TAURI__?: TauriGlobal }).__TAURI__;
await tauri?.core?.invoke?.('desktop_open_in_app', {
projectPath: trimmedProjectPath,
appId: trimmedAppId,
appName: trimmedAppName,
filePath: trimmedFilePath.length > 0 ? trimmedFilePath : undefined,
});
return true;
} catch (error) {
console.warn('Failed to open project in app (tauri)', error);
return false;
}
};
export const filterInstalledDesktopApps = async (apps: string[]): Promise<string[]> => {
if (!isTauriShell() || !isDesktopLocalOriginActive()) {
return [];
+44
View File
@@ -0,0 +1,44 @@
export type OpenInApp = {
id: string;
label: string;
appName: string;
};
export const OPEN_IN_APPS: OpenInApp[] = [
{ id: 'finder', label: 'Finder', appName: 'Finder' },
{ id: 'terminal', label: 'Terminal', appName: 'Terminal' },
{ id: 'iterm2', label: 'iTerm2', appName: 'iTerm' },
{ id: 'ghostty', label: 'Ghostty', appName: 'Ghostty' },
{ id: 'vscode', label: 'VS Code', appName: 'Visual Studio Code' },
{ id: 'intellij', label: 'IntelliJ', appName: 'IntelliJ IDEA' },
{ id: 'visual-studio', label: 'Visual Studio', appName: 'Visual Studio' },
{ id: 'cursor', label: 'Cursor', appName: 'Cursor' },
{ id: 'android-studio', label: 'Android Studio', appName: 'Android Studio' },
{ id: 'pycharm', label: 'PyCharm', appName: 'PyCharm' },
{ id: 'xcode', label: 'Xcode', appName: 'Xcode' },
{ id: 'sublime-text', label: 'Sublime', appName: 'Sublime Text' },
{ id: 'webstorm', label: 'WebStorm', appName: 'WebStorm' },
{ id: 'rider', label: 'Rider', appName: 'Rider' },
{ id: 'zed', label: 'Zed', appName: 'Zed' },
{ id: 'phpstorm', label: 'PhpStorm', appName: 'PhpStorm' },
{ id: 'eclipse', label: 'Eclipse', appName: 'Eclipse' },
{ id: 'windsurf', label: 'Windsurf', appName: 'Windsurf' },
{ id: 'vscodium', label: 'VSCodium', appName: 'VSCodium' },
{ id: 'rustrover', label: 'RustRover', appName: 'RustRover' },
{ id: 'antigravity', label: 'Antigravity', appName: 'Antigravity' },
{ id: 'trae', label: 'Trae', appName: 'Trae' },
];
export const DEFAULT_OPEN_IN_APP_ID = 'finder';
export const OPEN_DIRECTORY_APP_IDS = new Set(['finder', 'terminal', 'iterm2', 'ghostty']);
export const getOpenInAppById = (id: string | null | undefined): OpenInApp | null => {
if (!id) {
return null;
}
return OPEN_IN_APPS.find((app) => app.id === id) ?? null;
};
export const getDefaultOpenInApp = (): OpenInApp => {
return getOpenInAppById(DEFAULT_OPEN_IN_APP_ID) ?? OPEN_IN_APPS[0];
};