A high-performance implementation of the Language Server Protocol for the ADW Modula-2 dialect, featuring full support for Object-Oriented extensions including CLASS, INHERIT, and OVERRIDE.
Core Functionality
1. Semantic Analysis
- Contextual Highlighting: Distinguished rendering for Types, Constants, Variables, and Procedures.
- Comment Handling: Robust parsing of nested comments
(* (* ... *) *)and complex strings to prevent highlighting bleed.
2. Navigation Logic
- Go to Definition: Resolution of local symbols and cross-file navigation to
.defheaders. - Go to Implementation: Direct mapping from procedure signatures in
.deffiles to the corresponding bodies in.modfiles. - Symbol Lookup: Comprehensive workspace-wide symbol indexing and search.
3. ADW OOP Support
- Inheritance Mapping: Resolution of
INHERITchains to provide accurate member completion for base classes. - Override Identification: Explicit marking of
OVERRIDEmethods within the Document Outline.
4. Technical Architecture
- Indentation-Aware Scoping: Deterministic scope resolution for nested procedures and modules based on block indentation.
- Asynchronous Indexing: Background processing of all workspace
.defand.modfiles for non-blocking cross-reference resolution.
Installation
VSIX Package
- Obtain the
adw-modula2-lsp.vsixfile. - In VS Code, navigate to the Extensions view (
Ctrl+Shift+X). - Select Install from VSIX... from the local menu and select the file.
Source Build
- Clone the repository.
- Execute
npm installin the root,/client, and/serverdirectories. - Execute
npm run compile. - Launch the Extension Development Host via
F5.
Project Structure
client/: VS Code extension client-side activation and lifecycle management.server/: LSP Server implementation containing the Modula-2 parser and symbol engine.logo.png: Extension identifier icon.
License
This project is licensed under the MIT License. See the LICENSE file for full text.