дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 11:15:40 +02:00
feat(plugins): let plugin views open a project file at a line (#1362)
Plugin tool windows that list code locations (routes, failed tests, queries) had no way to take the user to file:line. A host import `views.open-location(path, line, column)` opens a file inside the project in an editor of the window the call came from, caret at the given line and column (0-based, UTF-16). It needs `project.read` and refuses paths outside the project; the event goes only to the calling window, as `open-terminal` does. The Rust SDK exposes it as `host::open_location` (with the mock), the API table lists it, and the shipped components are rebuilt for the new WIT. Closes #1334 Co-authored-by: yzPeedro <[email protected]>
Цей коміт міститься в:
1 джерело
7ffaa0b5da
коміт
8d784ac164
42 files changed
+114
-16
No files matched your search
@@ -5480,7 +5480,7 @@ export type PluginEvent =
|
||||
/** For the script of a view's `html` body. */
|
||||
{ type: "viewMessage"; pluginId: string; view: string; message: string } |
|
||||
/** Open a terminal running `program` (already approved and verified). */
|
||||
{ type: "openTerminal"; pluginId: string; title: string; program: IpcPath; args: string[]; cwd: IpcPath } |
|
||||
{ type: "openTerminal"; pluginId: string; title: string; program: IpcPath; args: string[]; cwd: IpcPath } | { type: "openLocation"; pluginId: string; path: IpcPath; line: number; column: number } |
|
||||
/**
|
||||
* Plugin languages, or the servers they may start, changed: re-fetch
|
||||
* `languages` (the host re-detects open documents: [`crate::Host::plugin_languages_changed`]).
|
||||
|
||||
@@ -12,7 +12,7 @@ import { onIdeEvent } from "@/platform/ipc";
|
||||
import { useProject } from "@/platform/project";
|
||||
import { shortcutLabel } from "@/platform/keymap";
|
||||
import { BarButton } from "@/ui/BarButton";
|
||||
import { registerStatusItem } from "@/workbench/contributions";
|
||||
import { maybeEditorService, registerStatusItem } from "@/workbench/contributions";
|
||||
import { removeTask, upsertTask, useTasks } from "@/workbench/tasks";
|
||||
import { pluginsBackend } from "./backend";
|
||||
import { bumpView, deliverViewMessage } from "./views/viewStore";
|
||||
@@ -259,6 +259,9 @@ export function handleRuntimeEvent(e: PluginEvent): boolean {
|
||||
// The program was approved (`process:`) and verified by the host.
|
||||
void executeAction("terminal.runCommand", { program: e.program, args: e.args, name: e.title, cwd: e.cwd });
|
||||
return true;
|
||||
case "openLocation":
|
||||
void maybeEditorService()?.openFile(e.path, { selection: { line: e.line, col: e.column }, focus: true });
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in new issue
Заблокувати користувача