diff options
Diffstat (limited to 'internal/lsp/server.go')
| -rw-r--r-- | internal/lsp/server.go | 21 |
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] |
