Common RPC Functions
WARNING
Deprecated for the @devframes/service-open wire service — one host-level install shared by every plugin, feature-detectable from clients, with workspace-root path containment atop the editor gating. The recipe keeps working; removal in a future major.
Prebuilt RPC actions: open a file in an editor, reveal a path in the OS.
ts
import { commonRpcFunctions } from 'devframe/recipes/common-rpc-functions'
defineDevframe({
id: 'my-tool',
name: 'My Tool',
setup(ctx) {
commonRpcFunctions.forEach(fn => ctx.rpc.register(fn))
},
})Exports
| Export | Registered name | Type | Args | Purpose |
|---|---|---|---|---|
openInEditor | devframe:open-in-editor | action | [filename: string, editor?: KnownEditor] | Open via launchEditor; filename = file/file:line/file:line:column. |
openInFinder | devframe:open-in-finder | action | [path: string] | Reveal via open |
commonRpcFunctions | — | readonly [openInEditor, openInFinder] | — | Batch-registration array. |
KNOWN_EDITORS | — | readonly string[] | — | Accepted commands (code, vim, …). |
KnownEditor | — | type | — | Union of KNOWN_EDITORS. |
Both action RPCs lazy-import() their devframe/utils/* deps.
Pick and choose
ts
import { openInEditor } from 'devframe/recipes/common-rpc-functions'
defineDevframe({
id: 'my-tool',
setup(ctx) {
ctx.rpc.register(openInEditor)
},
})On the client
ts
const rpc = await connectDevframe()
await rpc.call('devframe:open-in-editor', 'src/main.ts:42:7')
await rpc.call('devframe:open-in-editor', 'src/main.ts:42:7', 'code')
await rpc.call('devframe:open-in-finder', '/abs/path/to/dir')Auto-detection reads server-side LAUNCH_EDITOR when no editor is passed.