summaryrefslogtreecommitdiff
path: root/internal/lsp/server.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-09-14 23:40:26 +0300
committerPaul Buetow <paul@buetow.org>2025-09-14 23:40:26 +0300
commitf4470bbcfbe3b14c99baeef475fe872825a13a39 (patch)
treee12fc6168d21119dfff3a0fef5b6c5b54149f3ab /internal/lsp/server.go
parent68438c98d23545ff791768e3e219cd21d3814e0c (diff)
release: v0.10.0v0.10.0
Diffstat (limited to 'internal/lsp/server.go')
-rw-r--r--internal/lsp/server.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/internal/lsp/server.go b/internal/lsp/server.go
index 97d7de7..e3728c8 100644
--- a/internal/lsp/server.go
+++ b/internal/lsp/server.go
@@ -83,6 +83,9 @@ type Server struct {
promptGoTestUser string
promptSimplifySystem string
promptSimplifyUser string
+
+ // Custom actions configured by user
+ customActions []CustomAction
}
// ServerOptions collects configuration for NewServer to avoid long parameter lists.
@@ -125,6 +128,20 @@ type ServerOptions struct {
PromptGoTestUser string
PromptSimplifySystem string
PromptSimplifyUser string
+
+ // Custom actions
+ CustomActions []CustomAction
+}
+
+// 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 {
@@ -209,6 +226,10 @@ func NewServer(r io.Reader, w io.Writer, logger *log.Logger, opts ServerOptions)
s.promptSimplifySystem = opts.PromptSimplifySystem
s.promptSimplifyUser = opts.PromptSimplifyUser
+ if len(opts.CustomActions) > 0 {
+ s.customActions = append([]CustomAction{}, opts.CustomActions...)
+ }
+
// Assign package-level inline trigger chars for free helper functions
if s.inlineOpen != "" {
inlineOpenChar = s.inlineOpen[0]