diff options
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/hexaicli/testhelpers_test.go | 21 | ||||
| -rw-r--r-- | internal/llm/provider_test.go | 8 | ||||
| -rw-r--r-- | internal/lsp/compute_textedit_table_test.go | 6 | ||||
| -rw-r--r-- | internal/lsp/handlers_utils.go | 5 | ||||
| -rw-r--r-- | internal/version.go | 2 |
5 files changed, 5 insertions, 37 deletions
diff --git a/internal/hexaicli/testhelpers_test.go b/internal/hexaicli/testhelpers_test.go index 16f1639..8f6863d 100644 --- a/internal/hexaicli/testhelpers_test.go +++ b/internal/hexaicli/testhelpers_test.go @@ -63,27 +63,6 @@ func (s *fakeStreamer) ChatStream(ctx context.Context, messages []llm.Message, o return nil } -// small TOML writer for tests (string values only) -func writeTOML(t *testing.T, path string, m map[string]string) { - t.Helper() - if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil { - t.Fatalf("mkdir: %v", err) - } - f, err := os.Create(path) - if err != nil { - t.Fatalf("create: %v", err) - } - defer func() { - if err := f.Close(); err != nil { - t.Errorf("failed to close temp TOML file: %v", err) - } - }() - for k, v := range m { - if _, err := f.WriteString(k + " = \"" + v + "\"\n"); err != nil { - t.Fatalf("write: %v", err) - } - } -} func writeConfigString(t *testing.T, path string, contents string) { t.Helper() diff --git a/internal/llm/provider_test.go b/internal/llm/provider_test.go index 2c0d69c..8c5d2cb 100644 --- a/internal/llm/provider_test.go +++ b/internal/llm/provider_test.go @@ -1,7 +1,6 @@ package llm import ( - "context" "testing" ) @@ -20,10 +19,3 @@ func TestNewFromConfig_DefaultsAndErrors(t *testing.T) { } } -type fakeClientMin struct{} - -func (fakeClientMin) Chat(context.Context, []Message, ...RequestOption) (string, error) { - return "", nil -} -func (fakeClientMin) Name() string { return "x" } -func (fakeClientMin) DefaultModel() string { return "m" } diff --git a/internal/lsp/compute_textedit_table_test.go b/internal/lsp/compute_textedit_table_test.go index 6ed5330..b53f9a1 100644 --- a/internal/lsp/compute_textedit_table_test.go +++ b/internal/lsp/compute_textedit_table_test.go @@ -15,16 +15,14 @@ func TestComputeTextEditAndFilter_Table(t *testing.T) { {"params_at_close", true, "func add(a int)", Position{Line: 0, Character: len("func add(a int)")}, "b string"}, } for _, c := range cases { - te, filter := computeTextEditAndFilter(c.cleaned, c.inParams, c.current, CompletionParams{Position: c.pos}) + te, _ := computeTextEditAndFilter(c.cleaned, c.inParams, c.current, CompletionParams{Position: c.pos}) if te == nil { t.Fatalf("%s: expected edit", c.name) } if c.inParams && te.Range.Start.Character == 0 { t.Fatalf("%s: expected param range (non-zero start)", c.name) } - if filter == "" && c.current != "" { - // For ident_replace, filter may be non-empty; for params, it can be empty when replacing entire segment - } + if te.NewText != c.cleaned { t.Fatalf("%s: newText got %q want %q", c.name, te.NewText, c.cleaned) } diff --git a/internal/lsp/handlers_utils.go b/internal/lsp/handlers_utils.go index b3056b9..10cc739 100644 --- a/internal/lsp/handlers_utils.go +++ b/internal/lsp/handlers_utils.go @@ -31,7 +31,6 @@ type requestSpec struct { index int } -func (r requestSpec) modelOverride() string { return strings.TrimSpace(r.entry.Model) } func (r requestSpec) effectiveModel(defaultModel string) string { if m := strings.TrimSpace(r.entry.Model); m != "" { @@ -490,7 +489,7 @@ func stripDuplicateAssignmentPrefix(prefixBeforeCursor, suggestion string) strin } // Fallback to plain '=' if present if idx := strings.LastIndex(prefixBeforeCursor, "="); idx >= 0 { - if !(idx > 0 && prefixBeforeCursor[idx-1] == ':') { // not := + if idx <= 0 || prefixBeforeCursor[idx-1] != ':' { // not := tail := prefixBeforeCursor[idx+1:] if strings.TrimSpace(tail) == "" { start := idx - 1 @@ -534,7 +533,7 @@ func stripDuplicateGeneralPrefix(prefixBeforeCursor, suggestion string) string { } func isIdentBoundary(ch byte) bool { - return !((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || ch == '_') + return !isIdentChar(ch) } // stripCodeFences removes surrounding Markdown code fences from a model response. diff --git a/internal/version.go b/internal/version.go index 052c674..a416c62 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.15.2" +const Version = "0.15.3" |
