Gegevensbeheer for Visual Studio Code
Language support for Gegevensbeheer .ggbh files, with editing assistance for imported .rc record files.
Features
- Syntax highlighting for Gegevensbeheer code and record definitions.
- Autocomplete for functions, imported records, and record fields.
- Hover documentation for supported functions.
- Diagnostics for unknown function calls, imports, records, and fields, as well as missing field separators in
.rc files.
- Bracket matching, auto-closing pairs, and indentation support.
The function database is based on Vectorworks scripting functions.
Working with records
Place a .rc file beside your .ggbh file and import it by its filename without the extension:
import records
Define records and their fields in records.rc:
record Door {
Width: 900,
Height: 2100
}
Reference a field with 'Door'.'Width'. Typing an opening quote offers record and field completions; after the dot, completions are limited to fields in that record. Saving an .rc file refreshes diagnostics in open Gegevensbeheer documents.
To share a records file across projects, set Gegevensbeheer: Records Path (gegevensbeheer.recordsPath) in VS Code Settings. The setting accepts a file or folder path; absolute paths are recommended. Relative paths are resolved from the first workspace folder. Records from a configured shared file are available without an import statement and can be combined with project-local imports.
Author
Koen Rempt
Concreet bv by Studibo
concreetbv.be
Development
Prerequisites
Node.js 18 or later.
Build
npm install
npm run compile
Use npm run watch to recompile after changes.
Run and debug
Open the project folder in VS Code and press F5 using the Run Extension launch configuration. In the Extension Development Host window, open or create a .ggbh file.
Package
npm run package
This creates a .vsix package. To install it in VS Code, open Extensions, select ..., then choose Install from VSIX....
Project structure
client/ VS Code extension; starts the language server
server/ Language server (completion, hover, diagnostics)
src/server.ts Entry point and capability registration
src/functionDatabase.ts Loads data/functions.json
src/features/ Language-server features
syntaxes/ TextMate grammars
language-configuration.json Gegevensbeheer editor behavior
data/functions.json Function signatures and documentation
Add a function
Add an entry to the functions array in data/functions.json:
{
"name": "GetObject",
"signature": "GetObject(name: STRING): HANDLE",
"description": "Returns the handle of an object with the specified name.",
"category": "Object Management",
"example": "h := GetObject('Wall-01');"
}
name, signature, and description are required; category and example are optional.
- Parameters are read from the signature (
name: STRING gives the parameter name). Add "parameters": ["name"] to override this behavior.
- Function lookups are case-insensitive. Add multiple entries with the same name and different signatures to document overloads; each signature appears in autocomplete, and hover shows them all.
- Separate parameters in signatures with semicolons, for example
MoveTo(x: REAL; y: REAL). Inserted snippets use the same separator.
- Any identifier followed by
( is highlighted as a function, so adding a function does not require a grammar change.
- The function database is loaded when the language server starts. After editing it, run Developer: Reload Window.
Add a language-server feature
Features are implemented in server/src/features/. To add one:
- Create a feature file, such as
server/src/features/signatureHelp.ts.
- Register its capability in
onInitialize in server/src/server.ts.
- Register the corresponding handler, such as
connection.onSignatureHelp(...).
For diagnostics, validate documents in documents.onDidChangeContent and publish results with connection.sendDiagnostics(...).