summaryrefslogtreecommitdiff
path: root/internal/lsp/handlers.go
AgeCommit message (Collapse)Author
2026-03-23chore: bump version to v0.25.9v0.25.9Paul Buetow
Code quality fixes from audit: - Log silently discarded errors in status sinks and stats.Update call sites - Fix json.Marshal errors silently ignored in LSP handlers - Replace time.Sleep in tests with channel signaling (mcp) and fake clock (stats) - Make context cancellation work in production time.Sleep sites (handlers_document, cmdentry) - Remove init()-based provider registration from llm package; use explicit RegisterAllProviders() - Add WaitGroup goroutine tracking to MCP server Run() Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23refactor: split oversized functions, fix double logging, add %w wrappingPaul Buetow
- lsp/handlers_completion.go: extract buildNativeCompletionCacheKey and postProcessNativeCompletion; track collectFirstCompletion in inflight; remove redundant logLLMStats("") on error path - lsp/handlers.go: extract checkTriggerFromContext and checkTriggerFromCursorChar; isTriggerEvent reduced from 63→10 lines - lsp/transport.go: use %w for error wrapping in Content-Length parse - llm/ollama.go: extract parseOllamaStream; ChatStream reduced to ~35 lines - appconfig/config_load.go: extract decodeModelEntryFromMap; rename 'any' to 'found'; decodeModelEntry reduced to ~18 lines - llm/provider.go: document why providerRegistry is package-level - integrationtests/ask_test.go: add //go:build integration; move repoRoot init from init() to TestMain with diagnostic message Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17Fix bugs, remove duplication, and clean up code quality issuesPaul Buetow
- Log swallowed JSON unmarshal errors in stats and LSP handlers - Fix debug log file handle leak in tmuxedit (return closer from initDebugLog) - Check f.Close() errors on write paths in promptstore and tmuxedit - Fix cacheGet TOCTOU race by using single write lock - Fix readInput to use passed stdin reader instead of os.Stdin.Stat() - Remove 45 'moved to' comment tombstones from lsp/handlers.go - Deduplicate canonicalProvider wrappers (use llmutils.CanonicalProvider directly) - Remove SetWindow side effect from stats.TakeSnapshot (pure read now) - Move duplicated splitLines to textutil.SplitLinesBytes - Collapse StatusSink.SetGlobal 10 params into GlobalStatus struct - Simplify LRU touchLocked to in-place delete-and-append Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16Fix byte vs UTF-16 indexing in LSP position handlingPaul Buetow
Adds utf16OffsetToByteOffset helper to correctly convert LSP character positions (UTF-16 code units) to Go string byte offsets. Fixes trigger detection, prefix heuristic, and completion text slicing for files containing multi-byte characters. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16Replace Summary: prefixes with standard Go package doc commentsPaul Buetow
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10task bf088a70: extract LSP client and completion statePaul Buetow
2025-10-03Switch inline prompt markers to >! prefixv0.15.1Paul Buetow
2025-09-27Support multi-provider fan-out across CLI and completionsPaul Buetow
2025-09-24Add runtime config store and reload commandPaul Buetow
2025-09-19fixPaul Buetow
2025-09-08docs: move tmux documentation to its own filePaul Buetow
2025-09-06fix unit test coveragePaul Buetow
2025-09-06use gofumptPaul Buetow
2025-09-06feat(lsp): configurable inline/chat triggers; switch inline markers to ↵Paul Buetow
>text>/>>text>; update docs and example config; tests updated to new triggers and raise LSP coverage to >=85%; chore: remove semicolon legacy; chore(mage): auto-refresh coverage daily if docs/coverage.out is older than 24h
2025-09-03Phase 1: remove single in-flight LLM gate\n\n- Drop llmBusy state and busy ↵Paul Buetow
item\n- Remove concurrency guard in completion paths\n- Allow manual invoke (TriggerKind=1) even after whitespace\n- Delete llm_busy_test; update TODO\n\nAll unit tests pass.
2025-08-31update the statusPaul Buetow
2025-08-29lsp: move remaining small helpers (code-fence, label, duplicate prefix, ↵Paul Buetow
semicolon tag, extractRangeText) to handlers_utils.go; keep handlers.go <1000 lines
2025-08-29lsp: extract generic helpers to handlers_utils.go; tidy importsPaul Buetow
2025-08-29lsp: refactor dispatch to handler map; split handlers into feature files ↵Paul Buetow
(completion, codeaction, init, document); decompose completion logic into small helpers; update review checklist
2025-08-28lsp: limit to one in-flight LLM query; return visible 'LLM busy' completion ↵Paul Buetow
item with provider/model; retain chat EOL suppression
2025-08-28lsp: switch in-editor chat triggers to ?> !> :> ;> and suppress normal ↵Paul Buetow
completion on EOL chat trigger; keep ;;text; inline trigger unchanged; update docs and tests
2025-08-28copilot: add session token + codex code completion; lsp: prefer native ↵v0.3.0Paul Buetow
CodeCompleter with chat fallback; remove obsolete throttle path; add tests; bump version to 0.3.0
2025-08-28lsp/chat: remove '..' trigger; docs: update triggers; tests: align throttle ↵v0.2.1Paul Buetow
test; version: bump to 0.2.1
2025-08-22remove busy checkPaul Buetow
2025-08-22stuffPaul Buetow
2025-08-22logging: log completion TriggerKind and TriggerCharacter for every requestPaul Buetow
2025-08-22completion: only apply leading indentation for ';;text;' prompts; not for ↵Paul Buetow
';text;'
2025-08-22chat: remove ';;' as in-editor chat trigger to avoid conflict with inline ↵Paul Buetow
';;text;' completion; update docs
2025-08-22lsp: suppress auto-trigger when line contains bare ';;' (no ';;text;') ↵Paul Buetow
unless manual invoke; add explicit skip log
2025-08-22lsp: refine ';;text;' detection to require non-empty, non-space content and ↵Paul Buetow
closing ';'; ensure bare ';;' and ';;;' do not auto-trigger; add tests
2025-08-22lsp: always trigger completion on inline semicolon prompts (;text; or ↵Paul Buetow
';;...;'); relax prefix check accordingly; add tests
2025-08-22tests(lsp): add duplicate-prefix and manual-invoke tests; fix cache key to ↵Paul Buetow
ignore trailing whitespace; guard compCache init
2025-08-22lsp: relax short-prefix check for manual invoke and after ')' in signaturesPaul Buetow
2025-08-22lsp: treat manual completion as trigger; remove space from default triggers; ↵Paul Buetow
avoid auto after whitespace
2025-08-20betterPaul Buetow
2025-08-20lsp: add tiny LRU cache for last 10 completions; ignore trailing whitespace ↵Paul Buetow
in cache key; log cache hits; report busy with isIncomplete to prompt client retry
2025-08-19lsp/codeactions: make actions lazy and resolve on selection\n\n- Advertise ↵Paul Buetow
CodeAction resolveProvider and implement codeAction/resolve\n- Return lightweight actions with data; no LLM call during listing\n- On resolve, perform LLM and populate WorkspaceEdit\n- Update tests to cover lazy+resolve flow
2025-08-19logging: highlight LLM no-op skips in yellow\n\n- Add AnsiYellow to logging ↵Paul Buetow
utilities\n- Colorize skip logs (no-trigger, short-prefix, busy) in hexai-lsp logs
2025-08-19lsp: include space in trigger characters and allow space-triggered ↵Paul Buetow
completions\n\n- Defaults now include space (" ") in trigger list\n- Prefix heuristic treats space as structural trigger (no min-prefix required)\n- README and config example updated\n- Tests: add coverage for space trigger
2025-08-19lsp: replace time throttle with in-flight guard; improve short-prefix ↵Paul Buetow
heuristic\n\n- Prevent overlapping LLM requests via llmBusy guard\n- Remove time-based throttle and option plumbing\n- Short-prefix heuristic now skips over trailing whitespace and clamps index\n- Add tests for busy guard and trailing-space allowance
2025-08-19lsp: reduce eager completions and add throttling\n\n- Defaults: remove ';' ↵Paul Buetow
and '?' from trigger characters\n- Add min-typed-prefix heuristic for LLM completions (>=2 chars)\n- Add simple time-based throttle between LLM completions (default 900ms)\n- Tests: verify default triggers and skip logic (throttle + min prefix)\n- Config example: update trigger_characters list
2025-08-19lsp: strip inline spans for completions\n\n- Add stripInlineCodeSpan helper ↵Paul Buetow
to extract first inline backtick span\n- Apply only in completion path after fence stripping\n- Add comprehensive unit tests for inline span handling
2025-08-19chore: commit pending changes in status, LSP, and Ollama modulesPaul Buetow
2025-08-18lsp: strip Markdown code fences from LLM outputs (completions and code actions)Paul Buetow
2025-08-18refactor(lsp,llm,hexailsp,appconfig): split long funcs; add testsPaul Buetow
- Extract helpers to keep funcs <=50 lines; no behavior changes - Add tests for prompt removal, code actions, and LLM request builders - Table-drive TestInParamList; run gofmt
2025-08-18feat(lsp): add coding_temperature knob and remove hardcoded temps\n\n- Add ↵Paul Buetow
to app config and server options.\n- Use in LSP code actions and completions.\n- Default to provider temperature when not set.\n- Update README and config.json.example.
2025-08-17cli+lsp: refactor main packages into internal runners; add testsPaul Buetow
- Move CLI logic to internal/hexaicli with Run/RunWithClient - Move LSP logic to internal/hexailsp with Run/RunWithFactory - Extract helpers; keep behavior identical for both binaries - Add unit tests for hexaicli (input parsing, messages, streaming) and hexailsp (factory wiring, client creation, logging settings) - Add top-of-file summaries and 'Not yet reviewed by a human' comments to all Go files - Update README with internal package docs
2025-08-17lsp/config: make completion trigger characters configurablePaul Buetow
- Add trigger_characters to JSON config and ServerOptions - Store on server and advertise in initialize - Update README and example config - Preserve previous defaults when unset
2025-08-16lsp: add 'Resolve diagnostics' code action scoped to selectionPaul Buetow
- Parse diagnostics from CodeAction context; filter to overlap with selection - Build LLM prompt from selection-only diagnostics; replace only selected range - Keep existing 'Rewrite selection' action; return both when applicable - Add Diagnostic and CodeActionContext types; make CodeActionParams.Context raw JSON - Add helpers for range overlap; unit tests for filtering/overlap - Update README to document resolve-diagnostics action
2025-08-16fix(lsp): avoid duplicate assignment prefix in completionsPaul Buetow
- Prompt: instruct model to only continue from cursor; do not repeat LHS already typed.\n- Add stripDuplicateAssignmentPrefix to drop duplicated 'name :=' or 'name =' when model repeats it.\n- Tests: cover := and = cases.\n- .gitignore: ignore built binary and go caches.