summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-02 14:24:36 +0200
committerPaul Buetow <paul@buetow.org>2026-03-02 14:24:36 +0200
commit4c562f926e13de8d040029e954b7cf407134a8bb (patch)
tree8cba31b3a2e1a537b8df9984fff079b4639e5e07 /internal
parent43456c479fe497ff1c857aadd66556863c81118c (diff)
lsp: use appconfig.CustomAction directly for custom actions (task 411)
Diffstat (limited to 'internal')
-rw-r--r--internal/lsp/handlers_codeaction.go3
-rw-r--r--internal/lsp/server.go27
2 files changed, 4 insertions, 26 deletions
diff --git a/internal/lsp/handlers_codeaction.go b/internal/lsp/handlers_codeaction.go
index 7798f24..58d7134 100644
--- a/internal/lsp/handlers_codeaction.go
+++ b/internal/lsp/handlers_codeaction.go
@@ -9,6 +9,7 @@ import (
"strings"
"time"
+ "codeberg.org/snonux/hexai/internal/appconfig"
"codeberg.org/snonux/hexai/internal/llm"
"codeberg.org/snonux/hexai/internal/logging"
)
@@ -380,7 +381,7 @@ func formatCustomDiagnostics(diagnostics []Diagnostic) string {
return b.String()
}
-func (s *Server) customActionByID(id string) *CustomAction {
+func (s *Server) customActionByID(id string) *appconfig.CustomAction {
for _, item := range s.customActions() {
if item.ID == id {
action := item
diff --git a/internal/lsp/server.go b/internal/lsp/server.go
index bf1f724..573428b 100644
--- a/internal/lsp/server.go
+++ b/internal/lsp/server.go
@@ -85,17 +85,6 @@ type ServerOptions struct {
IgnoreChecker *ignore.Checker
}
-// CustomAction mirrors user-defined code actions passed from config.
-type CustomAction struct {
- ID string
- Title string
- Kind string
- Scope string // "selection" | "diagnostics"
- Instruction string // if set, use rewrite templates
- System string // optional when User is set
- User string // if set, use this user template
-}
-
func NewServer(r io.Reader, w io.Writer, logger *log.Logger, opts ServerOptions) *Server {
ctx, cancel := context.WithCancel(context.Background())
s := &Server{
@@ -401,24 +390,12 @@ func (s *Server) promptSet() appconfig.App {
return s.currentConfig()
}
-func (s *Server) customActions() []CustomAction {
+func (s *Server) customActions() []appconfig.CustomAction {
cfg := s.currentConfig()
if len(cfg.CustomActions) == 0 {
return nil
}
- customs := make([]CustomAction, 0, len(cfg.CustomActions))
- for _, ca := range cfg.CustomActions {
- customs = append(customs, CustomAction{
- ID: ca.ID,
- Title: ca.Title,
- Kind: ca.Kind,
- Scope: ca.Scope,
- Instruction: ca.Instruction,
- System: ca.System,
- User: ca.User,
- })
- }
- return customs
+ return append([]appconfig.CustomAction{}, cfg.CustomActions...)
}
func (s *Server) requestTimeoutContext(timeout time.Duration) (context.Context, context.CancelFunc) {