Editor & LSP

Reepolee ships a Language Server Protocol server at ree-lsp.cjs that gives any LSP-compatible editor deep awareness of your .ree templates. It runs as a stdio process — no network port, no daemon, no separate install. The project starter already includes it and configures it through the ree section in package.json.

What It Provides

CapabilityHow it works
Tag completionsTyping { inside a .ree file suggests all tag forms ({#if}, {#each}, {= }, {_ }, {{ }}) with documentation
Helper completionsAfter {= or {~ , suggests built-in helpers (localized_path, format_datetime, nav_label, md, url, and 30+ more)
Translation-key completionsAfter {_ , {- , or {@ , suggests keys from your project's translation index with cross-locale ghost values
Hover informationHovering a translation key shows its value in every configured locale; hovering a component tag shows its source path
Go-to-definitionCmd/Ctrl-click an {#include} path, a <component-name> tag, or a {_ ui.title } key to jump to the source file or translation entry
Component discovery<app-banner> resolves through component_roots — the LSP finds components/app-banner.ree and provides completions and navigation

How It Works

The LSP reads the ree section from package.json to discover your project's structure:

{
  "ree": {
    "project_family": "reepolee",
    "template_roots": ["routes"],
    "component_roots": ["components"],
    "translation_provider": "db-export",
    "translation_root": ".reepolee/i18n"
  }
}

From these paths it builds a project profile that knows:

  • Where templates liveroutes/ and any additional template_roots
  • Where components livecomponents/ and any additional component_roots
  • Where translations live.reepolee/i18n/, the JSON export that the dev server writes at startup. The LSP reads these files for autocompletion of {_ } / {- } / {@ } keys and shows the resolved value in every locale on hover

The translation_provider: "db-export" tells the LSP that translations are database-backed and exported to JSON — it reads the export rather than connecting to the database. Run bun dev at least once so the export files exist for the LSP to consume.

Connecting Your Editor

VS Code

Install the Ree Templates extension from the marketplace. It bundles the LSP and connects automatically when you open a .ree file in a project with a ree section in package.json.

code --install-extension reepolee.ree-templates

The extension also provides syntax highlighting, file icons, and formatting (via reettier). See the extension docs for settings and configuration.

For Tailwind IntelliSense inside .ree files, add to your VS Code settings:

"tailwindCSS.includeLanguages": { "ree": "html" }

Other Editors

Any editor that speaks LSP over stdio can connect. Point it at:

bun ree-lsp.cjs

from the project root. The server uses JSON-RPC 2.0 over stdin/stdout. It accepts initialize, textDocument/completion, textDocument/hover, textDocument/definition, and textDocument/didChange / didOpen / didClose. Consult your editor's LSP documentation for how to register a custom stdio language server.

Translation Support

The LSP reads translation indexes from .reepolee/i18n/ (written by the dev server at startup and on translation reload). This gives you:

  • Key completions — type {_ and see every key from your translation namespace with its English value as a detail string
  • Multi-locale hover — hover any {_ ui.title } to see its value in every configured locale
  • Go-to-definition — Cmd/Ctrl-click a key to jump to its entry in the locale JSON file

If completions don't appear, start bun dev once so the export files are generated. The LSP re-reads them when they change.

Without the ree Section

If package.json has no ree object, the LSP falls back to heuristics: it walks up the directory tree looking for routes/ alongside lib/template/compiler.ts. When it finds both it loads a default Reepolee profile. The explicit ree section is faster and unambiguous — every starter ships with it.

Troubleshooting

SymptomLikely causeFix
No completions in .ree filesLSP not connectedCheck your editor's LSP log. For VS Code, verify the Ree Templates extension is installed and enabled
Translation keys don't autocompleteNo JSON export yetRun bun dev — the dev server writes .reepolee/i18n/*.json at startup
Component tags don't resolveWrong component_rootsCheck the ree.component_roots array in package.json
LSP starts but reports errorsProject root not foundOpen the editor from the project root (where package.json lives)
bun: command not found in editorBun not on PATHEditors launched from the dock/launcher may not inherit shell PATH. Launch from terminal or add Bun's bin directory to your system PATH