nadya-lsp
Language support for the "Nadya programming language" in Visual Studio Code.
Features
Syntax Highlighting
Full syntax highlighting for Nadya source files (.ndy), including:
- Keywords, operators, and literals
- Comments (line
// and block /* */)
- Strings and numeric values
- Type annotations and generics
- Runtime blocks (
!{ }) and interpolation (${ })
Language Server Protocol (LSP)
The extension integrates with nadya-lsp for advanced language features:
Type Inference
Hindley-Milner based type inference with let-polymorphism:
- Explicit Type Annotations:
fun add(x: i32, y: i32) -> i32 (return type required)
- Polymorphic Types:
fun id(x: T) -> T { x } with type parameters
- Tuple Destructuring:
let (a, b) = pair
- Type Error Diagnostics: Real-time type mismatch errors with expected/actual types
Go to Definition (F12)
- Jump to function, type, and variable definitions
- Cross-file navigation via
module imports
- Qualified identifiers:
utils::helper
Mouse over any symbol to see:
- Inferred type (e.g.,
(A, B) -> A)
- Symbol kind (Function, Type, Variable, Parameter)
- Doc comments from source
- Source location
Find All References (Shift+F12)
- Find all usages of a symbol in the current file
- Option to include/exclude the definition
Document Outline (Ctrl+Shift+O)
- Hierarchical view of functions, types, and variables
- Nested symbols (struct fields, union variants)
- Click to navigate
Diagnostics
- Parse Errors: Real-time syntax error detection
- Type Errors: Type mismatch, unification failures
- Import Errors: Missing modules, circular references
Preprocessing
- Auto-brace Insertion: Indentation-based blocks automatically get
{ } inserted
- Comment Handling: Trailing comments handled transparently
Editor Support
- Bracket matching for
{}, [], (), </ />, !{}, ${}
- Auto-closing pairs for brackets, parentheses, and quotes
- Code folding
- Smart indentation
Requirements
- VS Code 1.75.0 or later
- (Optional)
nadya-lsp executable for full LSP features
The extension includes bundled LSP binaries for:
Extension Settings
| Setting |
Type |
Default |
Description |
nadya.lsp.enabled |
boolean |
true |
Enable/disable the Nadya language server |
nadya.lsp.path |
string |
"" |
Path to nadya-lsp executable. Leave empty to use bundled or PATH |
nadya.lsp.logFile |
string |
"" |
Path to log file for LSP server. Leave empty to disable file logging |
nadya.trace.server |
string |
"off" |
Traces communication between VS Code and the language server (off, messages, verbose) |
Commands
| Command |
Description |
Nadya: Show Preprocessed Info |
Display information about Nadya's preprocessing features |
Nadya: Show Preprocessed Source |
Show the preprocessed version of the current file |
Installation
From Marketplace
Search for "nadya-lsp" in the VS Code Extensions view or install via:
ext install enerzai.vscode-nadya
Manual Installation
- Download the
.vsix file from the releases page
- In VS Code, run
Extensions: Install from VSIX... from the Command Palette
- Select the downloaded
.vsix file
Troubleshooting
LSP not starting
- Check if
nadya.lsp.enabled is true
- Verify the LSP binary exists:
- Bundled:
<extension>/server/<platform>/nadya-lsp
- Or set
nadya.lsp.path to your custom path
- Enable logging with
nadya.lsp.logFile to diagnose issues
Enable verbose logging
{
"nadya.trace.server": "verbose",
"nadya.lsp.logFile": "/tmp/nadya-lsp.log"
}
License
GPL-3.0
Links
| |