COCOR-LSP.md 1.7 KB

Oberon language services (LSP)

The Theia/VS Code extension starts out/server.js through vscode-languageclient. Two diagnostic sources merge on every edit:

  1. Coco/R dialect validators (external, per-dialect executables).
  2. Local analysis — header/END-name checks plus a lenient declaration parser driving all navigation features below.

Oberon dialects (.Mod / .mod / .def, Ulm .om / .od)

Each pilot binary takes the source file as its single argument and writes a .LST listing next to it; the server parses the listing's ***** ^ message lines (positions are caret-relative to the code after the listing prefix, zero-based columns).

"modula2.oberon.dialect": "oberon2",
"modula2.oberon.validators": {
  "oberon07": "<root>/grammars/Oberon07/build/O07",
  "oberon2": "<root>/grammars/Oberon2/build/O2",
  "ulm": "<root>/grammars/Ulm/build/Ulm"
}

Build each binary first with its pilot build.sh (needs CR and gm2 -fiso). With no command configured for the active dialect the server publishes no validator diagnostics.

Local intelligence (always on, no compiler needed)

  • Outline (modules, routines incl. type-bound receivers, params, record fields with */- export marks)
  • Completion (.-triggered: imported module names alias-aware, record fields, visible declarations, keywords, predefined routines)
  • Hover, go-to-definition, references, rename — incl. M.Name resolution through IMPORT (same-directory .Mod/.mod/.def/ .om/.od) and go-to-module on IMPORT names; matching is case-sensitive, like Oberon itself
  • Full + range formatting (modula2.oberon.format.*; export marks stay attached), semantic tokens, snippets, uppercase-while-typing (modula2.oberon.uppercaseKeywords)