A high-performance Language Server Protocol implementation for the VScript programming language, built in Rust.
- π Fast and Reliable: Built in Rust for maximum performance
- π― Go-to Definition: Navigate to symbol definitions across files
- π‘ Intelligent Completion: Context-aware code completion
- π Hover Information: Rich type and documentation information
- π¨ Real-time Diagnostics: Syntax and semantic error detection
- π¨ Semantic Highlighting: Advanced syntax highlighting
- π Workspace Management: Full project and module support
- π Module Resolution: Smart import resolution with v.mod support
# Clone the repository
git clone https://github.com/vscript/vscript-lsp.git
cd vscript-lsp
# Build the LSP server
cargo build --release
# The binary will be available at target/release/vscript-lspcargo install vscript-lspStart the LSP server:
vscript-lspThe server communicates via stdin/stdout using the Language Server Protocol.
The LSP server is designed to work with any editor that supports LSP. See the Zed extension for a complete integration example.
For editors that support LSP, configure them to run vscript-lsp for .vs files.
Example configuration for various editors:
VS Code (settings.json):
{
"vscript.lsp.serverPath": "vscript-lsp"
}Vim/Neovim with coc.nvim:
{
"languageserver": {
"vscript": {
"command": "vscript-lsp",
"filetypes": ["vscript"]
}
}
}The LSP server supports configuration through workspace settings:
{
"vscript": {
"diagnostics": {
"enable": true,
"unusedVariables": "warning"
},
"completion": {
"enable": true,
"autoImport": true
},
"hover": {
"enable": true,
"showDocumentation": true
}
}
}- β Functions and methods
- β Classes and inheritance
- β Variables and parameters
- β Control flow (if/else, loops)
- β Arrays and objects
- β String interpolation
- β Async/await
- β Decorators (@[decorator])
- β Imports and exports
- β Try/catch blocks
The LSP understands VScript's module system:
// Import core modules
import core:os as os
import core:json as json
// Import local files
import "./utils.vs" as utils
// Module resolution follows v.mod files
The LSP provides hover information and completion for built-in functions:
print(),println()- Output functionslen(),push(),pop()- Collection functionsto_string(),to_number()- Conversion functions- Array methods:
map(),filter(),reduce(),forEach() - String methods:
split(),replace(),trim() - And many more...
The VScript LSP is structured as follows:
src/
βββ main.rs # LSP server entry point
βββ analyzer.rs # Semantic analysis engine
βββ completion.rs # Code completion provider
βββ diagnostics.rs # Error and warning detection
βββ goto_definition.rs # Go-to-definition implementation
βββ hover.rs # Hover information provider
βββ lexer.rs # VScript tokenizer
βββ parser.rs # VScript parser and AST
βββ workspace.rs # Workspace and project management
- Lexer: Fast tokenization of VScript source code
- Parser: Builds Abstract Syntax Trees (AST) from tokens
- Analyzer: Performs semantic analysis and symbol resolution
- Workspace Manager: Handles project files and v.mod resolution
cargo buildcargo testEnable debug logging:
RUST_LOG=debug vscript-lsp- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Add tests for your changes
- Run tests (
cargo test) - Commit your changes (
git commit -am 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This LSP server implements the following LSP features:
textDocument/completion- Code completiontextDocument/hover- Hover informationtextDocument/definition- Go to definitiontextDocument/references- Find referencestextDocument/documentSymbol- Document outlineworkspace/symbol- Workspace symbol searchtextDocument/publishDiagnostics- Error reportingtextDocument/semanticTokens- Semantic highlighting
The VScript LSP is designed for performance:
- Fast Parsing: Incremental parsing with error recovery
- Efficient Memory Usage: Smart caching and cleanup
- Concurrent Analysis: Multi-threaded semantic analysis
- Lazy Loading: On-demand file processing
This project is licensed under the MIT License - see the LICENSE file for details.
- VScript Compiler - The main VScript compiler
- Zed VScript Extension - Zed editor integration
- Tree-sitter VScript - Syntax highlighting grammar
- π Documentation
- π Issue Tracker
- π¬ Discussions