Summary
Implement the LSP server in Gradient. Full Language Server Protocol support for IDE integration.
Background
With the queryable API in Gradient (Phase 4), we can now implement the LSP server itself in Gradient. Currently the LSP is in Rust (codebase/devtools/lsp/).
Target State
NEW FILE: compiler/lsp.gr (~3,000 lines)
LSP server that:
- Listens for JSON-RPC messages
- Responds to LSP requests
- Uses
query.gr for all data
Implementation Requirements
LSP Capabilities
-
textDocument/diagnostic
- Real-time error reporting
- Use
session_check()
-
textDocument/hover
- Type information on hover
- Use
session_type_at()
-
textDocument/definition
- Go to definition
- Use symbol table
-
textDocument/references
- Find all references
- Use query API
-
textDocument/rename
- Safe renaming
- Use
session_rename()
-
textDocument/completion
- Autocomplete suggestions
- Use
session_symbols()
-
textDocument/documentSymbol
- Outline/symbol tree
- Use symbol table
JSON-RPC Handling
- Parse incoming messages
- Route to handlers
- Serialize responses
State Management
- Track open documents
- Cache parsed sessions
- Incremental sync (if supported)
Acceptance Criteria
Testing
Test with:
- VS Code extension
- Neovim LSP client
- Emacs LSP mode
Part Of
- Epic: Full Self-Hosting with Rust Kernel
- Phase: 5 of 7
- Blocks: Phase 6 (IR Builder)
Effort
~7 days, ~2,500 lines of Gradient
Dependencies
Summary
Implement the LSP server in Gradient. Full Language Server Protocol support for IDE integration.
Background
With the queryable API in Gradient (Phase 4), we can now implement the LSP server itself in Gradient. Currently the LSP is in Rust (
codebase/devtools/lsp/).Target State
NEW FILE:
compiler/lsp.gr(~3,000 lines)LSP server that:
query.grfor all dataImplementation Requirements
LSP Capabilities
textDocument/diagnostic
session_check()textDocument/hover
session_type_at()textDocument/definition
textDocument/references
textDocument/rename
session_rename()textDocument/completion
session_symbols()textDocument/documentSymbol
JSON-RPC Handling
State Management
Acceptance Criteria
Testing
Test with:
Part Of
Effort
~7 days, ~2,500 lines of Gradient
Dependencies