summaryrefslogtreecommitdiff
path: root/internal/lsp/handlers.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-09-06 10:25:36 +0300
committerPaul Buetow <paul@buetow.org>2025-09-06 10:25:36 +0300
commit5be9532cfa630f4aacd8d879c3e4f5cc316da0fa (patch)
tree0a901680fccd1e2703ffdbd9284ccff932be1d67 /internal/lsp/handlers.go
parent70f1d0e78c57dfa5beae779b3d392b6e6fa44c14 (diff)
feat(lsp): configurable inline/chat triggers; switch inline markers to >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
Diffstat (limited to 'internal/lsp/handlers.go')
-rw-r--r--internal/lsp/handlers.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/internal/lsp/handlers.go b/internal/lsp/handlers.go
index 547be67..5e7d86d 100644
--- a/internal/lsp/handlers.go
+++ b/internal/lsp/handlers.go
@@ -51,7 +51,7 @@ func findFirstInstructionInLine(line string) (instr string, cleaned string, ok b
text string
}
cands := []cand{}
- if t, l, r, ok := findStrictSemicolonTag(line); ok {
+ if t, l, r, ok := findStrictInlineTag(line); ok {
cands = append(cands, cand{start: l, end: r, text: t})
}
if i := strings.Index(line, "/*"); i >= 0 {
@@ -298,8 +298,9 @@ 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) {
+ // If configured and the line contains a bare double-open marker (e.g., '>>' with no '>>text>'),
+ // do not treat as a trigger source.
+ if s.inlineOpen != "" && strings.Contains(current, s.inlineOpen+s.inlineOpen) && !hasDoubleOpenTrigger(current) {
return false
}
// TriggerKind 1 = Invoked (manual). Always allow manual invoke.
@@ -326,10 +327,10 @@ func (s *Server) isTriggerEvent(p CompletionParams, current string) bool {
if idx <= 0 || idx > len(current) {
return false
}
- // Bare ';;' should not trigger via fallback char either
- if strings.Contains(current, ";;") && !hasDoubleSemicolonTrigger(current) {
- return false
- }
+ // Bare double-open should not trigger via fallback char either (only when configured)
+ if s.inlineOpen != "" && strings.Contains(current, s.inlineOpen+s.inlineOpen) && !hasDoubleOpenTrigger(current) {
+ return false
+ }
ch := string(current[idx-1])
for _, c := range s.triggerChars {
if c == ch {