feat(lsp,cli,effects): variable hover (type+docs), builtin docs generator, handler-owned effect state + resume front-end#149
Merged
Conversation
Calls and iterator callbacks whose callee is an arbitrary expression — a chained application (`add3(1)(2)(3)`), a function held in a record field (`cfg.processor`), or any computed call result — previously failed loudly. They now recover the callee's signature from the type table and dispatch through the existing closure cell: - builder.rs: `callee_fn_type` resolves the function `Type` of a callee expression (identifier / chained call / record-field access). - expr.rs: the non-identifier callee in `gen_call` dispatches via the recovered `FnSig` instead of bailing; still fails loudly for non-functions. - iter.rs: `callback_of` evaluates a computed/field callback once to a closure handle (`Callback::Value`) and calls it per element through its cell. Closes plan 0001. Extends function_composition_test with a chained 3-deep call, a computed iterator callback, and a record-field filter callback; adds a codegen unit test for the three paths.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TLDR
Adds editor variable hover (declared/inferred type +
///docs), a single-source-of-truth built-in function docs generator, handler-owned mutable state for algebraic effects, and the parse/type front-end for explicitresume— all behind a greenmake ci.Details
LSP / editor — variable hover (
[LSP-HOVER])collect_all_symbolsnow deep-walks every expression body (blocks, match arms, lambdas, call args, string interpolations, handlerin {…}blocks), so alet/mutnested anywhere is discoverable — fixing "no hover bubble on a variable inside an HTTP server block".ProgramTypes.lets/let_type(newcrates/osprey-types/src/info.rs+check.rs).///like functions: grammardoc_commentonlet, captured through syntax lowering into the ASTdocfield, rendered as hover prose. The binding position anchors on the name/keyword field, so a leading///never shifts it.text.rsfiled upstream asNimblesite/lspkit#2. Spec0020gains[LSP-HOVER],[LSP-HOVER-VARIABLES],[LSP-HOVER-DOCS],[LSP-REUSE-LSPKIT].Built-in docs generator —
osprey --docs --docs-dir <dir>crates/osprey-cli/src/docs.rs+crates/osprey-types/src/builtin_docs{,_lang,_sys}.rs: the compiler's type schemes are the single source of truth — one page per built-in plus an index, with stale pages pruned. Regenerates 90website/src/docs/functions/*pages so the website and editor hover show identical signatures/types.Algebraic effects
[EFFECTS-HANDLER-STATE]): handler arms read/write amutcaptured from the enclosing scope (promoted to a shared heap cell; per-region env carried on the handler stack). Makes theStateeffect fully usable. Runtime ineffects_runtime.c; codegen ineffects.rs/lower.rs/expr.rs. Reference examplecompiler/examples/tested/effects/http_state_levels.osp.resumefront-end: grammar / AST / syntax-lowering + Hindley-Milner typing (resumetyped against the operation result; rejected outside a handler arm). The continuation runtime/codegen is not yet wired —resumeparses and type-checks but is currently rejected at code generation; spec0017and plan0008mark it specified-but-not-yet-executable.Examples / runtime
compiler/examples/statefulhttp/{server,tui}.osp+ README: a stateful HTTP server and a terminal UI. Terminal/raw-mode additions insystem_runtime.c; HTTP handler return-type alignment inhttp_server_runtime.c.VS Code extension
How Do The Automated Tests Prove It Works?
crates/osprey-lsp):hover_on_a_let_binding_uses_the_name_and_type_form(assertslimit: int),hover_on_a_local_let_shows_inferred_type_and_docs(asserts inferredgreeting: stringand the///doc prose),hover_on_a_documented_function_renders_its_docs, andcollect_all_symbols_descends_into_every_expression_form(walks every expression container).vscode-extension/test/suite/extension.test.ts— "CHUNKY: full language-intelligence sweep…" assertsradius: int/count: inton unannotated lets, and "CHUNKY: a///-documented variable hovers with its type AND its docs" asserts a top-level and a block-nested documentedlethover with type + doc prose through a liveexecuteHoverProvideragainst the launched LSP.crates/osprey-cli/src/docs.rs):generate_writes_a_page_per_builtin_plus_an_index,prune_deletes_stale_pages_but_keeps_live_ones_and_the_index,slugs_disambiguate_case_collisions_and_stay_unique,slug_map_falls_back_to_a_numeric_suffix_when_the_type_slug_also_collides,page_uses_scheme_types_and_omits_empty_sections.http_state_levels.ospthroughosprey --runand matches.expectedoutputbyte-for-byte (part ofPASS=48 FAIL=0).osprey-typesselect_and_handler_expressionstype-checks ahandle … resume(v + 1000) …program (auto-unwrap of the arithmeticResultinto the operation-result slot).make cigreen — clippy-D warnings,cargo fmt --check, all 7 crate coverage thresholds (osprey-lsp 99.1%, osprey-types 98.7%, osprey-cli 96.4%, osprey-codegen 95.6%, …), vscode-extension 90.37% ≥ 89%, differentialPASS=48 FAIL=0 NOEXP=0+FC_OK.