| Crates.io | enforce-script-lsp |
| lib.rs | enforce-script-lsp |
| version | 0.1.3 |
| created_at | 2025-10-19 09:33:20.381019+00 |
| updated_at | 2025-10-19 10:58:51.91895+00 |
| description | Language Server Protocol implementation for Enforce Script |
| homepage | https://devz-tools.github.io/ |
| repository | https://github.com/devz-tools/enforce-script-lsp |
| max_upload_size | |
| id | 1890264 |
| size | 325,181 |
A comprehensive Language Server Protocol (LSP) implementation for Enforce Script, the scripting language used by the Enfusion game engine and for modding video games such as DayZ.
# Build the project
cargo build --release
# Run tests
cargo test
# Start the LSP server
cargo run --release
Lexer/Tokenizer - Complete tokenization of Enforce Script source code
Parser - Full AST generation for Enforce Script
Semantic Analyzer - Symbol table and basic semantic analysis
Diagnostics - Real-time error and warning detection with accurate positions
Completion - IntelliSense support
Hover Information - Rich symbol information on hover
Go to Definition - Navigate to symbol definitions
Find References - Find all symbol occurrences
Signature Help - Function/method parameter hints
Document Symbols - Outline view
Folding Ranges - Code folding support
# Clone the repository
git clone <repository-url>
cd enforce-script-lsp
# Build the project
cargo build --release
# Run tests
cargo test
# Run the LSP server
cargo run --release
The compiled binary will be available at target/release/enforce-script-lsp (or .exe on Windows).
The LSP server communicates over stdin/stdout following the Language Server Protocol specification.
To use with VS Code, you'll need to create or update a VS Code extension that uses this LSP server. Example configuration:
{
"command": "path/to/enforce-script-lsp",
"args": []
}
lexer.rs - Tokenizes Enforce Script source code into tokensparser.rs - Parses tokens into an Abstract Syntax Tree (AST)semantic.rs - Performs semantic analysis and builds symbol tableslsp.rs - LSP server implementation using tower-lspmain.rs - Entry point that starts the LSP serverToken - Represents a lexical token with type, lexeme, and positionExpression - Represents Enforce Script expressions in the ASTStatement - Represents Enforce Script statements in the ASTDeclaration - Represents top-level declarations (classes, enums, functions, typedefs)Symbol - Represents a symbol in the symbol table with scope and type informationSymbolTable - Maintains symbols across scopes for semantic analysisThe project includes comprehensive unit tests for all major components:
# Run all tests
cargo test
# Run tests with output
cargo test -- --nocapture
# Run specific test module
cargo test lexer::tests
cargo test parser::tests
cargo test semantic::tests
The implementation follows the official Enforce Script syntax as documented in ENFORCE-SCRIPT-SYNTAX.md, which covers:
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
# Run tests
cargo test
# Format code
cargo fmt
# Run linter
cargo clippy
# Build documentation
cargo doc --open
See LICENSE file for details.