Repository navigation
Conversation
There was a problem hiding this comment.
Thanks for this, and for the thorough description. It works well: we're holding the merge until msarson/Clarion-Extension#857 lands.
Tests
- All 36 node test suites pass on this branch, including
hover-branch-list-wheel(18/18) andhover-self-links(44/44). - Run against master's page, both new tests fail, as you said.
- We also broke three things on purpose: Ctrl+wheel excluded,
stopPropagationremoved, and the label always "line N". The matching test failed each time. - The branch merges cleanly onto current master.
Fit with #857
- The server's links carry exactly the
"Go to branch"title and| Line | Branch |table that the CSS andbranchListWheelkey on. - #857 also makes the card's other line links bare numbers ("END on line [17]"). The
prepareSelfLinkschange is therefore needed: without it the CA Embeditor would show "on line line 17". With it, the card shows the embeditor's shifted number. - Everything is keyed to tables containing a "Go to branch" link. Until a server sends one, the page behaves as it does today.
Why we're holding it
CA currently ships LSP v1.0.9, and #857 is still open against version-1.0.11. If the title or table format changed during that review, this side would stop matching with no visible error. Once #857 is merged, we'll merge this together with the LSP update that brings it in.
Two small things we'll tidy when we merge (nothing needed from you):
- the commit body still has the template's "Insert text here";
- in
Terminal/test/package.json, the missing space in&&node local-first-slices(copied from the existing line).
— Charlie
The language server's CASE / OF / END cards are getting a cap (msarson/Clarion-Extension#857): at most 40 branches and a "...N more" row, unless the client announces capabilities.experimental.clarionCaseBranchListAll. This page limits the list's height and scrolls it itself, so LspClient now announces the flag next to clarionAttributeEditLinks and keeps getting the whole list. A server without the cap ignores the flag. Checked live against a 163-branch CASE: every branch is returned and no "...N more" row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Added 6b51ae3: LspClient now also announces capabilities.experimental.clarionCaseBranchListAll. |
Reported by John: in the BrowseAuthors CA Embeditor, the global dbgCount carries a red squiggle reading "'dbgCount' is not declared in this file." while HOVERING the same word correctly reports it as a global variable. Not our diagnostic. It comes from UndeclaredVariableDiagnostics in the Clarion language server, and the split is a known upstream shape (Clarion-Extension ClarionLive#115, whose audit ships in .lsp-build): the diagnostic and hover/F12 resolve globals through two DIFFERENT paths. ClarionLive#115's fix chose a SymbolFinder fallback over reusing hover's own loadGlobalScopeForCursor, so the two can still disagree -- same family as the ClarionLive#298 / ClarionLive#300 follow-ups already fixed on top of it. Filed upstream; this is the CA-side stopgap, and it leans on that diagnostic's own stated contract: "if ANY of our own resolution paths knows the name, don't flag it." Ruled OUT as the source of truth first: CodeGraph. ClarionParser emits Type="variable" in exactly two places, both Scope="local" -- program- and module-scope DATA is never indexed at all. Verified against two real .codegraph.db files: type='variable' occurs ONLY with scope='local' (223 and 56 rows, zero globals). A CodeGraph-only filter would have been inert for the reported bug. That also independently confirms the diagnosis -- CodeGraph cannot have answered the hover, so the server itself resolved it. So the global check reads the source the app actually generates: ResolveNamesFromProgramGlobals follows the module's own MEMBER('...') line to the PROGRAM .clw and looks for a column-1 label in its declaration section (bounded by ClarionParser.FindMainTailStart, so the global CODE and everything after it are excluded). In embed mode EmbedLspContext already addresses the buffer to the real generated module path, so the file whose MEMBER line we need is exactly the path the diagnostics request carries. A file that IS the PROGRAM is handled directly. CodeGraph is still consulted afterwards, for what it does know: global CLASS/INTERFACE, module procedures, ABC library symbols. That path needed a new primitive -- FindAllSymbolsByName -- because FindSymbolByName's unordered LIMIT 1 answers "is any declaration of this name non-local?" with an arbitrary row, so the verdict would have depended on index order. Results are scope-ordered (global, module, class, then local/parameter last) so a reachable declaration is seen first. Kept deliberately narrow so real undeclared variables still surface: * only this exact message shape is considered; no DB or file is even opened otherwise, and every other diagnostic passes through untouched * 'local'/'parameter' matches clear NOTHING -- that is another procedure's private data, the case the server is right about (same reasoning as IsUnreachableLocalVariable, which guards the F12 fallback) * unknown to every path => keep the diagnostic; the server stays the default and is only overruled on positive evidence * a throw anywhere in the filter returns the diagnostics unchanged Verified by driving the SHIPPED DLL through reflection against real generated Clarion source (EmptyApp001.clw -> EmptyApp.clw): 18 assertions -- five genuine globals of differing shapes cleared (BYTE(0), INIClass, LONG(0),THREAD, ErrorClass, FuzzyClass), unknown names NOT cleared, case-insensitive both ways, PROGRAM-file passed directly, null/empty/missing paths non-throwing, and end-to-end that DropUndeclaredWeCanResolve drops only the resolvable entry while the genuinely undeclared one and an unrelated diagnostic both survive with Pending preserved. NOT yet verified live against BrowseAuthors -- Clarion is running, so no deploy. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
What this changes
The language server's hover cards for a CASE, its OF / OROF / ELSE and its END now list the CASE's branches: a table with one row per branch, the line number as a link, then the branch's source line (msarson/Clarion-Extension#857). In a long
CASE EVENT()that table is taller than a hover card should be, and Monaco's hover handling gets in the way of scrolling it. This makes the list work well in the CA Editor and the CA Embeditor. Without the server change nothing here applies: every rule and the wheel handler key on the server's link title.--ca-branch-rows.--vscode-hover-maxWidth, so in a narrow editor too), ends in…. The event or control name, and the start of a comment, are what identify a branch.#Ltarget past the MEMBER header). A link whose label is a bare number, as in this list, keeps a bare number, but the shifted one, so the numbers match the embeditor's gutter.How it works
All in
monaco-embeditor.html:.monaco-hover table:has(a[title="Go to branch"]):display: blockwith a max height of (rows + header) × row height,overflow-x: hidden,scrollbar-colorfrom the theme, a stickythead, fixed-heightnowraprows, and aninline-blockcodecell withmax-width: min(72ch, hover max width − the number column)andtext-overflow: ellipsis.branchListWheel, awheellistener ondocumentin the capture phase (passive: false), so it runs before Monaco's own capture-phase listener on the editor. Over a branch list with hidden rows it callspreventDefault+stopPropagationand scrolls the list itself: pixels in proportion (100px = 3 rows), a line as a row, a page as the rows on show (the list less its pinned header), with the row height measured unrounded so steps stay on row boundaries.prepareSelfLinks: a bare-number label stays a number (the shifted line) instead of becoming "line N".Tests
hover-branch-list-wheel.test.js(new, 18 checks, added tonpm test) runs the realbranchListWheel: a notch scrolls 3 rows, a display-scaled notch 4.5 rather than 6, touchpad, line and page deltas, the event stopped at either end, and left alone for a list that fits, a table that is not a branch list, Ctrl+wheel and a target outside a hover table; the CSS rule (row cap, vertical-only scrolling, pinned header, ellipsis); and the capture-phase, non-passive registration.hover-self-links.test.js: a new section for the bare-number label (the shifted number with the title kept; a bare number to another file left alone).Without the page change the wheel suite fails and the new self-links check fails ("line 213"). With it,
hover-branch-list-wheel18/18 andhover-self-links44/44, andmonaco-page-integrity,hover-footer-row,hover-attribute-chips,local-first-hover,local-first-completionandbuffer-syncall pass.