feat(lsp): diagnostic debouncing and semantic token provider (#272)#417
feat(lsp): diagnostic debouncing and semantic token provider (#272)#417ajitpratap0 merged 3 commits intomainfrom
Conversation
- Debounce validateDocument calls with 300ms timer per document URI to avoid N parse calls per rapid-typing burst - Add textDocument/semanticTokens/full handler with 6-type legend (keyword, identifier, number, string, operator, comment) - Clean up debounce timers on textDocument/didClose Closes #272 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Claude finished @ajitpratap0's task —— View job Code Review for LSP Diagnostic Debouncing and Semantic TokensTodo List:
🔍 Review SummaryThis PR successfully implements diagnostic debouncing and semantic token provider for the LSP server. The implementation is well-structured and follows the project's architectural patterns. Here's my detailed analysis: ✅ Positive AspectsStrong Implementation Design
Clean Code Quality
|
|
Claude finished @ajitpratap0's task —— View job Code Review Complete ✅I've completed a comprehensive review of the PR implementing diagnostic debouncing and semantic token provider. Here's my analysis:
Overall AssessmentThis is a well-implemented PR that adds two important LSP features: diagnostic debouncing and semantic tokens support. The implementation follows good practices and maintains thread safety. StrengthsDiagnostic Debouncing (
|
|
Claude finished @ajitpratap0's task —— View job Code Review Complete ✅Todo List:
🔍 Review SummaryThis PR successfully implements diagnostic debouncing and semantic token provider for the LSP server. The implementation is well-structured and follows the project's architectural patterns. Here's my detailed analysis: ✅ Positive AspectsStrong Implementation Design
Clean Code Quality
|
Summary
Implements the remaining items from #272. Incremental text sync was already done; this PR adds debounced diagnostics and the
textDocument/semanticTokens/fullcapability.Changes
pkg/lsp/handler.goDiagnostic debouncing
debounceMu sync.MutexanddebounceTimers map[string]*time.TimertoHandlerstructdebounceTimersinNewHandlerhandleDidChangenow schedules a 300mstime.AfterFuncinstead of callingvalidateDocumentsynchronously — existing timers are stopped before rescheduling; content snapshot is captured at change time (not at fire time) to avoid raceshandleDidClosecancels and removes the timer for the closed URI beforeDocuments().Close()Semantic tokens
case "textDocument/semanticTokens/full"toHandleRequesthandleInitializenow advertisesSemanticTokensProviderinServerCapabilitieshandleSemanticTokensFull: tokenizes document content viatokenizer.GetTokenizer/PutTokenizer, then encodes to LSP 5-integer delta formatclassifyToken: mapsmodels.TokenType*constants to 6-type legend (keyword, identifier, number, string, operator, comment)encodeSemanticTokens: 0-based LSP delta encoding from 1-basedmodels.Locationpkg/lsp/protocol.goSemanticTokensProvider *SemanticTokensOptionstoServerCapabilitiesSemanticTokensLegend,SemanticTokensOptions,SemanticTokensParams,SemanticTokensTest plan
go test ./pkg/lsp/... -race— no data races on debounce timer mapCloses #272
🤖 Generated with Claude Code