Repository navigation
feat(lsp): apply the configured dialect to every language feature - #828
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Claude finished @ajitpratap0's task in 30s —— View job Review of PR #828: dialect-aware LSP featuresI read the diff for What works well
Points to consider
Tests
Security None of the points above blocks the merge, though I'd take a look at items 1 and 3 first. |
ccd299e to
d9c287f
Compare
be95a2f to
12062f4
Compare
|
Claude finished @ajitpratap0's task in 30s —— View job Review of PR #828: dialect-aware LSP featuresI read the diff and Overall: The design is sound, and none of the points below blocks the merge.
Points to consider
Tests: I could not tell from the diff whether
Security: No new concerns. Settings are parsed with safe type assertions, and unknown dialects fall back to generic. |
Add pkg/highlight, a syntax highlighter built on the tokenizer, and expose it through the gosqlx API, CLI, LSP, WASM and the playground. - highlight.Spans classifies SQL into sorted byte-offset spans with 13 stable categories; functions/types are detected by context, prefixed literals stay whole, and invalid SQL is highlighted up to the first lexical error (rest marked error). Tab-aware offset mapping and validated error positions work around tokenizer location quirks. - Renderers: ANSI (256/true color/attributes), HTML (classes or inline styles, escaped), CSS; dark/light/mono themes; JSON-serializable spans. - gosqlx.Highlight/HighlightANSI/HighlightHTML convenience functions. - `gosqlx highlight` (alias hl): ansi|html|json|css, --theme, --dialect, --color auto|always|never (TTY, NO_COLOR, COLORTERM), --standalone. - LSP semantic tokens use the standard legend, UTF-16 positions, per-line splitting and the dialect from initializationOptions; the VS Code extension restarts the server when gosqlx.dialect changes. - WASM gosqlxHighlight returns UTF-16 spans; the playground decorates CodeMirror with them, falling back to Lezer until WASM is ready. - Docs: HIGHLIGHTING.md, CLI/API/LSP/usage guides, README, CHANGELOG. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KTj1PEbxzVCETkeYrZKcrE
The playground loads CodeMirror plus the GoSQLX highlighting bridge and was already at ~419 KB of the 420 KB script budget derived from the homepage; highlighting adds ~780 B gzipped. Split assertions into an assertMatrix: /playground/ gets 480 KB (measured 420 KB + ~15%), every other route keeps 420 KB. README updated with the measurement. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KTj1PEbxzVCETkeYrZKcrE
#826 made tokenizer columns count one byte per tab and fixed token Start after trivia. Drop the tab-as-4 offset adjustment, reject locations past their line, adapt the new LSP tab/comment offset test to the highlight-based encoder (comments are now emitted as tokens), and skip the fuzz ANSI round-trip check for inputs that already contain escape sequences (source text is passed through verbatim). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KTj1PEbxzVCETkeYrZKcrE
Diagnostics, formatting, document symbols, completion and hover now honor the dialect from initializationOptions, and workspace/didChangeConfiguration switches it at runtime: open documents are re-validated and, when the client supports it, semantic tokens are refreshed. Unset/generic keeps the previous behavior. Stale diagnostics from in-flight validations are dropped after a switch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KTj1PEbxzVCETkeYrZKcrE
d9c287f to
7da75d9
Compare
12062f4 to
cbaec43
Compare
|
Claude finished @ajitpratap0's task in 22s —— View job Review of PR #828: dialect-aware LSP featuresI read the diff for Verdict: The design is sound and I see no blocking problems. What works well
Points to consider, most important first
Tests: If
Security: I found no new concerns. Settings use safe type assertions, and unknown dialects fall back to generic. The |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RkzVu3JY9Y6BRWfjesWts9
|
Merged origin/main into feat/lsp-dialect-aware (merge commit 45305b4, normal fast-forward push, no force-push, no rebase). Conflicts were resolved by integrating both sides' changes; the main-side dialect-list work (#829, keywords.DialectNames) was merged in alongside this branch's changes, and CHANGELOG.md [Unreleased] hunks kept both sides' entries (union, no rewording). Verification was run before the push. 🤖 Generated with Claude Code |
|
Claude finished @ajitpratap0's task in 20s —— View job Review of PR #828: status checkMerge status: On this checkout, Still open from the earlier reviews. I re-checked these against the code, but I did not run the tests or
Tests. None of this blocks the merge. |
|
Claude finished @ajitpratap0's task in 20s —— View job Review of PR #828: dialect-aware LSP featuresI read Verdict: The design is sound and nothing here blocks the merge. This repeats most of the earlier reviews, and I re-checked each point against the code. What works well
Points to consider, most important first
Tests
Security: I found no new concerns. Settings use safe type assertions, and unknown dialects fall back to generic. |
Description
Stacked on #825: the base branch is
feat/syntax-highlighting. After #825 merges, this will be rebased ontomain.#825 used the LSP dialect only for semantic tokens. This PR applies it everywhere:
workspace/didChangeConfigurationwith{"gosqlx":{"dialect":"mysql"}}switches the dialect at runtime. Invalid values fall back togeneric, as at initialize. After a switch:workspace/semanticTokens/refreshis sent, but only if the client advertisedrefreshSupport.genericdialect keeps exactly the previous behavior: the samegosqlx.Parse,ParseWithRecoveryandFormatpipeline.publishMuserialises the staleness check with the publish.Type of Change
Testing
didChangeConfigurationswitching and invalid values, a pending-change race test, and-race.task checkandtask test:cbindingTestDialect_DidChangeConfiguration_PendingChange.BenchmarkHandler_ValidateDocument: allocations unchanged; time differences within noise.Breaking Changes
None.
🤖 Generated with Claude Code
https://claude.ai/code/session_01KTj1PEbxzVCETkeYrZKcrE