stablyai / stablyai/orca

[Feature]: Load user-provided TextMate grammars for custom syntax highlighting

Open
#8,093 2 comments 0 reactions 1 assignee Claimed by @brennanb2025 View on GitHub
enhancement
Dominant language
TypeScript
Stars
71.3k
Forks
4.7k
Avg merge
14h 54m
Merged PRs (30d)
520

Description

### Problem or use case

Orca only provides syntax highlighting for languages registered in its source code. There is currently no settings entry, grammar directory, or user-facing mechanism for adding a niche, proprietary, or otherwise unsupported language.

To add highlighting today, a user must modify Orca's extension mapping and Monaco language registration code, then rebuild the application. This is not practical for private languages or grammars that should not be upstreamed into Orca.

I would like to associate file extensions or exact filenames with a user-provided TextMate grammar so those files receive client-side syntax colors in Orca's editor.

This request is only for lexical syntax highlighting. It does not require an LSP, semantic tokens, completion, diagnostics, or code formatting.

### Proposed solution

Add a small user-facing mechanism for registering custom TextMate grammars.

A registration should contain:

- a language ID and display name
- one or more file extensions and/or exact filenames
- the path to a local `.tmLanguage.json` grammar
- optionally, basic language configuration such as line comments, block comments, brackets, and auto-closing pairs

Orca can load the grammar in the renderer using its existing `vscode-textmate` and `vscode-oniguruma` integration, which is already used for Nim.

Expected behavior:

- matching files are assigned the configured Monaco language ID
- TextMate scopes are rendered using the existing Monaco `vs` or `vs-dark` theme
- highlighting works in the normal source editor and diff views
- highlighting also works for files opened from SSH or another remote runtime, while the grammar itself remains loaded and executed locally in the renderer
- invalid or unreadable grammar files produce a clear error instead of breaking the editor
- adding or updating a registration does not require rebuilding Orca; restarting the application would be acceptable for an initial implementation

Non-goals for this request:

- no language-server or LSP integration
- no semantic highlighting
- no completion, hover, references, diagnostics, or formatting
- no custom theme editor
- no general-purpose plugin system

### Alternatives or additional context

The current workaround is to fork Orca and make source changes:

1. add the extension or filename to `src/renderer/src/lib/language-detect.ts`
2. add a language registration under `src/renderer/src/lib/monaco-languages/`
3. register it from `src/renderer/src/lib/monaco-setup.ts`
4. rebuild Orca

Orca already has most of the renderer-side machinery needed for an MVP:

- Monaco Editor for source and diff rendering
- `vscode-textmate`
- `vscode-oniguruma`
- a reusable TextMate token-provider path used by Nim
- existing light and dark Monaco themes

A narrow first version could support only local JSON TextMate grammars plus extension/filename mappings. A broader plugin framework or language-server
architecture is not needed for this use case.

Related but separate issue:

- Configurable Monaco editor theme: https://github.com/stablyai/orca/issues/6308

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.