Skip to content

Implement codeAction/resolve: the offered refactors actually apply (#15) - #19

Merged
Asmod4n merged 1 commit into
mainfrom
claude/issue-15-code-action-resolve
Jul 29, 2026
Merged

Implement codeAction/resolve: the offered refactors actually apply (#15)#19
Asmod4n merged 1 commit into
mainfrom
claude/issue-15-code-action-resolve

Conversation

@Asmod4n

@Asmod4n Asmod4n commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary

Stacked on #18 — merge that first.

  • The server advertised resolveProvider: true and offered Extract Variable, Extract Method, and Toggle block style as edit-less actions, but METHOD_MAP had no codeAction/resolve entry: a conformant client showed the refactors and invoking any of them died with -32601.
  • lib/mruby_lsp/code_action_resolve.rb: a faithful port of ruby-lsp 0.26.9's CodeActionResolve onto our Document/Locator plumbing — Extract Variable, Extract Method, Toggle block style, and the Create Attribute Reader/Writer/Accessor family. Unresolvable input returns the action unchanged (edit-less → client no-op), never crashes.
  • code_action.rb now offers exactly what ruby-lsp offers (extract pair on selection, toggle at a cursor inside a block or on any selection, attribute family on ivars, quickfix passthrough unchanged).
  • Dispatch wiring: METHOD_MAP + Server#code_action_resolve.
  • Coverage: test/overlay/code_action_resolve_test.rb (prism-only unit checks) and test/conformance/replay_actions.py, wired into CI via two new scripts in test/conformance/replays/ (code_actions.sh, code_action_resolve.sh) — no edits to ci.yml itself, following the directory convention ci: run the whole test suite against the real server on every PR (#1) #18 establishes.

Test plan

  • All 27 vendored ruby-lsp vectors byte-equal (code_action_resolve 22/22, code_actions 5/5)
  • Full local rehearsal against a real mruby HEAD reflection VM
  • Green on GitHub Actions (workflow_dispatch on this branch)

The server advertised resolveProvider: true and offered Extract
Variable / Extract Method / Toggle block style as edit-less actions
with a data payload, but METHOD_MAP had no codeAction/resolve entry —
a conformant client showed the refactors and invoking any of them died
with -32601. (The interim mitigation described in #15 never landed;
main carried the original bug.)

- lib/mruby_lsp/code_action_resolve.rb: a faithful port of ruby-lsp
  0.26.9's CodeActionResolve (the pinned vendored-vector commit) onto
  our Document/Locator plumbing — Extract Variable (incl. the one-line
  block semicolon form and the empty-line-above placement), Extract
  Method (def after the enclosing method; above the selection at
  script level), Toggle block style (brace <-> do/end, recursing into
  nested blocks), and the Create Attribute Reader/Writer/Accessor
  family. Like ruby-lsp's locate, a typed locate-miss falls back to
  the walked root — that fallback is what makes the class-less
  attribute case insert at Program scope. Unresolvable input returns
  the action unchanged (an edit-less action is a client no-op) —
  degrade, don't crash. No regex on source (hand scan for indentation).
- code_action.rb now offers exactly what ruby-lsp offers: the extract
  pair on any non-empty selection, toggle at a cursor inside a block
  or on any selection (resolve decides applicability), the attribute
  family when an ivar is under the cursor/selection, quickfix
  passthrough unchanged. codeActionKinds gains "" (the attribute
  actions' kind).
- dispatch: METHOD_MAP + Server#code_action_resolve.
- Coverage: test/overlay/code_action_resolve_test.rb (17 prism-only
  checks) and test/conformance/replay_actions.py, which replays BOTH
  vector families verbatim (uri file:///fake, offer contexts with
  embedded quickfixes) — code_action_resolve 22/22 and code_actions
  5/5 byte-equal, raising the CI-asserted conformance baseline from
  112/112 to 139/139 (ci.yml, README scorecard, CONTRIBUTING updated).

Built on the CI branch: the replay harness needs its consent-answering
clients. Verified over real LSP stdio against the compiled mruby HEAD
reflection VM: all six replayed features green (35+48+16+13+5+22).
Base automatically changed from claude/issue-1-ci to main July 20, 2026 11:15
@Asmod4n
Asmod4n merged commit 6ccc9e3 into main Jul 29, 2026
4 checks passed
@Asmod4n
Asmod4n deleted the claude/issue-15-code-action-resolve branch July 29, 2026 16:17
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.

1 participant