* feat(desktop): open files in more installed editors Detect bundled app commands as well as PATH launchers and preserve file positions through editor-specific launches. * fix(desktop): preserve editor target compatibility Keep existing file-manager preference ids, retain project context for file launches, and recognize Windows 64-bit IDE commands.
29 lines
941 B
TypeScript
29 lines
941 B
TypeScript
import type { EditorTarget } from "../target.js";
|
|
|
|
const COMMANDS = ["phpstorm", "phpstorm64"] as const;
|
|
|
|
export const phpstormTarget: EditorTarget = {
|
|
id: "phpstorm",
|
|
async describe() {
|
|
return {
|
|
id: this.id,
|
|
label: "PhpStorm",
|
|
kind: "editor",
|
|
icon: { kind: "symbol", name: "terminal" },
|
|
};
|
|
},
|
|
async isInstalled(runtime) {
|
|
return runtime.resolveCommand(COMMANDS) !== null;
|
|
},
|
|
async launch(input, runtime) {
|
|
const command = runtime.resolveCommand(COMMANDS);
|
|
if (!command) throw new Error("PhpStorm is not installed");
|
|
if (!input.filePath) return runtime.spawnDetached({ command, args: [input.workspacePath] });
|
|
const args: string[] = [];
|
|
if (input.line) args.push("--line", String(input.line));
|
|
if (input.column) args.push("--column", String(input.column));
|
|
args.push(input.workspacePath, input.filePath);
|
|
await runtime.spawnDetached({ command, args });
|
|
},
|
|
};
|