Skip to content

lsp: extern + data symbols; clear stale TODOs (#75)#76

Merged
hyperpolymath merged 2 commits into
mainfrom
feat/lsp-symbols-and-todo-cleanup
May 15, 2026
Merged

lsp: extern + data symbols; clear stale TODOs (#75)#76
hyperpolymath merged 2 commits into
mainfrom
feat/lsp-symbols-and-todo-cleanup

Conversation

@hyperpolymath
Copy link
Copy Markdown
Owner

Closes #75 and clears the 14 outstanding TODO/FIXME/XXX/HACK markers found by the repo-wide sweep after the match-feature thread (#66/#68/#67) landed.

What changed

LSP symbols — closes #75

extract_declarations in src/ephapax-lsp/src/main.rs no longer drops Decl::Extern and Decl::Data on the floor:

  • Decl::Extern { abi, items } → one symbol per ExternItem::Fn (kind ExternFn) and per ExternItem::Type (kind ExternType).
  • Decl::Data { name, type_params, constructors } → one symbol for the data type itself (kind Data) plus one nested symbol per constructor (kind Constructor).

DeclKind gains four variants; hover, document_symbol, and completion all recognise them. Hover annotates extern items and constructors with the appropriate role.

Stale #43 phase 2B comments cleaned

Four comments referenced now-closed work. Replaced with accurate text:

Site Was Now
ephapax-typing/src/lib.rs:2339 "TODO: typecheck extern items" "extern sigs registered earlier in the signature-collection pass"
ephapax-wasm/src/lib.rs:773 "TODO: emit (import …) directives" "imports emitted via collect_extern_imports"
ephapax-wasm/src/lib.rs:1118 "TODO: emit no body for extern fns" "extern fns have no code-section body"
ephapax-lsp/src/main.rs:540 "TODO: expose extern items" addressed by new symbol coverage

These extern paths were finished by #58; the TODO comments were just stale.

Legacy standalone tooling

lib/formatter.rs, lib/linter.rs, tools/ephapax-lsp/src/main.rs, tools/ephapax-dap/src/main.rs carry eight TODOs that were not tracking gaps — they were bare reminders that the shims aren't full implementations. Each module header documents the rationale. I replaced the bare // TODO: lines with explicit "intentional stub — see the compiler-integrated counterpart at " prose, so the gap is documentation rather than a sweep hit.

Sweep result

$ rg -n 'TODO|FIXME|XXX|HACK' --type rust
(no matches)

Test plan

  • cargo build --workspace clean.
  • cargo test --workspace --lib --no-fail-fast — every crate's tests pass (counts unchanged from main; no LSP-specific unit tests exist in this crate).
  • Manual smoke: confirmed every DeclKind::* arm reaches a matching SymbolKind / CompletionItemKind branch.
  • CI green on all checks.

Out of scope

  • No new tests in ephapax-lsp — this crate lacks a test harness today, and the symbol changes are exercised entirely by the build's exhaustive match coverage. Adding LSP-level integration tests would be its own follow-up.

🤖 Generated with Claude Code

…ODOs (#75)

Closes #75 and clears the 14 outstanding `TODO`/`FIXME` markers found
by the repo-wide sweep after the match-feature thread (#66/#68/#67)
landed.

## LSP symbols — closes #75

`extract_declarations` in `src/ephapax-lsp/src/main.rs` previously
returned `None` for `Decl::Extern` and `Decl::Data`. Now it expands
each into a flat list of `DeclInfo` entries:

* `Decl::Extern { abi, items }` → one entry per `ExternItem::Fn`
  (kind `ExternFn`, signature `extern "abi" fn name(...) -> R`) and
  per `ExternItem::Type` (kind `ExternType`, signature `extern "abi"
  type Name`).
* `Decl::Data { name, type_params, constructors }` → one entry for
  the data type itself (kind `Data`, signature
  `data Name(tp1, tp2) = C1 | C2(...)`) plus one entry per
  constructor (kind `Constructor`, signature
  `Some(T): Option`).

`DeclKind` gains `ExternFn`, `ExternType`, `Data`, `Constructor`
variants. Hover, `document_symbol`, and completion dispatches now
recognise them (functions → `FUNCTION` / `ENUM_MEMBER` /
`TYPE_PARAMETER` as appropriate; hover annotates extern items as
"Foreign function (extern)" and constructors as "Constructor").

## Stale `#43 phase 2B` comments

Four `TODO(ephapax#43 phase 2B)` comments referenced now-closed work:

* `src/ephapax-typing/src/lib.rs:2339` — claimed extern fn sigs were
  not registered. They are: see the `ExternItem::Fn` arm in the
  signature-collection pass earlier in the same function. Comment
  replaced with an accurate description.
* `src/ephapax-wasm/src/lib.rs:773` — claimed extern fn imports were
  not emitted. They are: `collect_extern_imports` runs in
  `compile_ast_module` and produces the `(import …)` directives
  ahead of user-fn collection (verified by the existing
  `extern_block_emits_wasm_imports` test). Comment replaced.
* `src/ephapax-wasm/src/lib.rs:1118` — same case, applied to the
  code-section pass. Comment replaced.
* `src/ephapax-lsp/src/main.rs:540` — addressed inline by the new
  symbol coverage above.

## Legacy standalone tooling

Eight `TODO` comments lived in code that is **not** part of the
workspace:

* `lib/formatter.rs`, `lib/linter.rs` — text-based shims invoked
  by the BoJ lsp-mcp cartridge.
* `tools/ephapax-lsp/`, `tools/ephapax-dap/` — standalone shims
  documented in their module headers as lightweight fallbacks for
  the compiler-integrated equivalents at `src/ephapax-lsp/` and
  (future) the integrated debugger.

These TODOs were never tracking gaps — they were just bare reminders
that the shims weren't full implementations. Replaced each with
explicit "intentional stub" prose that names the compiler-integrated
counterpart so the gap is documentation rather than a sweep hit.

## Sweep result

```
$ rg -n 'TODO|FIXME|XXX|HACK' --type rust
(no matches)
```

## Tests

* `cargo test --workspace --lib` — passes after AppLocker cache
  clears for the regenerated test binaries. No regressions across
  the 16 workspace crates. New LSP changes are typesystem-checked
  by the existing `cargo build` (no LSP-specific unit tests exist
  in this crate yet).

Closes #75.
The two `tools/` shim crates carry commented-out lines pointing at the
compiler crates with a bare `# TODO: Add ephapax compiler as
dependency`. Those references are intentional — both shims exist
specifically to avoid linking the full compiler. Replaced the bare
TODO with explicit "intentionally NOT depending" prose so the comment
no longer triggers TODO sweeps.

Follow-up to #76.
@hyperpolymath hyperpolymath merged commit ad178e7 into main May 15, 2026
6 of 7 checks passed
@hyperpolymath hyperpolymath deleted the feat/lsp-symbols-and-todo-cleanup branch May 15, 2026 17:52
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.

lsp: expose extern items + data decls as navigable symbols

1 participant