Skip to content
PT

Static copy

Copied from docs/guides/en/syntax.md in https://github.com/poppy-team/oride (MIT). Pinned to revision 1cd515630b8ceb57777d466bee4970fe7c2e30e0, blob dc54fbc644d4e80bd6bde923c4db79bb29c233f5. The source repository remains canonical; this copy is refreshed through a sync pull request, not live.

Syntax Highlighting Engine ​

Oride utilizes Tree-Sitter (along with a custom Markdown rendering pipeline) to highlight active buffers with low latency and high accuracy.


Supported Languages ​

LanguageIdExtensionsGrammar / EngineTier
rust.rstree-sitter-rust (static)Native Static
c.c, .htree-sitter-c (static)Native Static
bash.sh, .bash, .zshtree-sitter-bash (static)Native Static
markdown.md, …tree-sitter-md + injections (static)Native Static
ori / ori-lang.orlbuilt-in lexical fallbackLexical Engine
python.py, .pywdynamic (.so / plugin) + lexical fallbackPlugin / Fallback
javascript.js, .mjs, .cjsdynamic (.so / plugin) + lexical fallbackPlugin / Fallback
typescript.tsdynamic (.so / plugin) + lexical fallbackPlugin / Fallback
typescriptreact.tsxdynamic (.so / plugin) + lexical fallbackPlugin / Fallback
ruby.rb, .rake, …dynamic (.so / plugin) + lexical fallbackPlugin / Fallback
html.html, .htmdynamic (.so / plugin) + lexical fallbackPlugin / Fallback
css.cssdynamic (.so / plugin) + lexical fallbackPlugin / Fallback
nim.nim, …built-in lexical fallbackLexical Engine
d.d, .dibuilt-in lexical fallbackLexical Engine
lua.luabuilt-in lexical fallbackLexical Engine
oriscript.oristree-sitter-oriscript (static legacy)Legacy Static
plainothers—Plain text

The detected language appears in the status bar. Dynamic grammars can be loaded from ~/.config/oride/grammars/, .oride/grammars/, or installed plugins.

Markdown Fence Injections: Code inside triple backticks ```lang receives syntax highlighting for that specific language. Supported aliases include rust/rs, c/h, bash/sh/shell, python/py, js/javascript, ts/typescript, tsx, ruby/rb, d/dlang, lua, nim, html, css, and oris/oriscript.


How It Works ​

  1. detect_language(path) determines the language identifier based on file extensions or shebangs.
  2. HighlightEngine parses the buffer and generates an abstract syntax tree.
  3. AST nodes are queried and mapped to HighlightKind tokens, which are rendered using colors defined in UiTheme.syntax.
  4. Markdown files use a hybrid approach: structural blocks are processed via tree-sitter-md, and code blocks are highlighted via nested syntax injection.

Workspace Crates ​

  • oride-syntax — Parser engine, token kinds, language detection, and Markdown preview lines.
  • tree-sitter-oriscript — Vendored legacy OriScript grammar binding (maintained for backward compatibility).
  • External grammars via tree-sitter-* crates.

Verification ​

bash
cargo test -p oride-syntax