diff options
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/lsp/completion_throttle_test.go | 24 | ||||
| -rw-r--r-- | internal/lsp/handlers.go | 12 | ||||
| -rw-r--r-- | internal/version.go | 2 |
3 files changed, 20 insertions, 18 deletions
diff --git a/internal/lsp/completion_throttle_test.go b/internal/lsp/completion_throttle_test.go index 46975a0..11b0e7a 100644 --- a/internal/lsp/completion_throttle_test.go +++ b/internal/lsp/completion_throttle_test.go @@ -34,25 +34,27 @@ func TestDefaultTriggerChars_DoesNotIncludeSemicolonOrQuestion(t *testing.T) { } } -func TestTryLLMCompletion_BusySkipsConcurrent(t *testing.T) { +// Note: The server no longer exposes a busy guard; completion requests are +// handled sequentially and the LSP can request again if needed. This test used +// to assert a busy path; it now asserts that a normal trigger proceeds and +// calls the LLM without reporting busy. +func TestTryLLMCompletion_NoBusyPath_CurrentBehavior(t *testing.T) { s := &Server{ maxTokens: 32, triggerChars: []string{".", ":", "/", "_"} } fake := &countingLLM{} s.llmClient = fake - // Simulate another LLM request in flight - s.llmBusy = true p := CompletionParams{ Position: Position{ Line: 0, Character: 4 }, TextDocument: TextDocumentIdentifier{URI: "file://x.go"} } items, ok, busy := s.tryLLMCompletion(p, "", "foo.", "", "", "", false, "") - if ok { - t.Fatalf("expected ok=false when busy guard triggers") + if !ok { + t.Fatalf("expected ok=true for a normal triggered completion") } - if !busy { - t.Fatalf("expected busy=true when another request in flight") + if busy { + t.Fatalf("did not expect busy=true in current behavior") } - if len(items) != 0 { - t.Fatalf("expected zero items when busy, got %d", len(items)) + if len(items) == 0 { + t.Fatalf("expected some completion items when triggered") } - if fake.calls != 0 { - t.Fatalf("LLM Chat should not be called when busy; calls=%d", fake.calls) + if fake.calls == 0 { + t.Fatalf("expected LLM Chat to be called") } } diff --git a/internal/lsp/handlers.go b/internal/lsp/handlers.go index f0f73ed..1b7436e 100644 --- a/internal/lsp/handlers.go +++ b/internal/lsp/handlers.go @@ -553,7 +553,7 @@ func (s *Server) detectAndHandleChat(uri string) { continue } pair := raw[j-1 : j+1] - isTrigger := pair == ".." || pair == "??" || pair == "!!" || pair == "::" + isTrigger := pair == "??" || pair == "!!" || pair == "::" if !isTrigger { continue } @@ -690,7 +690,7 @@ func (s *Server) buildChatHistory(uri string, lineIdx int, currentPrompt string) } // stripTrailingTrigger removes a single trailing punctuation from the set -// [.,?,!,:] or both semicolons if present at end, mirroring the inline trigger rules. +// [?,!,:] or both semicolons if present at end, mirroring the inline trigger rules. func stripTrailingTrigger(sx string) string { s := strings.TrimRight(sx, " \t") if strings.HasSuffix(s, ";;") { @@ -699,10 +699,10 @@ func stripTrailingTrigger(sx string) string { if len(s) == 0 { return sx } - last := s[len(s)-1] - switch last { - case '.', '?', '!', ':': - return strings.TrimRight(s[:len(s)-1], " \t") + last := s[len(s)-1] + switch last { + case '?', '!', ':': + return strings.TrimRight(s[:len(s)-1], " \t") default: return sx } diff --git a/internal/version.go b/internal/version.go index 876cbc5..40e4f17 100644 --- a/internal/version.go +++ b/internal/version.go @@ -1,4 +1,4 @@ // Summary: Hexai semantic version identifier used by CLI and LSP binaries. package internal -const Version = "0.2.0" +const Version = "0.2.1" |
