summaryrefslogtreecommitdiff
path: root/internal/lsp/handlers.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-09-03 15:55:34 +0300
committerPaul Buetow <paul@buetow.org>2025-09-03 15:55:34 +0300
commit71f0d04bd558433cebf1b05845c9fa0e2957eba8 (patch)
tree911a3cab02ecb212cc4221bdd24b46bdbea21fb8 /internal/lsp/handlers.go
parentb089ce13904d225a77ed2a4825fa88366a57442c (diff)
Phase 1: remove single in-flight LLM gate\n\n- Drop llmBusy state and busy 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.
Diffstat (limited to 'internal/lsp/handlers.go')
-rw-r--r--internal/lsp/handlers.go49
1 files changed, 9 insertions, 40 deletions
diff --git a/internal/lsp/handlers.go b/internal/lsp/handlers.go
index 531b454..547be67 100644
--- a/internal/lsp/handlers.go
+++ b/internal/lsp/handlers.go
@@ -184,38 +184,7 @@ func (s *Server) reply(id json.RawMessage, result any, err *RespError) {
// busyCompletionItem builds a visible, non-inserting completion item indicating
// that an LLM request is already in flight.
-func (s *Server) busyCompletionItem() CompletionItem {
- prov := ""
- model := ""
- if s.llmClient != nil {
- prov = s.llmClient.Name()
- model = s.llmClient.DefaultModel()
- }
- label := "Hexai: LLM busy"
- if prov != "" && model != "" {
- label += " (" + prov + ":" + model + ")"
- }
- return CompletionItem{
- Label: label,
- Detail: "Another request is running; only one is allowed concurrently",
- InsertText: "",
- FilterText: "",
- SortText: "~~~~~busy", // float to top
- Documentation: "Hexai is processing a previous request. Please retry shortly.",
- }
-}
-
-func (s *Server) isLLMBusy() bool {
- s.mu.Lock()
- defer s.mu.Unlock()
- return s.llmBusy
-}
-
-func (s *Server) setLLMBusy(v bool) {
- s.mu.Lock()
- s.llmBusy = v
- s.mu.Unlock()
-}
+// removed: previous single in-flight LLM busy gate and busy item
// --- small completion cache (last ~10 entries) ---
@@ -329,14 +298,14 @@ func (s *Server) isTriggerEvent(p CompletionParams, current string) bool {
b, _ := json.Marshal(p.Context)
_ = json.Unmarshal(b, &ctx)
}
- // If the line contains a bare ';;' (no ';;text;'), do not treat as a trigger source.
- if strings.Contains(current, ";;") && !hasDoubleSemicolonTrigger(current) {
- return false
- }
- // TriggerKind 1 = Invoked (manual) — always allow (unless bare ';;' above)
- if ctx.TriggerKind == 1 {
- return true
- }
+ // If the line contains a bare ';;' (no ';;text;'), do not treat as a trigger source.
+ if strings.Contains(current, ";;") && !hasDoubleSemicolonTrigger(current) {
+ return false
+ }
+ // TriggerKind 1 = Invoked (manual). Always allow manual invoke.
+ if ctx.TriggerKind == 1 {
+ return true
+ }
// TriggerKind 2 is TriggerCharacter per LSP spec
if ctx.TriggerKind == 2 {
if ctx.TriggerCharacter != "" {