Open Editor Plugin

@react-trace/plugin-open-editor adds an Open in Editor action to the Trace action panel and a settings control for choosing the default editor.

Installation

pnpm add --dev @react-trace/core @react-trace/ui-components @react-trace/plugin-open-editor

If you are already using @react-trace/kit, this plugin is included by default.

Usage

import { Trace } from '@react-trace/core'
import { OpenEditorPlugin } from '@react-trace/plugin-open-editor'

import App from './App'

export function AppWithTrace() {
  return (
    <>
      <App />
      <Trace
        root={import.meta.env.VITE_ROOT}
        plugins={[OpenEditorPlugin({ editor: 'vscode' })]}
      />
    </>
  )
}

Options

interface OpenEditorPluginOptions {
  editor?: EditorPreset
}
OptionTypeDefaultDescription
editorEditorPreset'vscode'The default editor to open files in.

If the user changes the editor in the widget settings, that selection takes precedence.

Supported editors

PresetEditor
vscodeVisual Studio Code
cursorCursor
windsurfWindsurf
webstormWebStorm
intellijIntelliJ IDEA

Behavior

When a source location is selected, the plugin resolves the file path relative to the Trace root and opens the generated editor URL with window.open(...).

Settings

The plugin contributes a settings dropdown inside the widget where users can switch the active editor at runtime.

API

ExportTypeDescription
OpenEditorPlugin(options?)TracePluginCreates the open-editor plugin instance.
EditorPresetTypeUnion of supported editor preset strings.