You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Self-Hosting Phase 5] Port Language Server Protocol (LSP) Server to Flow #693
Native LSP transport progress: valid string JSON-RPC IDs are now dispatched and echoed in response/error envelopes instead of being silently ignored. Added integration coverage for initialize with id="init"; both LSP lifecycle tests pass. bootstrap_from_c --verify and self_host_full (three generations) pass. Full document indexing/semantic analysis and broader JSON-RPC parity remain open.
Native LSP capability parity update: initialize now advertises the documentSymbol, references, formatting, and documentHighlight providers that the transport already handles. Integration assertions cover all four capabilities; both LSP tests pass. bootstrap_from_c --verify and self_host_full (three generations) pass. Semantic document indexing remains the next major gap.
Native LSP parsing progress: added flowc_lsp_json_nested_field for bounded access to nested payloads such as params.textDocument.text, preserving zero-copy spans and JSON kind/error semantics. Native protocol fixture and both LSP integration tests pass; bootstrap_from_c --verify and self_host_full (three generations) pass. This is the prerequisite for storing didOpen/didChange documents and returning real symbols.
Native semantic tooling progress: added compiler/src/lsp_symbols.flow, an allocation-free scanner that enumerates top-level and exported function declarations with name spans, line numbers, and malformed-input errors. Added tests/lang/test_lsp_symbols_native.flow; Python host and regenerated Stage-A execution pass. bootstrap_from_c --verify and self_host_full (three generations) pass. Wiring this scanner to didOpen document state and documentSymbol JSON responses remains.
Native document-symbol slice is now wired end to end: didOpen retains bounded document text with JSON escape decoding, and documentSymbol scans the stored source to return real LSP symbols with line/character ranges and selection ranges. Integration now verifies exported alpha and regular beta symbols; both LSP tests pass. bootstrap_from_c --verify and self_host_full (three generations) pass. didChange updates, URI-keyed multi-document state, and deeper semantic indexing remain.
Native LSP document-state progress: didChange now reads contentChanges[0].text, decodes JSON escapes, and replaces the bounded stored document. documentSymbol immediately reflects the updated source; integration verifies alpha/beta are replaced by gamma. Both LSP tests pass, along with bootstrap_from_c --verify and self_host_full (three generations). URI-keyed multi-document state and incremental range edits remain.
Native LSP lifecycle progress: didClose now clears the bounded stored document, preventing stale documentSymbol results after a client closes a document. Integration sends didOpen, didChange, didClose, then documentSymbol and verifies the final result is empty. Both LSP tests pass; bootstrap_from_c --verify and self_host_full (three generations) pass. URI-keyed multi-document state remains.
Native LSP URI groundwork: added flowc_lsp_document_uri to extract params.textDocument.uri as a bounded zero-copy JSON span for didOpen/didChange/didClose and request payloads. Native protocol test passes under Stage-A; bootstrap_from_c --verify and self_host_full (three generations) pass. The next step is replacing the single document buffer with URI-keyed slots.
URI-state groundwork: added flowc_lsp_uri_equals, a bounded zero-copy comparison between a document URI JSON span and a stored URI buffer. Native protocol, bootstrap fixed-point, bootstrap_from_c verification, and self_host_full (three generations) pass. This is the key lookup primitive for the pending multi-document slot store.
Native LSP state progress: added compiler/src/lsp_store.flow with bounded two-slot URI-keyed document storage. Open/change/close operations preserve independent document text and reclaim only the matching slot; native regression covers two documents and mutation isolation. Stage-A native execution, LSP integration, bootstrap_from_c --verify, and self_host_full (three generations) pass. Wiring the store into lsp_server dispatch is next.
Status check from the host-tools retirement pass (checked against origin/main at 660ff30).
There is no native LSP on main. compiler/src/lsp_server.flow and compiler/src/lsp_store.flow, described in the comments above, are not on origin/main or on any remote branch. What exists in Flow is the helper set: lsp_intel.flow, lsp_syntax.flow, lsp_dynamics.flow, lsp_ordering.flow, lsp_utils.flow. Every editor path still runs python3 -m flow.lsp_server (flow-lsp, the VS Code extension, and now ./flow lsp, which used to fall through to the help text).
The blocker for replacing the Python server is diagnostics and symbol extraction, which come from the Python parser and type checker. Running the Stage-A driver over the corpus with FLOWC_TYPECHECK=0:
Tree
Files
flowc parse failures
examples/verify
1,054
1,054 (theorem syntax)
rest of examples/
433
109
tests/lang
126
10
lib/stdlib
112
1 (ui_layout.flow)
total
1,725
1,174
So a server that took diagnostics from flowc would report a syntax error on 68% of the repo's .flow files, most of them proof files. Type findings also differ: flowc requires extern for sqrt, printf and the other C functions the Python checker treats as built-ins, so the LSP harness's "clean" file (scripts/test_lsp_server.py) gets an unbound-call warning. Parse failures carry only a byte offset (flowc emit: at 62), with no message.
Everything else the server does (hover, completion, definition, references, rename, symbols, highlight) is lexical or structural and could move to Flow now. Diagnostics and formatting need the full-language front end first.
Delivered on main (ee5048d) by #1016: tools/lsp is the JSON-RPC language server in Flow (diagnostics, hover, completion, definition, references, rename, symbols, formatting, highlight), and flow-lsp, ./flow lsp and the VS Code extension use it. The Python server is deleted.
Activity
godofecht commentedon Sep 17, 2026
Native LSP transport progress: valid string JSON-RPC IDs are now dispatched and echoed in response/error envelopes instead of being silently ignored. Added integration coverage for initialize with id="init"; both LSP lifecycle tests pass. bootstrap_from_c --verify and self_host_full (three generations) pass. Full document indexing/semantic analysis and broader JSON-RPC parity remain open.
godofecht commentedon Sep 17, 2026
Native LSP capability parity update: initialize now advertises the documentSymbol, references, formatting, and documentHighlight providers that the transport already handles. Integration assertions cover all four capabilities; both LSP tests pass. bootstrap_from_c --verify and self_host_full (three generations) pass. Semantic document indexing remains the next major gap.
godofecht commentedon Sep 17, 2026
Native LSP parsing progress: added flowc_lsp_json_nested_field for bounded access to nested payloads such as params.textDocument.text, preserving zero-copy spans and JSON kind/error semantics. Native protocol fixture and both LSP integration tests pass; bootstrap_from_c --verify and self_host_full (three generations) pass. This is the prerequisite for storing didOpen/didChange documents and returning real symbols.
godofecht commentedon Sep 17, 2026
Native semantic tooling progress: added compiler/src/lsp_symbols.flow, an allocation-free scanner that enumerates top-level and exported function declarations with name spans, line numbers, and malformed-input errors. Added tests/lang/test_lsp_symbols_native.flow; Python host and regenerated Stage-A execution pass. bootstrap_from_c --verify and self_host_full (three generations) pass. Wiring this scanner to didOpen document state and documentSymbol JSON responses remains.
godofecht commentedon Sep 17, 2026
Native document-symbol slice is now wired end to end: didOpen retains bounded document text with JSON escape decoding, and documentSymbol scans the stored source to return real LSP symbols with line/character ranges and selection ranges. Integration now verifies exported alpha and regular beta symbols; both LSP tests pass. bootstrap_from_c --verify and self_host_full (three generations) pass. didChange updates, URI-keyed multi-document state, and deeper semantic indexing remain.
godofecht commentedon Sep 17, 2026
Native LSP document-state progress: didChange now reads contentChanges[0].text, decodes JSON escapes, and replaces the bounded stored document. documentSymbol immediately reflects the updated source; integration verifies alpha/beta are replaced by gamma. Both LSP tests pass, along with bootstrap_from_c --verify and self_host_full (three generations). URI-keyed multi-document state and incremental range edits remain.
godofecht commentedon Sep 17, 2026
Native LSP lifecycle progress: didClose now clears the bounded stored document, preventing stale documentSymbol results after a client closes a document. Integration sends didOpen, didChange, didClose, then documentSymbol and verifies the final result is empty. Both LSP tests pass; bootstrap_from_c --verify and self_host_full (three generations) pass. URI-keyed multi-document state remains.
godofecht commentedon Sep 17, 2026
Native LSP URI groundwork: added flowc_lsp_document_uri to extract params.textDocument.uri as a bounded zero-copy JSON span for didOpen/didChange/didClose and request payloads. Native protocol test passes under Stage-A; bootstrap_from_c --verify and self_host_full (three generations) pass. The next step is replacing the single document buffer with URI-keyed slots.
godofecht commentedon Sep 17, 2026
URI-state groundwork: added flowc_lsp_uri_equals, a bounded zero-copy comparison between a document URI JSON span and a stored URI buffer. Native protocol, bootstrap fixed-point, bootstrap_from_c verification, and self_host_full (three generations) pass. This is the key lookup primitive for the pending multi-document slot store.
godofecht commentedon Sep 17, 2026
Native LSP state progress: added compiler/src/lsp_store.flow with bounded two-slot URI-keyed document storage. Open/change/close operations preserve independent document text and reclaim only the matching slot; native regression covers two documents and mutation isolation. Stage-A native execution, LSP integration, bootstrap_from_c --verify, and self_host_full (three generations) pass. Wiring the store into lsp_server dispatch is next.
godofecht commentedon Sep 27, 2026
Status check from the host-tools retirement pass (checked against origin/main at 660ff30).
There is no native LSP on main.
compiler/src/lsp_server.flowandcompiler/src/lsp_store.flow, described in the comments above, are not on origin/main or on any remote branch. What exists in Flow is the helper set:lsp_intel.flow,lsp_syntax.flow,lsp_dynamics.flow,lsp_ordering.flow,lsp_utils.flow. Every editor path still runspython3 -m flow.lsp_server(flow-lsp, the VS Code extension, and now./flow lsp, which used to fall through to the help text).The blocker for replacing the Python server is diagnostics and symbol extraction, which come from the Python parser and type checker. Running the Stage-A driver over the corpus with
FLOWC_TYPECHECK=0:So a server that took diagnostics from flowc would report a syntax error on 68% of the repo's
.flowfiles, most of them proof files. Type findings also differ: flowc requiresexternforsqrt,printfand the other C functions the Python checker treats as built-ins, so the LSP harness's "clean" file (scripts/test_lsp_server.py) gets an unbound-call warning. Parse failures carry only a byte offset (flowc emit: at 62), with no message.Everything else the server does (hover, completion, definition, references, rename, symbols, highlight) is lexical or structural and could move to Flow now. Diagnostics and formatting need the full-language front end first.
godofecht commentedon Sep 30, 2026
Delivered on main (ee5048d) by #1016:
tools/lspis the JSON-RPC language server in Flow (diagnostics, hover, completion, definition, references, rename, symbols, formatting, highlight), andflow-lsp,./flow lspand the VS Code extension use it. The Python server is deleted.