summaryrefslogtreecommitdiff
path: root/internal/lsp/triggers_config_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-09-24 23:21:43 +0300
committerPaul Buetow <paul@buetow.org>2025-09-24 23:21:43 +0300
commitc3c71345db9086392cd9b7529c7f5287009c226e (patch)
treed227894ab900d6050cbe1418984526088a692db5 /internal/lsp/triggers_config_test.go
parent127844a4ee481590ef53b6777d34bf2114cb3ab1 (diff)
Add runtime config store and reload command
Diffstat (limited to 'internal/lsp/triggers_config_test.go')
-rw-r--r--internal/lsp/triggers_config_test.go25
1 files changed, 15 insertions, 10 deletions
diff --git a/internal/lsp/triggers_config_test.go b/internal/lsp/triggers_config_test.go
index 0fcbd15..96ac4ba 100644
--- a/internal/lsp/triggers_config_test.go
+++ b/internal/lsp/triggers_config_test.go
@@ -12,8 +12,10 @@ import (
func TestShouldSuppressForChatTriggerEOL_CustomConfig(t *testing.T) {
s := newTestServer()
// Customize: only ")#" at EOL suppresses
- s.chatSuffix = "#"
- s.chatPrefixes = []string{")"}
+ cfg := s.cfg
+ cfg.ChatSuffix = "#"
+ cfg.ChatPrefixes = []string{")"}
+ s.cfg = cfg
p := CompletionParams{TextDocument: TextDocumentIdentifier{URI: "file:///x"}, Position: Position{Line: 0, Character: 6}}
if !s.shouldSuppressForChatTriggerEOL("ok)#", p) {
@@ -29,14 +31,15 @@ func TestNewServer_AssignsTriggerGlobals_AndParsingUsesThem(t *testing.T) {
s := NewServer(bytes.NewReader(nil), &out, log.New(io.Discard, "", 0), ServerOptions{
InlineOpen: "<", InlineClose: ">", ChatSuffix: ")", ChatPrefixes: []string{":"},
})
- _ = s // ensure server constructed applies globals
- if s.inlineOpenChar != '<' || s.inlineCloseChar != '>' {
- t.Fatalf("inline markers not applied: %q %q", string(s.inlineOpenChar), string(s.inlineCloseChar))
+ _, _, openChar, closeChar := s.inlineMarkers()
+ if openChar != '<' || closeChar != '>' {
+ t.Fatalf("inline markers not applied: %q %q", string(openChar), string(closeChar))
}
- if s.chatSuffixChar != ')' || len(s.chatPrefixes) == 0 || s.chatPrefixes[0] != ":" {
- t.Fatalf("chat markers not applied: suffix=%q prefixes=%v", string(s.chatSuffixChar), s.chatPrefixes)
+ _, prefixes, suffixChar := s.chatConfig()
+ if suffixChar != ')' || len(prefixes) == 0 || prefixes[0] != ":" {
+ t.Fatalf("chat markers not applied: suffix=%q prefixes=%v", string(suffixChar), prefixes)
}
- if txt, l, r, ok := findStrictInlineTag("x<do>y", s.inlineOpenChar, s.inlineCloseChar); !ok || txt != "do" || l != 1 || r != 5 {
+ if txt, l, r, ok := findStrictInlineTag("x<do>y", openChar, closeChar); !ok || txt != "do" || l != 1 || r != 5 {
t.Fatalf("findStrictInlineTag failed: ok=%v txt=%q l=%d r=%d", ok, txt, l, r)
}
if got := s.stripTrailingTrigger("note:)"); got != "note:" {
@@ -46,8 +49,10 @@ func TestNewServer_AssignsTriggerGlobals_AndParsingUsesThem(t *testing.T) {
func TestIsTriggerEvent_BareDoubleOpenBlocksEvenWithContextTriggerChar(t *testing.T) {
s := newTestServer()
- s.inlineOpen = ">" // ensure bare ">>" check is active
- s.triggerChars = []string{"."}
+ cfg := s.cfg
+ cfg.InlineOpen = ">"
+ cfg.TriggerCharacters = []string{"."}
+ s.cfg = cfg
// LSP context indicates TriggerCharacter '.' but current line is bare ">>"
ctx := struct {
TriggerKind int `json:"triggerKind"`