Skip to content

feat(lsp): implement self-hosted LSP module (Phase 5)#132

Merged
graydeon merged 1 commit intomainfrom
feat/lsp-phase5-124
Apr 9, 2026
Merged

feat(lsp): implement self-hosted LSP module (Phase 5)#132
graydeon merged 1 commit intomainfrom
feat/lsp-phase5-124

Conversation

@graydeon
Copy link
Copy Markdown
Contributor

@graydeon graydeon commented Apr 9, 2026

Summary

Implements Phase 5 of the self-hosting roadmap: LSP server in Gradient.

New File: compiler/lsp.gr

Core Types

  • LspServer: server instance with document store
  • TextDocumentItem, VersionedTextDocumentIdentifier: document management
  • LspPosition, LspRange: positions and ranges
  • LspDiagnostic: diagnostic messages
  • Hover: hover information
  • CompletionItem, CompletionItemKind: completion support
  • ServerCapabilities, ServerInfo: server metadata
  • DocumentSymbol, LspSymbolKind: document symbols

Enums

  • LspDiagnosticSeverity: Error/Warning/Info/Hint
  • CompletionItemKind: Text/Method/Function/etc.
  • LspSymbolKind: File/Module/Function/Variable/etc.

Core Functions

  • new_lsp_server, initialize
  • did_open, did_change, did_close, did_save
  • hover, completion, document_symbol, goto_definition
  • run_diagnostics, publish_diagnostics
  • Document store: new_document_store, store_document, get_document
  • word_at_position, get_builtin_functions, get_keywords

Naming Changes

  • LspSymbolKind (instead of SymbolKind) to avoid conflict with query.gr

Self-Hosting Tests (All 12 Passing)

  • 2 new tests added for LSP module

Related Issues

Implements Phase 5 of the self-hosting roadmap: LSP server in Gradient.

**New File: compiler/lsp.gr**

Core Types:
- LspServer: LSP server instance with document store
- TextDocumentItem, VersionedTextDocumentIdentifier: document management
- LspPosition, LspRange: positions and ranges in documents
- LspDiagnostic: diagnostic messages with severity
- Hover: hover information content
- CompletionItem, CompletionItemKind: completion support
- ServerCapabilities, ServerInfo: server metadata
- InitializeParams, InitializeResult: initialization protocol
- DocumentSymbol, LspSymbolKind: document symbols

Enums:
- LspDiagnosticSeverity: Error/Warning/Info/Hint
- CompletionItemKind: Text/Method/Function/Constructor/etc.
- LspSymbolKind: renamed to avoid conflict with query.gr's SymbolKind

Core Functions:
- new_lsp_server: create LSP server instance
- initialize: LSP initialization handshake
- did_open/did_change/did_close/did_save: document lifecycle
- hover: hover information at position
- completion: completion items at position
- document_symbol: extract document symbols
- goto_definition: go-to-definition navigation
- run_diagnostics: compile and collect diagnostics
- new_document_store, store_document, get_document: document management
- word_at_position: extract identifier at position
- get_builtin_functions, get_keywords: built-in knowledge
- is_builtin, is_keyword: identifier classification

**Self-Hosting Tests (All 12 Passing):**
- all_modules_plus_lsp_concatenated_parses_and_typechecks_clean ✅
- lsp_gr_concatenated_exposes_expected_symbols ✅

Part of #116 (Self-Hosting Epic)
Closes #124 (Phase 5: LSP)
@graydeon graydeon merged commit 5b108b9 into main Apr 9, 2026
4 checks passed
@graydeon graydeon deleted the feat/lsp-phase5-124 branch April 9, 2026 16:21
graydeon added a commit that referenced this pull request Apr 11, 2026
Implements Phase 5 of the self-hosting roadmap: LSP server in Gradient.

**New File: compiler/lsp.gr**

Core Types:
- LspServer: LSP server instance with document store
- TextDocumentItem, VersionedTextDocumentIdentifier: document management
- LspPosition, LspRange: positions and ranges in documents
- LspDiagnostic: diagnostic messages with severity
- Hover: hover information content
- CompletionItem, CompletionItemKind: completion support
- ServerCapabilities, ServerInfo: server metadata
- InitializeParams, InitializeResult: initialization protocol
- DocumentSymbol, LspSymbolKind: document symbols

Enums:
- LspDiagnosticSeverity: Error/Warning/Info/Hint
- CompletionItemKind: Text/Method/Function/Constructor/etc.
- LspSymbolKind: renamed to avoid conflict with query.gr's SymbolKind

Core Functions:
- new_lsp_server: create LSP server instance
- initialize: LSP initialization handshake
- did_open/did_change/did_close/did_save: document lifecycle
- hover: hover information at position
- completion: completion items at position
- document_symbol: extract document symbols
- goto_definition: go-to-definition navigation
- run_diagnostics: compile and collect diagnostics
- new_document_store, store_document, get_document: document management
- word_at_position: extract identifier at position
- get_builtin_functions, get_keywords: built-in knowledge
- is_builtin, is_keyword: identifier classification

**Self-Hosting Tests (All 12 Passing):**
- all_modules_plus_lsp_concatenated_parses_and_typechecks_clean ✅
- lsp_gr_concatenated_exposes_expected_symbols ✅

Part of #116 (Self-Hosting Epic)
Closes #124 (Phase 5: LSP)
graydeon added a commit that referenced this pull request Apr 11, 2026
Implements Phase 5 of the self-hosting roadmap: LSP server in Gradient.

**New File: compiler/lsp.gr**

Core Types:
- LspServer: LSP server instance with document store
- TextDocumentItem, VersionedTextDocumentIdentifier: document management
- LspPosition, LspRange: positions and ranges in documents
- LspDiagnostic: diagnostic messages with severity
- Hover: hover information content
- CompletionItem, CompletionItemKind: completion support
- ServerCapabilities, ServerInfo: server metadata
- InitializeParams, InitializeResult: initialization protocol
- DocumentSymbol, LspSymbolKind: document symbols

Enums:
- LspDiagnosticSeverity: Error/Warning/Info/Hint
- CompletionItemKind: Text/Method/Function/Constructor/etc.
- LspSymbolKind: renamed to avoid conflict with query.gr's SymbolKind

Core Functions:
- new_lsp_server: create LSP server instance
- initialize: LSP initialization handshake
- did_open/did_change/did_close/did_save: document lifecycle
- hover: hover information at position
- completion: completion items at position
- document_symbol: extract document symbols
- goto_definition: go-to-definition navigation
- run_diagnostics: compile and collect diagnostics
- new_document_store, store_document, get_document: document management
- word_at_position: extract identifier at position
- get_builtin_functions, get_keywords: built-in knowledge
- is_builtin, is_keyword: identifier classification

**Self-Hosting Tests (All 12 Passing):**
- all_modules_plus_lsp_concatenated_parses_and_typechecks_clean ✅
- lsp_gr_concatenated_exposes_expected_symbols ✅

Part of #116 (Self-Hosting Epic)
Closes #124 (Phase 5: LSP)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Self-Hosting] Phase 7: Implement Codegen in Gradient

1 participant