# Pascal 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` checks plus a lenient declaration parser driving all navigation features below. ## Pascal dialects (`.pas` / `.pp` / `.p`) 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). ```json "modula2.pascal.dialect": "freepascal", "modula2.pascal.validators": { "p2": "/grammars/P2/build/P2", "p4": "/grammars/P4/build/P4", "p6": "/grammars/P6/build/P6", "pascal": "/grammars/Pascal/build/PStd", "turbopascal3": "/grammars/TurboPascal3/build/TP3", "freepascal": "/grammars/FreePascal/build/FPC", "blaise": "/grammars/Blaise/build/BlaiseV", "pascals": "/grammars/PascalS/build/PascalS" } ``` 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. Never point these at the `pcom`/`psc` oracle compilers — they can hang on invalid input. ## Local intelligence (always on, no compiler needed) - Outline (`parsePascal`: programs, units, routines, params, locals, record fields, enum literals) - Completion (`.`-triggered: unit interface names, record fields, visible declarations, keywords, predefined routines) - Hover, go-to-definition, references, rename — incl. `Unit.Name` resolution through `USES` (same-directory `.pas`/`.pp`/`.p`) and go-to-unit on `USES` names; matching is case-insensitive - Full + range formatting (`modula2.pascal.format.*`), semantic tokens, snippets, uppercase-while-typing (`modula2.pascal.uppercaseKeywords`)