Skip to content

torbjornbp/adapl-lsp

Repository files navigation

adapl-lsp

Language Server Protocol implementation for the ADAPL programming language. Provides diagnostics, hover, go-to-definition, find references, completion, folding, inlay hints, code lens, and semantic tokens for .ada files.

Features

Feature Details
Diagnostics Real-time error checking on open and change, with semantic checks (undeclared vars, missing RETURN, broken FACS state, reserved words as variable names)
Go-to-definition Resolve variable and subroutine references
Find references All usages of a variable or subroutine
Hover Reserved variables (&0, &1, &E, etc.), built-in functions, instructions, variables
Completion Keywords, built-in functions, declared variables (triggers on . $ & ! SPACE)
Signature help Function signatures with parameter docs (triggers on ()
Document symbols Variable declarations, FACS aliases, subroutine outlines
Folding ranges Braces, FDSTART/FDEND, subroutine boundaries
Inlay hints Magic number meanings for REPSORT, REPFIND, ERRORM, CVT$$, TRIM$, and execution codes
Code lens &1 execution codes, FACS database paths, subroutine call counts
Semantic tokens Syntax highlighting: variables, DB tags, FACS aliases, subroutine labels
Code actions Quick fixes: declare undeclared variable, add missing return

Installation

Prerequisites

  • Python 3.9+
pip install -e .
# or
pip install pygls>=2.0 lark>=1.1,<2.0

VS Code

Install the extension from the .vsix:

cd vscode-extension
code --install-extension adapl-lsp-0.1.0.vsix

Or install manually: Extensions → ... → Install from VSIX.

The extension activates automatically for .ada files. It will create a Python virtual environment and install dependencies on first use.

Configuration

Setting Default Description
adapl.lsp.pythonPath python3 Python executable (Python 3.9+)
adapl.lsp.serverPath (bundled) Custom path to adapl_lsp server source

Sublime Text

  1. Install the LSP package via Package Control
  2. Install syntax highlighting from torbjornbp/adapl-syntax-highlight — copy adapl.sublime-syntax to Packages/User/
  3. Add the server configuration to Preferences → Package Settings → LSP → Server Configurations:
{
    "adapl": {
        "enabled": true,
        "command": ["python3", "-m", "adapl_lsp.server"],
        "selector": "source.adapl",
        "env": {"PYTHONPATH": "/path/to/adapl-lsp/src"}
    }
}

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
python3 -m pytest tests/ -v

# Start server manually for debugging
PYTHONPATH=src python3 -m adapl_lsp.server

Server log: ~/.local/share/adapl-lsp/server.log

Project structure

src/adapl_lsp/
├── ast.py          — AST node dataclasses
├── grammar.py      — Lark grammar generator (keywords, reference grammar)
├── parser.py       — Parser entry point
├── rd_parser.py    — Recursive-descent parser (hand-written)
├── server.py       — pygls LSP server (all feature handlers)
├── symbols.py      — Symbol table builder (definitions/references)
├── tokenizer.py    — Hand-written lexer
vscode-extension/
├── src/extension.js   — VS Code extension entry point
├── server/adapl_lsp/  — Bundled server copy
├── syntaxes/          — TextMate grammar for syntax highlighting
tests/
├── test_parser.py     — Parser test suite
└── fixtures/sample.ada

ADAPL language overview

  • Identifiers are case-sensitive, must start with a letter, underscore, or $
  • Instructions and functions are case-insensitive
  • Comments: * at column 0 (line), /* ... */ (inline)
  • Strings: single-quoted ('a string')
  • Line continuation: ~ at end of line
  • Statement separator: ; (optional, ignored)
  • Program structure: main block ends with END, subroutines start with a numeric label and end with RETURN
  • ADAPL documentation: Axiell ADAPL docs

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages