tools/lsp/README.md

The Objeck LSP server brings code intelligence to the Objeck programming language — diagnostics, completion, hover docs, go-to-definition, rename, formatting, and more. It runs on Windows, Linux, and macOS (AMD64 and ARM64).

Objeck LSP
Language Server Protocol support for Objeck
Code intelligence for 7 editors across Windows, Linux, and macOS


Release Build Latest Release

Quick Start

1. Install Objeck from github.com/objeck/objeck-lang

On Linux, the Objeck runtime dynamically links mbedTLS for crypto/TLS; HTTP/2 and HTTP/3 are linked into it. Install mbedTLS first — the install script checks for it and stops with the same hint if it's missing. macOS and Windows releases need nothing extra:

# Debian / Ubuntu
sudo apt-get install libmbedtls-dev

2. Run the install script from the extracted release directory:

# Windows - user install (no admin required)
scripts\install.cmd C:\Users\you\objeck vscode

# Windows - system-wide install
scripts\install.cmd "C:\Program Files\Objeck" vscode

# Linux / macOS - user install
./scripts/install.sh ~/objeck vscode

# Linux / macOS - system-wide install
./scripts/install.sh /usr/local/objeck vscode

This creates a self-contained deployment at ~/.objeck-lsp/ and configures your editor. Replace vscode with sublime, neovim, emacs, or all. The first argument is wherever you installed Objeck.

3. Or configure manually — pick your editor below, then see the Install Guide for step-by-step instructions. Set environment variables (required for STDIO transport):

export OBJECK_LIB_PATH=<objeck_install_dir>/lib
export OBJECK_STDIO=binary

4. Create a workspace &mdash; add a build.json to your project root for multi-file projects:

{
  "files": ["main.obs", "helper.obs"],
  "libs": ["gen_collect.obl", "net.obl", "json.obl"],
  "flags": ""
}

Open the folder in your editor and the LSP server handles the rest.

5. To debug &mdash; compile with debug symbols first, or no breakpoint will bind:

obc -src myprog.obs --debug -dest myprog.obe

Then add a launch configuration. In VS Code the extension contributes an objeck debug type, so Run > Add Configuration... writes a launch.json entry for you. In Sublime put a debugger_configurations block in a .sublime-project, or a global_debugger_configurations block in Packages/User/Debugger.sublime-settings to debug without a project at all &mdash; see clients/sublime/README.md for both routes and their example files. The .obe is what runs, so recompile after every edit.

Supported Editors

EditorTransportSetup
VS CodeSTDIO (one server per window)Install the .vsix extension, set install path in settings
Sublime TextSTDIOAdd config from clients/sublime/ to LSP settings
KateSTDIOAdd server entry in LSP Client settings (instructions)
ecodeSTDIOAdd server to lspclient.json
Neovim (0.11+)STDIOCopy objeck.lua + objeck.vim to nvim config
Emacs (29+)STDIOCopy objeck-mode.el to your load-path (includes syntax highlighting)
HelixSTDIOMerge clients/helix/languages.toml into your config

Install scripts (scripts/install.cmd and scripts/install.sh) automate setup for VS Code, Sublime, Neovim, and Emacs. Use scripts/update_lsp to refresh the runtime after rebuilding Objeck.

Features

Debugging Features

The debug adapter (obd --dap) is shared by every editor that speaks DAP.

Not supported: stepping backwards, and goto/restartFrame &mdash; the last two would need the VM's interpreter loop to expose its program counter, which it currently passes to the debugger by value.

Architecture

graph LR
    subgraph Editors
        VSCode[VS Code]
        Sublime[Sublime Text]
        Kate[Kate]
        ecode[ecode]
        Neovim[Neovim]
        Emacs[Emacs]
        Helix[Helix]
    end

    subgraph Transport
        STDIO[STDIO]
        Pipe[Named Pipe]
        Socket[TCP Socket]
    end

    subgraph Runtime["Objeck Runtime"]
        Workspace[In-Memory Workspace]
        Compiler[Analysis Compiler]
        Detection[Issue Detection]
        Navigation[Code Navigation & Refactoring]
        Docs[API Documentation]

        Workspace --> Compiler
        Compiler --> Detection
        Compiler --> Navigation
        Compiler --> Docs
    end

    VSCode --> STDIO
    Sublime --> STDIO
    Kate --> STDIO
    ecode --> STDIO
    Neovim --> STDIO
    Emacs --> STDIO
    Helix --> STDIO

    STDIO --> Workspace
    Pipe --> Workspace
    Socket --> Workspace
LSP Protocol Coverage

Notifications

EventMethod
Initializedinitialized
Cancel Request$/cancelRequest
File OpentextDocument/didOpen
File ChangedtextDocument/didChange
File SavetextDocument/didSave
File ClosetextDocument/didClose
Exitexit

Requests

FeatureMethod
Initializeinitialize
Shutdownshutdown
CompletiontextDocument/completion, completionItem/resolve
HovertextDocument/hover (MarkupContent)
Signature HelptextDocument/signatureHelp
DefinitiontextDocument/definition
DeclarationtextDocument/declaration
Type DefinitiontextDocument/typeDefinition
ImplementationtextDocument/implementation
ReferencestextDocument/references
Document HighlighttextDocument/documentHighlight
Document SymboltextDocument/documentSymbol (a tree for clients that take one)
RenametextDocument/prepareRename, textDocument/rename
Code ActiontextDocument/codeAction (quick fixes, source.organizeImports)
Diagnostics (pull)textDocument/diagnostic, for clients that pull
Code LenstextDocument/codeLens (Run on Main)
Document LinktextDocument/documentLink (use bundles to the API reference)
Format DocumenttextDocument/formatting
Format SelectiontextDocument/rangeFormatting
Folding RangetextDocument/foldingRange
Selection RangetextDocument/selectionRange
Inlay HinttextDocument/inlayHint
Semantic TokenstextDocument/semanticTokens/full, /full/delta, /range
Call HierarchytextDocument/prepareCallHierarchy, callHierarchy/incomingCalls, callHierarchy/outgoingCalls
Type HierarchytextDocument/prepareTypeHierarchy, typeHierarchy/supertypes, typeHierarchy/subtypes

Server to client

FeatureMethod
DiagnosticstextDocument/publishDiagnostics (push clients), workspace/diagnostic/refresh (pull clients)
Logwindow/logMessage
Progresswindow/workDoneProgress/create, $/progress
Watch build.jsonclient/registerCapability

Workspace

FeatureMethod
Watch File Changesworkspace/didChangeWatchedFiles
Workspace Folder Changesworkspace/didChangeWorkspaceFolders
Find Symbolworkspace/symbol

Development

Building the VS Code extension:

npm install -g yo generator-code typescript @vscode/vsce
cd clients/vscode && npm run compile

Building the LSP server (requires Objeck):

cd server
obc -src frameworks.obs,proxy.obs,server.obs,format_code/scanner.obs,format_code/formatter.obs \
    -lib diags,net,json,regex,cipher -dest objeck_lsp.obe

Testing the server: python tests/run_lsp_tests.py <objeck>/bin [server_dir]. The server keeps each parsed and analyzed program until a document changes; set OBJECK_LSP_NO_CACHE=1 to parse afresh for every request instead, and compare the two when a result looks wrong.

Resources