on main help sign in
add initial lsp support
commitcfdd687216799cb5b47f099f1e7cd5dd16b3bdd0 authorKujtim Hoxha <kujtimii.h@gmail.com> dateThu 3 Apr 2025, 15:20 (2 years ago) parentafd9ad0
47 files changed+13991−451
README.md+6 cmd/lsp/main.go+4 cmd/root.go+1 go.mod+4−2 internal/app/services.go+40−2 internal/config/config.go+9 internal/db/messages.sql.go+17−54 internal/db/migrations/000001_initial.up.sql+1−5 internal/db/models.go+6−10 internal/db/sql/messages.sql+3−10 internal/llm/agent/agent-tool.go+1−1 internal/llm/agent/agent.go+32−17 internal/llm/agent/coder.go+8−5 internal/llm/agent/task.go+1−1 internal/llm/prompt/coder.go+21−2 internal/llm/provider/anthropic.go+11−10 internal/llm/provider/gemini.go+110−146 internal/llm/provider/openai.go+8−7 internal/llm/provider/provider.go+4−3 internal/llm/tools/diagnostics.go+229 internal/llm/tools/edit.go+15−6 internal/llm/tools/shell/shell.go+1−1 internal/llm/tools/view.go+17−9 internal/llm/tools/write.go+14−4 internal/llm/tools/write_test.go+39−37 internal/lsp/client.go+429 internal/lsp/handlers.go+104 internal/lsp/language.go+132 internal/lsp/methods.go+554 internal/lsp/protocol.go+48 internal/lsp/protocol/LICENSE+27 internal/lsp/protocol/interface.go+117 internal/lsp/protocol/pattern_interfaces.go+58 internal/lsp/protocol/tables.go+30 internal/lsp/protocol/tsdocument-changes.go+81 internal/lsp/protocol/tsjson.go+3072 internal/lsp/protocol/tsprotocol.go+6907 internal/lsp/protocol/uri.go+218 internal/lsp/transport.go+269 internal/lsp/util/edit.go+239 internal/lsp/watcher/watcher.go+633 internal/message/content.go+244 internal/message/message.go+149−96 internal/tui/components/repl/messages.go+70−15 internal/tui/components/repl/sessions.go−1 internal/tui/styles/icons.go+6−3 main.go+2−4
README.md+6
@@ -91,6 +91,12 @@ go build -o termai
9191./termai
9292```
9393
94+## Acknowledgments
95+
96+TermAI builds upon the work of several open source projects and developers:
97+
98+- [@isaacphi](https://github.com/isaacphi) - LSP client implementation
99+
94100## License
95101
96102[License information coming soon]
cmd/lsp/main.gonew file+4
@@ -0,0 +1,4 @@
1+package main
2+
3+func main() {
4+}
cmd/root.go+1
@@ -36,6 +36,7 @@ var rootCmd = &cobra.Command{
3636 ctx := context.Background()
3737
3838 app := app.New(ctx, conn)
39+ defer app.Close()
3940 app.Logger.Info("Starting termai...")
4041 zone.NewGlobal()
4142 tui := tea.NewProgram(
go.mod+4−2
@@ -1,6 +1,8 @@
11module github.com/kujtimiihoxha/termai
22
3−go 1.23.5
3+go 1.24.0
4+
5+toolchain go1.24.2
46
57require (
68 github.com/anthropics/anthropic-sdk-go v0.2.0-beta.2
@@ -11,6 +13,7 @@ require (
1113 github.com/charmbracelet/glamour v0.9.1
1214 github.com/charmbracelet/huh v0.6.0
1315 github.com/charmbracelet/lipgloss v1.1.0
16+ github.com/fsnotify/fsnotify v1.8.0
1417 github.com/go-logfmt/logfmt v0.6.0
1518 github.com/golang-migrate/migrate/v4 v4.18.2
1619 github.com/google/generative-ai-go v0.19.0
@@ -53,7 +56,6 @@ require (
5356 github.com/dustin/go-humanize v1.0.1 // indirect
5457 github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
5558 github.com/felixge/httpsnoop v1.0.4 // indirect
56− github.com/fsnotify/fsnotify v1.8.0 // indirect
5759 github.com/go-logr/logr v1.4.2 // indirect
5860 github.com/go-logr/stdr v1.2.2 // indirect
5961 github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
internal/app/services.go+40−2
@@ -7,6 +7,8 @@ import (
77 "github.com/kujtimiihoxha/termai/internal/config"
88 "github.com/kujtimiihoxha/termai/internal/db"
99 "github.com/kujtimiihoxha/termai/internal/logging"
10+ "github.com/kujtimiihoxha/termai/internal/lsp"
11+ "github.com/kujtimiihoxha/termai/internal/lsp/watcher"
1012 "github.com/kujtimiihoxha/termai/internal/message"
1113 "github.com/kujtimiihoxha/termai/internal/permission"
1214 "github.com/kujtimiihoxha/termai/internal/session"
@@ -19,23 +21,59 @@ type App struct {
1921 Messages message.Service
2022 Permissions permission.Service
2123
24+ LSPClients map[string]*lsp.Client
25+
2226 Logger logging.Interface
27+
28+ ceanups []func()
2329}
2430
2531func New(ctx context.Context, conn *sql.DB) *App {
32+ cfg := config.Get()
2633 q := db.New(conn)
2734 log := logging.NewLogger(logging.Options{
28− Level: config.Get().Log.Level,
35+ Level: cfg.Log.Level,
2936 })
3037 sessions := session.NewService(ctx, q)
3138 messages := message.NewService(ctx, q)
3239
33− return &App{
40+ app := &App{
3441 Context: ctx,
3542 Sessions: sessions,
3643 Messages: messages,
3744 Permissions: permission.Default,
3845 Logger: log,
46+ LSPClients: make(map[string]*lsp.Client),
47+ }
48+
49+ for name, client := range cfg.LSP {
50+ lspClient, err := lsp.NewClient(client.Command, client.Args...)
51+ app.ceanups = append(app.ceanups, func() {
52+ lspClient.Close()
53+ })
54+ workspaceWatcher := watcher.NewWorkspaceWatcher(lspClient)
55+ if err != nil {
56+ log.Error("Failed to create LSP client for", name, err)
57+ continue
58+ }
59+
60+ _, err = lspClient.InitializeLSPClient(ctx, config.WorkingDirectory())
61+ if err != nil {
62+ log.Error("Initialize failed", "error", err)
63+ continue
64+ }
65+ go workspaceWatcher.WatchWorkspace(ctx, config.WorkingDirectory())
66+ app.LSPClients[name] = lspClient
3967 }
68+ return app
4069}
4170
71+func (a *App) Close() {
72+ for _, cleanup := range a.ceanups {
73+ cleanup()
74+ }
75+ for _, client := range a.LSPClients {
76+ client.Close()
77+ }
78+ a.Logger.Info("App closed")
79+}
internal/config/config.go+9
@@ -49,12 +49,21 @@ type Log struct {
4949 Level string `json:"level"`
5050}
5151
52+type LSPConfig struct {
53+ Disabled bool `json:"enabled"`
54+ Command string `json:"command"`
55+ Args []string `json:"args"`
56+ Options any `json:"options"`
57+}
58+
5259type Config struct {
5360 Data *Data `json:"data,omitempty"`
5461 Log *Log `json:"log,omitempty"`
5562 MCPServers map[string]MCPServer `json:"mcpServers,omitempty"`
5663 Providers map[models.ModelProvider]Provider `json:"providers,omitempty"`
5764
65+ LSP map[string]LSPConfig `json:"lsp,omitempty"`
66+
5867 Model *Model `json:"model,omitempty"`
5968}
6069
internal/db/messages.sql.go+17−54
@@ -7,7 +7,6 @@ package db
77
88import (
99 "context"
10− "database/sql"
1110)
1211
1312const createMessage = `-- name: CreateMessage :one
@@ -15,26 +14,20 @@ INSERT INTO messages (
1514 id,
1615 session_id,
1716 role,
18− finished,
19− content,
20− tool_calls,
21− tool_results,
17+ parts,
2218 created_at,
2319 updated_at
2420) VALUES (
25− ?, ?, ?, ?, ?, ?, ?, strftime('%s', 'now'), strftime('%s', 'now')
21+ ?, ?, ?, ?, strftime('%s', 'now'), strftime('%s', 'now')
2622)
27−RETURNING id, session_id, role, content, thinking, finished, tool_calls, tool_results, created_at, updated_at
23+RETURNING id, session_id, role, parts, created_at, updated_at
2824`
2925
3026type CreateMessageParams struct {
31− ID string `json:"id"`
32− SessionID string `json:"session_id"`
33− Role string `json:"role"`
34− Finished bool `json:"finished"`
35− Content string `json:"content"`
36− ToolCalls sql.NullString `json:"tool_calls"`
37− ToolResults sql.NullString `json:"tool_results"`
27+ ID string `json:"id"`
28+ SessionID string `json:"session_id"`
29+ Role string `json:"role"`
30+ Parts string `json:"parts"`
3831}
3932
4033func (q *Queries) CreateMessage(ctx context.Context, arg CreateMessageParams) (Message, error) {
@@ -42,21 +35,14 @@ func (q *Queries) CreateMessage(ctx context.Context, arg CreateMessageParams) (M
4235 arg.ID,
4336 arg.SessionID,
4437 arg.Role,
45− arg.Finished,
46− arg.Content,
47− arg.ToolCalls,
48− arg.ToolResults,
38+ arg.Parts,
4939 )
5040 var i Message
5141 err := row.Scan(
5242 &i.ID,
5343 &i.SessionID,
5444 &i.Role,
55− &i.Content,
56− &i.Thinking,
57− &i.Finished,
58− &i.ToolCalls,
59− &i.ToolResults,
45+ &i.Parts,
6046 &i.CreatedAt,
6147 &i.UpdatedAt,
6248 )
@@ -84,7 +70,7 @@ func (q *Queries) DeleteSessionMessages(ctx context.Context, sessionID string) e
8470}
8571
8672const getMessage = `-- name: GetMessage :one
87−SELECT id, session_id, role, content, thinking, finished, tool_calls, tool_results, created_at, updated_at
73+SELECT id, session_id, role, parts, created_at, updated_at
8874FROM messages
8975WHERE id = ? LIMIT 1
9076`
@@ -96,11 +82,7 @@ func (q *Queries) GetMessage(ctx context.Context, id string) (Message, error) {
9682 &i.ID,
9783 &i.SessionID,
9884 &i.Role,
99− &i.Content,
100− &i.Thinking,
101− &i.Finished,
102− &i.ToolCalls,
103− &i.ToolResults,
85+ &i.Parts,
10486 &i.CreatedAt,
10587 &i.UpdatedAt,
10688 )
@@ -108,7 +90,7 @@ func (q *Queries) GetMessage(ctx context.Context, id string) (Message, error) {
10890}
10991
11092const listMessagesBySession = `-- name: ListMessagesBySession :many
111−SELECT id, session_id, role, content, thinking, finished, tool_calls, tool_results, created_at, updated_at
93+SELECT id, session_id, role, parts, created_at, updated_at
11294FROM messages
11395WHERE session_id = ?
11496ORDER BY created_at ASC
@@ -127,11 +109,7 @@ func (q *Queries) ListMessagesBySession(ctx context.Context, sessionID string) (
127109 &i.ID,
128110 &i.SessionID,
129111 &i.Role,
130− &i.Content,
131− &i.Thinking,
132− &i.Finished,
133− &i.ToolCalls,
134− &i.ToolResults,
112+ &i.Parts,
135113 &i.CreatedAt,
136114 &i.UpdatedAt,
137115 ); err != nil {
@@ -151,32 +129,17 @@ func (q *Queries) ListMessagesBySession(ctx context.Context, sessionID string) (
151129const updateMessage = `-- name: UpdateMessage :exec
152130UPDATE messages
153131SET
154− content = ?,
155− thinking = ?,
156− tool_calls = ?,
157− tool_results = ?,
158− finished = ?,
132+ parts = ?,
159133 updated_at = strftime('%s', 'now')
160134WHERE id = ?
161135`
162136
163137type UpdateMessageParams struct {
164− Content string `json:"content"`
165− Thinking string `json:"thinking"`
166− ToolCalls sql.NullString `json:"tool_calls"`
167− ToolResults sql.NullString `json:"tool_results"`
168− Finished bool `json:"finished"`
169− ID string `json:"id"`
138+ Parts string `json:"parts"`
139+ ID string `json:"id"`
170140}
171141
172142func (q *Queries) UpdateMessage(ctx context.Context, arg UpdateMessageParams) error {
173− _, err := q.exec(ctx, q.updateMessageStmt, updateMessage,
174− arg.Content,
175− arg.Thinking,
176− arg.ToolCalls,
177− arg.ToolResults,
178− arg.Finished,
179− arg.ID,
180− )
143+ _, err := q.exec(ctx, q.updateMessageStmt, updateMessage, arg.Parts, arg.ID)
181144 return err
182145}
internal/db/migrations/000001_initial.up.sql+1−5
@@ -23,11 +23,7 @@ CREATE TABLE IF NOT EXISTS messages (
2323 id TEXT PRIMARY KEY,
2424 session_id TEXT NOT NULL,
2525 role TEXT NOT NULL,
26− content TEXT NOT NULL,
27− thinking Text NOT NULL DEFAULT '',
28− finished BOOLEAN NOT NULL DEFAULT 0,
29− tool_calls TEXT,
30− tool_results TEXT,
26+ parts TEXT NOT NULL default '[]',
3127 created_at INTEGER NOT NULL, -- Unix timestamp in milliseconds
3228 updated_at INTEGER NOT NULL, -- Unix timestamp in milliseconds
3329 FOREIGN KEY (session_id) REFERENCES sessions (id) ON DELETE CASCADE
internal/db/models.go+6−10
@@ -9,16 +9,12 @@ import (
99)
1010
1111type Message struct {
12− ID string `json:"id"`
13− SessionID string `json:"session_id"`
14− Role string `json:"role"`
15− Content string `json:"content"`
16− Thinking string `json:"thinking"`
17− Finished bool `json:"finished"`
18− ToolCalls sql.NullString `json:"tool_calls"`
19− ToolResults sql.NullString `json:"tool_results"`
20− CreatedAt int64 `json:"created_at"`
21− UpdatedAt int64 `json:"updated_at"`
12+ ID string `json:"id"`
13+ SessionID string `json:"session_id"`
14+ Role string `json:"role"`
15+ Parts string `json:"parts"`
16+ CreatedAt int64 `json:"created_at"`
17+ UpdatedAt int64 `json:"updated_at"`
2218}
2319
2420type Session struct {
internal/db/sql/messages.sql+3−10
@@ -14,25 +14,18 @@ INSERT INTO messages (
1414 id,
1515 session_id,
1616 role,
17− finished,
18− content,
19− tool_calls,
20− tool_results,
17+ parts,
2118 created_at,
2219 updated_at
2320) VALUES (
24− ?, ?, ?, ?, ?, ?, ?, strftime('%s', 'now'), strftime('%s', 'now')
21+ ?, ?, ?, ?, strftime('%s', 'now'), strftime('%s', 'now')
2522)
2623RETURNING *;
2724
2825-- name: UpdateMessage :exec
2926UPDATE messages
3027SET
31− content = ?,
32− thinking = ?,
33− tool_calls = ?,
34− tool_results = ?,
35− finished = ?,
28+ parts = ?,
3629 updated_at = strftime('%s', 'now')
3730WHERE id = ?;
3831
internal/llm/agent/agent-tool.go+1−1
@@ -91,7 +91,7 @@ func (b *agentTool) Run(ctx context.Context, call tools.ToolCall) (tools.ToolRes
9191 if err != nil {
9292 return tools.NewTextErrorResponse(fmt.Sprintf("error: %s", err)), nil
9393 }
94− return tools.NewTextResponse(response.Content), nil
94+ return tools.NewTextResponse(response.Content().String()), nil
9595}
9696
9797func NewAgentTool(parentSessionID string, app *app.App) tools.BaseTool {
internal/llm/agent/agent.go+32−17
@@ -5,6 +5,7 @@ import (
55 "errors"
66 "fmt"
77 "log"
8+ "strings"
89 "sync"
910
1011 "github.com/kujtimiihoxha/termai/internal/app"
@@ -33,8 +34,12 @@ func (c *agent) handleTitleGeneration(sessionID, content string) {
3334 c.Context,
3435 []message.Message{
3536 {
36− Role: message.User,
37− Content: content,
37+ Role: message.User,
38+ Parts: []message.ContentPart{
39+ message.TextContent{
40+ Text: content,
41+ },
42+ },
3843 },
3944 },
4045 nil,
@@ -49,6 +54,8 @@ func (c *agent) handleTitleGeneration(sessionID, content string) {
4954 }
5055 if response.Content != "" {
5156 session.Title = response.Content
57+ session.Title = strings.TrimSpace(session.Title)
58+ session.Title = strings.ReplaceAll(session.Title, "\n", " ")
5259 c.Sessions.Save(session)
5360 }
5461}
@@ -79,17 +86,18 @@ func (c *agent) processEvent(
7986) error {
8087 switch event.Type {
8188 case provider.EventThinkingDelta:
82− assistantMsg.Thinking += event.Thinking
89+ assistantMsg.AppendReasoningContent(event.Content)
8390 return c.Messages.Update(*assistantMsg)
8491 case provider.EventContentDelta:
85− assistantMsg.Content += event.Content
92+ assistantMsg.AppendContent(event.Content)
8693 return c.Messages.Update(*assistantMsg)
8794 case provider.EventError:
8895 log.Println("error", event.Error)
8996 return event.Error
9097
9198 case provider.EventComplete:
92− assistantMsg.ToolCalls = event.Response.ToolCalls
99+ assistantMsg.SetToolCalls(event.Response.ToolCalls)
100+ assistantMsg.AddFinish(event.Response.FinishReason)
93101 err := c.Messages.Update(*assistantMsg)
94102 if err != nil {
95103 return err
@@ -157,18 +165,21 @@ func (c *agent) handleToolExecution(
157165 ctx context.Context,
158166 assistantMsg message.Message,
159167) (*message.Message, error) {
160− if len(assistantMsg.ToolCalls) == 0 {
168+ if len(assistantMsg.ToolCalls()) == 0 {
161169 return nil, nil
162170 }
163171
164− toolResults, err := c.ExecuteTools(ctx, assistantMsg.ToolCalls, c.tools)
172+ toolResults, err := c.ExecuteTools(ctx, assistantMsg.ToolCalls(), c.tools)
165173 if err != nil {
166174 return nil, err
167175 }
168−
176+ parts := make([]message.ContentPart, 0)
177+ for _, toolResult := range toolResults {
178+ parts = append(parts, toolResult)
179+ }
169180 msg, err := c.Messages.Create(assistantMsg.SessionID, message.CreateMessageParams{
170− Role: message.Tool,
171− ToolResults: toolResults,
181+ Role: message.Tool,
182+ Parts: parts,
172183 })
173184
174185 return &msg, err
@@ -185,8 +196,12 @@ func (c *agent) generate(sessionID string, content string) error {
185196 }
186197
187198 userMsg, err := c.Messages.Create(sessionID, message.CreateMessageParams{
188− Role: message.User,
189− Content: content,
199+ Role: message.User,
200+ Parts: []message.ContentPart{
201+ message.TextContent{
202+ Text: content,
203+ },
204+ },
190205 })
191206 if err != nil {
192207 return err
@@ -201,8 +216,8 @@ func (c *agent) generate(sessionID string, content string) error {
201216 }
202217
203218 assistantMsg, err := c.Messages.Create(sessionID, message.CreateMessageParams{
204− Role: message.Assistant,
205− Content: "",
219+ Role: message.Assistant,
220+ Parts: []message.ContentPart{},
206221 })
207222 if err != nil {
208223 return err
@@ -210,20 +225,20 @@ func (c *agent) generate(sessionID string, content string) error {
210225 for event := range eventChan {
211226 err = c.processEvent(sessionID, &assistantMsg, event)
212227 if err != nil {
213− assistantMsg.Finished = true
228+ assistantMsg.AddFinish("error:" + err.Error())
214229 c.Messages.Update(assistantMsg)
215230 return err
216231 }
217232 }
218233
219234 msg, err := c.handleToolExecution(c.Context, assistantMsg)
220− assistantMsg.Finished = true
235+
221236 c.Messages.Update(assistantMsg)
222237 if err != nil {
223238 return err
224239 }
225240
226− if len(assistantMsg.ToolCalls) == 0 {
241+ if len(assistantMsg.ToolCalls()) == 0 {
227242 break
228243 }
229244
internal/llm/agent/coder.go+8−5
@@ -44,20 +44,23 @@ func NewCoderAgent(app *app.App) (Agent, error) {
4444 return nil, err
4545 }
4646
47− mcpTools := GetMcpTools(app.Context)
47+ otherTools := GetMcpTools(app.Context)
48+ if len(app.LSPClients) > 0 {
49+ otherTools = append(otherTools, tools.NewDiagnosticsTool(app.LSPClients))
50+ }
4851 return &coderAgent{
4952 agent: &agent{
5053 App: app,
5154 tools: append(
5255 []tools.BaseTool{
5356 tools.NewBashTool(),
54− tools.NewEditTool(),
57+ tools.NewEditTool(app.LSPClients),
5558 tools.NewGlobTool(),
5659 tools.NewGrepTool(),
5760 tools.NewLsTool(),
58− tools.NewViewTool(),
59− tools.NewWriteTool(),
60− }, mcpTools...,
61+ tools.NewViewTool(app.LSPClients),
62+ tools.NewWriteTool(app.LSPClients),
63+ }, otherTools...,
6164 ),
6265 model: model,
6366 agent: agentProvider,
internal/llm/agent/task.go+1−1
@@ -34,7 +34,7 @@ func NewTaskAgent(app *app.App) (Agent, error) {
3434 tools.NewGlobTool(),
3535 tools.NewGrepTool(),
3636 tools.NewLsTool(),
37− tools.NewViewTool(),
37+ tools.NewViewTool(app.LSPClients),
3838 },
3939 model: model,
4040 agent: agentProvider,
internal/llm/prompt/coder.go+21−2
@@ -67,7 +67,7 @@ Never commit changes unless the user explicitly asks you to.`
6767
6868 envInfo := getEnvironmentInfo()
6969
70− return fmt.Sprintf("%s\n\n%s", basePrompt, envInfo)
70+ return fmt.Sprintf("%s\n\n%s\n%s", basePrompt, envInfo, lspInformation())
7171}
7272
7373func CoderAnthropicSystemPrompt() string {
@@ -168,7 +168,7 @@ You MUST answer concisely with fewer than 4 lines of text (not including tool us
168168
169169 envInfo := getEnvironmentInfo()
170170
171− return fmt.Sprintf("%s\n\n%s", basePrompt, envInfo)
171+ return fmt.Sprintf("%s\n\n%s\n%s", basePrompt, envInfo, lspInformation())
172172}
173173
174174func getEnvironmentInfo() string {
@@ -198,6 +198,25 @@ func isGitRepo(dir string) bool {
198198 return err == nil
199199}
200200
201+func lspInformation() string {
202+ cfg := config.Get()
203+ hasLSP := false
204+ for _, v := range cfg.LSP {
205+ if !v.Disabled {
206+ hasLSP = true
207+ break
208+ }
209+ }
210+ if !hasLSP {
211+ return ""
212+ }
213+ return `# LSP Information
214+Tools that support it will also include useful diagnostics such as linting and typechecking.
215+These diagnostics will be automatically enabled when you run the tool, and will be displayed in the output at the bottom within the <file_diagnostics></file_diagnostics> and <project_diagnostics></project_diagnostics> tags.
216+Take necessary actions to fix the issues.
217+`
218+}
219+
201220func boolToYesNo(b bool) string {
202221 if b {
203222 return "Yes"
internal/llm/provider/anthropic.go+11−10
@@ -111,7 +111,7 @@ func (a *anthropicProvider) StreamResponse(ctx context.Context, messages []messa
111111 var thinkingParam anthropic.ThinkingConfigParamUnion
112112 lastMessage := messages[len(messages)-1]
113113 temperature := anthropic.Float(0)
114− if lastMessage.Role == message.User && strings.Contains(strings.ToLower(lastMessage.Content), "think") {
114+ if lastMessage.Role == message.User && strings.Contains(strings.ToLower(lastMessage.Content().String()), "think") {
115115 thinkingParam = anthropic.ThinkingConfigParamUnion{
116116 OfThinkingConfigEnabled: &anthropic.ThinkingConfigEnabledParam{
117117 BudgetTokens: int64(float64(a.maxTokens) * 0.8),
@@ -187,9 +187,10 @@ func (a *anthropicProvider) StreamResponse(ctx context.Context, messages []messa
187187 eventChan <- ProviderEvent{
188188 Type: EventComplete,
189189 Response: &ProviderResponse{
190− Content: content,
191− ToolCalls: toolCalls,
192− Usage: tokenUsage,
190+ Content: content,
191+ ToolCalls: toolCalls,
192+ Usage: tokenUsage,
193+ FinishReason: string(accumulatedMessage.StopReason),
193194 },
194195 }
195196 }
@@ -263,7 +264,7 @@ func (a *anthropicProvider) convertToAnthropicMessages(messages []message.Messag
263264 for i, msg := range messages {
264265 switch msg.Role {
265266 case message.User:
266− content := anthropic.NewTextBlock(msg.Content)
267+ content := anthropic.NewTextBlock(msg.Content().String())
267268 if cachedBlocks < 2 {
268269 content.OfRequestTextBlock.CacheControl = anthropic.CacheControlEphemeralParam{
269270 Type: "ephemeral",
@@ -274,8 +275,8 @@ func (a *anthropicProvider) convertToAnthropicMessages(messages []message.Messag
274275
275276 case message.Assistant:
276277 blocks := []anthropic.ContentBlockParamUnion{}
277− if msg.Content != "" {
278− content := anthropic.NewTextBlock(msg.Content)
278+ if msg.Content().String() != "" {
279+ content := anthropic.NewTextBlock(msg.Content().String())
279280 if cachedBlocks < 2 {
280281 content.OfRequestTextBlock.CacheControl = anthropic.CacheControlEphemeralParam{
281282 Type: "ephemeral",
@@ -285,7 +286,7 @@ func (a *anthropicProvider) convertToAnthropicMessages(messages []message.Messag
285286 blocks = append(blocks, content)
286287 }
287288
288− for _, toolCall := range msg.ToolCalls {
289+ for _, toolCall := range msg.ToolCalls() {
289290 var inputMap map[string]any
290291 err := json.Unmarshal([]byte(toolCall.Input), &inputMap)
291292 if err != nil {
@@ -297,8 +298,8 @@ func (a *anthropicProvider) convertToAnthropicMessages(messages []message.Messag
297298 anthropicMessages[i] = anthropic.NewAssistantMessage(blocks...)
298299
299300 case message.Tool:
300− results := make([]anthropic.ContentBlockParamUnion, len(msg.ToolResults))
301− for i, toolResult := range msg.ToolResults {
301+ results := make([]anthropic.ContentBlockParamUnion, len(msg.ToolResults()))
302+ for i, toolResult := range msg.ToolResults() {
302303 results[i] = anthropic.NewToolResultBlock(toolResult.ToolCallID, toolResult.Content, toolResult.IsError)
303304 }
304305 anthropicMessages[i] = anthropic.NewUserMessage(results...)
internal/llm/provider/gemini.go+110−146
@@ -78,7 +78,6 @@ func (p *geminiProvider) Close() {
7878 }
7979}
8080
81−// convertToGeminiHistory converts the message history to Gemini's format
8281func (p *geminiProvider) convertToGeminiHistory(messages []message.Message) []*genai.Content {
8382 var history []*genai.Content
8483
@@ -86,7 +85,7 @@ func (p *geminiProvider) convertToGeminiHistory(messages []message.Message) []*g
8685 switch msg.Role {
8786 case message.User:
8887 history = append(history, &genai.Content{
89− Parts: []genai.Part{genai.Text(msg.Content)},
88+ Parts: []genai.Part{genai.Text(msg.Content().String())},
9089 Role: "user",
9190 })
9291 case message.Assistant:
@@ -95,14 +94,12 @@ func (p *geminiProvider) convertToGeminiHistory(messages []message.Message) []*g
9594 Parts: []genai.Part{},
9695 }
9796
98− // Handle regular content
99− if msg.Content != "" {
100− content.Parts = append(content.Parts, genai.Text(msg.Content))
97+ if msg.Content().String() != "" {
98+ content.Parts = append(content.Parts, genai.Text(msg.Content().String()))
10199 }
102100
103− // Handle tool calls if any
104− if len(msg.ToolCalls) > 0 {
105− for _, call := range msg.ToolCalls {
101+ if len(msg.ToolCalls()) > 0 {
102+ for _, call := range msg.ToolCalls() {
106103 args, _ := parseJsonToMap(call.Input)
107104 content.Parts = append(content.Parts, genai.FunctionCall{
108105 Name: call.Name,
@@ -113,8 +110,7 @@ func (p *geminiProvider) convertToGeminiHistory(messages []message.Message) []*g
113110
114111 history = append(history, content)
115112 case message.Tool:
116− for _, result := range msg.ToolResults {
117− // Parse response content to map if possible
113+ for _, result := range msg.ToolResults() {
118114 response := map[string]interface{}{"result": result.Content}
119115 parsed, err := parseJsonToMap(result.Content)
120116 if err == nil {
@@ -123,7 +119,7 @@ func (p *geminiProvider) convertToGeminiHistory(messages []message.Message) []*g
123119 var toolCall message.ToolCall
124120 for _, msg := range messages {
125121 if msg.Role == message.Assistant {
126− for _, call := range msg.ToolCalls {
122+ for _, call := range msg.ToolCalls() {
127123 if call.ID == result.ToolCallID {
128124 toolCall = call
129125 break
@@ -146,108 +142,6 @@ func (p *geminiProvider) convertToGeminiHistory(messages []message.Message) []*g
146142 return history
147143}
148144
149−// convertToolsToGeminiFunctionDeclarations converts tool definitions to Gemini's function declarations
150−func (p *geminiProvider) convertToolsToGeminiFunctionDeclarations(tools []tools.BaseTool) []*genai.FunctionDeclaration {
151− declarations := make([]*genai.FunctionDeclaration, len(tools))
152−
153− for i, tool := range tools {
154− info := tool.Info()
155−
156− // Convert parameters to genai.Schema format
157− properties := make(map[string]*genai.Schema)
158− for name, param := range info.Parameters {
159− // Try to extract type and description from the parameter
160− paramMap, ok := param.(map[string]interface{})
161− if !ok {
162− // Default to string if unable to determine type
163− properties[name] = &genai.Schema{Type: genai.TypeString}
164− continue
165− }
166−
167− schemaType := genai.TypeString // Default
168− var description string
169− var itemsTypeSchema *genai.Schema
170− if typeVal, found := paramMap["type"]; found {
171− if typeStr, ok := typeVal.(string); ok {
172− switch typeStr {
173− case "string":
174− schemaType = genai.TypeString
175− case "number":
176− schemaType = genai.TypeNumber
177− case "integer":
178− schemaType = genai.TypeInteger
179− case "boolean":
180− schemaType = genai.TypeBoolean
181− case "array":
182− schemaType = genai.TypeArray
183− items, found := paramMap["items"]
184− if found {
185− itemsMap, ok := items.(map[string]interface{})
186− if ok {
187− itemsType, found := itemsMap["type"]
188− if found {
189− itemsTypeStr, ok := itemsType.(string)
190− if ok {
191− switch itemsTypeStr {
192− case "string":
193− itemsTypeSchema = &genai.Schema{
194− Type: genai.TypeString,
195− }
196− case "number":
197− itemsTypeSchema = &genai.Schema{
198− Type: genai.TypeNumber,
199− }
200− case "integer":
201− itemsTypeSchema = &genai.Schema{
202− Type: genai.TypeInteger,
203− }
204− case "boolean":
205− itemsTypeSchema = &genai.Schema{
206− Type: genai.TypeBoolean,
207− }
208− }
209− }
210− }
211− }
212− }
213− case "object":
214− schemaType = genai.TypeObject
215− if _, found := paramMap["properties"]; !found {
216− continue
217− }
218− // TODO: Add support for other types
219− }
220− }
221− }
222−
223− if desc, found := paramMap["description"]; found {
224− if descStr, ok := desc.(string); ok {
225− description = descStr
226− }
227− }
228−
229− properties[name] = &genai.Schema{
230− Type: schemaType,
231− Description: description,
232− Items: itemsTypeSchema,
233− }
234− }
235−
236− declarations[i] = &genai.FunctionDeclaration{
237− Name: info.Name,
238− Description: info.Description,
239− Parameters: &genai.Schema{
240− Type: genai.TypeObject,
241− Properties: properties,
242− Required: info.Required,
243− },
244− }
245− }
246−
247− return declarations
248−}
249−
250−// extractTokenUsage extracts token usage information from Gemini's response
251145func (p *geminiProvider) extractTokenUsage(resp *genai.GenerateContentResponse) TokenUsage {
252146 if resp == nil || resp.UsageMetadata == nil {
253147 return TokenUsage{}
@@ -261,41 +155,28 @@ func (p *geminiProvider) extractTokenUsage(resp *genai.GenerateContentResponse)
261155 }
262156}
263157
264−// SendMessages sends a batch of messages to Gemini and returns the response
265158func (p *geminiProvider) SendMessages(ctx context.Context, messages []message.Message, tools []tools.BaseTool) (*ProviderResponse, error) {
266− // Create a generative model
267159 model := p.client.GenerativeModel(p.model.APIModel)
268160 model.SetMaxOutputTokens(p.maxTokens)
269161
270− // Set system instruction
271162 model.SystemInstruction = genai.NewUserContent(genai.Text(p.systemMessage))
272163
273− // Set up tools if provided
274164 if len(tools) > 0 {
275165 declarations := p.convertToolsToGeminiFunctionDeclarations(tools)
276− model.Tools = []*genai.Tool{{FunctionDeclarations: declarations}}
166+ for _, declaration := range declarations {
167+ model.Tools = append(model.Tools, &genai.Tool{FunctionDeclarations: []*genai.FunctionDeclaration{declaration}})
168+ }
277169 }
278170
279− // Create chat session and set history
280171 chat := model.StartChat()
281172 chat.History = p.convertToGeminiHistory(messages[:len(messages)-1]) // Exclude last message
282173
283− // Get the most recent user message
284− var lastUserMsg message.Message
285− for i := len(messages) - 1; i >= 0; i-- {
286− if messages[i].Role == message.User {
287− lastUserMsg = messages[i]
288− break
289− }
290− }
291−
292− // Send the message
293− resp, err := chat.SendMessage(ctx, genai.Text(lastUserMsg.Content))
174+ lastUserMsg := messages[len(messages)-1]
175+ resp, err := chat.SendMessage(ctx, genai.Text(lastUserMsg.Content().String()))
294176 if err != nil {
295177 return nil, err
296178 }
297179
298− // Process the response
299180 var content string
300181 var toolCalls []message.ToolCall
301182
@@ -317,7 +198,6 @@ func (p *geminiProvider) SendMessages(ctx context.Context, messages []message.Me
317198 }
318199 }
319200
320− // Extract token usage
321201 tokenUsage := p.extractTokenUsage(resp)
322202
323203 return &ProviderResponse{
@@ -327,16 +207,12 @@ func (p *geminiProvider) SendMessages(ctx context.Context, messages []message.Me
327207 }, nil
328208}
329209
330−// StreamResponse streams the response from Gemini
331210func (p *geminiProvider) StreamResponse(ctx context.Context, messages []message.Message, tools []tools.BaseTool) (<-chan ProviderEvent, error) {
332− // Create a generative model
333211 model := p.client.GenerativeModel(p.model.APIModel)
334212 model.SetMaxOutputTokens(p.maxTokens)
335213
336− // Set system instruction
337214 model.SystemInstruction = genai.NewUserContent(genai.Text(p.systemMessage))
338215
339− // Set up tools if provided
340216 if len(tools) > 0 {
341217 declarations := p.convertToolsToGeminiFunctionDeclarations(tools)
342218 for _, declaration := range declarations {
@@ -344,14 +220,12 @@ func (p *geminiProvider) StreamResponse(ctx context.Context, messages []message.
344220 }
345221 }
346222
347− // Create chat session and set history
348223 chat := model.StartChat()
349224 chat.History = p.convertToGeminiHistory(messages[:len(messages)-1]) // Exclude last message
350225
351226 lastUserMsg := messages[len(messages)-1]
352227
353− // Start streaming
354− iter := chat.SendMessageStream(ctx, genai.Text(lastUserMsg.Content))
228+ iter := chat.SendMessageStream(ctx, genai.Text(lastUserMsg.Content().String()))
355229
356230 eventChan := make(chan ProviderEvent)
357231
@@ -392,7 +266,6 @@ func (p *geminiProvider) StreamResponse(ctx context.Context, messages []message.
392266 }
393267 currentContent += newText
394268 case genai.FunctionCall:
395− // For function calls, we assume they come complete, not streamed in parts
396269 id := "call_" + uuid.New().String()
397270 args, _ := json.Marshal(p.Args)
398271 newCall := message.ToolCall{
@@ -402,7 +275,6 @@ func (p *geminiProvider) StreamResponse(ctx context.Context, messages []message.
402275 Type: "function",
403276 }
404277
405− // Check if this is a new tool call
406278 isNew := true
407279 for _, existing := range toolCalls {
408280 if existing.Name == newCall.Name && existing.Input == newCall.Input {
@@ -419,15 +291,15 @@ func (p *geminiProvider) StreamResponse(ctx context.Context, messages []message.
419291 }
420292 }
421293
422− // Extract token usage from the final response
423294 tokenUsage := p.extractTokenUsage(finalResp)
424295
425296 eventChan <- ProviderEvent{
426297 Type: EventComplete,
427298 Response: &ProviderResponse{
428− Content: currentContent,
429− ToolCalls: toolCalls,
430− Usage: tokenUsage,
299+ Content: currentContent,
300+ ToolCalls: toolCalls,
301+ Usage: tokenUsage,
302+ FinishReason: string(finalResp.Candidates[0].FinishReason.String()),
431303 },
432304 }
433305 }()
@@ -435,7 +307,99 @@ func (p *geminiProvider) StreamResponse(ctx context.Context, messages []message.
435307 return eventChan, nil
436308}
437309
438−// Helper function to parse JSON string into map
310+func (p *geminiProvider) convertToolsToGeminiFunctionDeclarations(tools []tools.BaseTool) []*genai.FunctionDeclaration {
311+ declarations := make([]*genai.FunctionDeclaration, len(tools))
312+
313+ for i, tool := range tools {
314+ info := tool.Info()
315+ declarations[i] = &genai.FunctionDeclaration{
316+ Name: info.Name,
317+ Description: info.Description,
318+ Parameters: &genai.Schema{
319+ Type: genai.TypeObject,
320+ Properties: convertSchemaProperties(info.Parameters),
321+ Required: info.Required,
322+ },
323+ }
324+ }
325+
326+ return declarations
327+}
328+
329+func convertSchemaProperties(parameters map[string]interface{}) map[string]*genai.Schema {
330+ properties := make(map[string]*genai.Schema)
331+
332+ for name, param := range parameters {
333+ properties[name] = convertToSchema(param)
334+ }
335+
336+ return properties
337+}
338+
339+func convertToSchema(param interface{}) *genai.Schema {
340+ schema := &genai.Schema{Type: genai.TypeString}
341+
342+ paramMap, ok := param.(map[string]interface{})
343+ if !ok {
344+ return schema
345+ }
346+
347+ if desc, ok := paramMap["description"].(string); ok {
348+ schema.Description = desc
349+ }
350+
351+ typeVal, hasType := paramMap["type"]
352+ if !hasType {
353+ return schema
354+ }
355+
356+ typeStr, ok := typeVal.(string)
357+ if !ok {
358+ return schema
359+ }
360+
361+ schema.Type = mapJSONTypeToGenAI(typeStr)
362+
363+ switch typeStr {
364+ case "array":
365+ schema.Items = processArrayItems(paramMap)
366+ case "object":
367+ if props, ok := paramMap["properties"].(map[string]interface{}); ok {
368+ schema.Properties = convertSchemaProperties(props)
369+ }
370+ }
371+
372+ return schema
373+}
374+
375+func processArrayItems(paramMap map[string]interface{}) *genai.Schema {
376+ items, ok := paramMap["items"].(map[string]interface{})
377+ if !ok {
378+ return nil
379+ }
380+
381+ return convertToSchema(items)
382+}
383+
384+func mapJSONTypeToGenAI(jsonType string) genai.Type {
385+ switch jsonType {
386+ case "string":
387+ return genai.TypeString
388+ case "number":
389+ return genai.TypeNumber
390+ case "integer":
391+ return genai.TypeInteger
392+ case "boolean":
393+ return genai.TypeBoolean
394+ case "array":
395+ return genai.TypeArray
396+ case "object":
397+ return genai.TypeObject
398+ default:
399+ return genai.TypeString // Default to string for unknown types
400+ }
401+}
402+
439403func parseJsonToMap(jsonStr string) (map[string]interface{}, error) {
440404 var result map[string]interface{}
441405 err := json.Unmarshal([]byte(jsonStr), &result)
internal/llm/provider/openai.go+8−7
@@ -84,22 +84,22 @@ func (p *openaiProvider) convertToOpenAIMessages(messages []message.Message) []o
8484 for _, msg := range messages {
8585 switch msg.Role {
8686 case message.User:
87− chatMessages = append(chatMessages, openai.UserMessage(msg.Content))
87+ chatMessages = append(chatMessages, openai.UserMessage(msg.Content().String()))
8888
8989 case message.Assistant:
9090 assistantMsg := openai.ChatCompletionAssistantMessageParam{
9191 Role: "assistant",
9292 }
9393
94− if msg.Content != "" {
94+ if msg.Content().String() != "" {
9595 assistantMsg.Content = openai.ChatCompletionAssistantMessageParamContentUnion{
96− OfString: openai.String(msg.Content),
96+ OfString: openai.String(msg.Content().String()),
9797 }
9898 }
9999
100− if len(msg.ToolCalls) > 0 {
101− assistantMsg.ToolCalls = make([]openai.ChatCompletionMessageToolCallParam, len(msg.ToolCalls))
102− for i, call := range msg.ToolCalls {
100+ if len(msg.ToolCalls()) > 0 {
101+ assistantMsg.ToolCalls = make([]openai.ChatCompletionMessageToolCallParam, len(msg.ToolCalls()))
102+ for i, call := range msg.ToolCalls() {
103103 assistantMsg.ToolCalls[i] = openai.ChatCompletionMessageToolCallParam{
104104 ID: call.ID,
105105 Type: "function",
@@ -116,7 +116,7 @@ func (p *openaiProvider) convertToOpenAIMessages(messages []message.Message) []o
116116 })
117117
118118 case message.Tool:
119− for _, result := range msg.ToolResults {
119+ for _, result := range msg.ToolResults() {
120120 chatMessages = append(chatMessages,
121121 openai.ToolMessage(result.Content, result.ToolCallID),
122122 )
@@ -276,3 +276,4 @@ func (p *openaiProvider) StreamResponse(ctx context.Context, messages []message.
276276
277277 return eventChan, nil
278278}
279+
internal/llm/provider/provider.go+4−3
@@ -27,9 +27,10 @@ type TokenUsage struct {
2727}
2828
2929type ProviderResponse struct {
30− Content string
31− ToolCalls []message.ToolCall
32− Usage TokenUsage
30+ Content string
31+ ToolCalls []message.ToolCall
32+ Usage TokenUsage
33+ FinishReason string
3334}
3435
3536type ProviderEvent struct {
internal/llm/tools/diagnostics.gonew file+229
@@ -0,0 +1,229 @@
1+package tools
2+
3+import (
4+ "context"
5+ "encoding/json"
6+ "fmt"
7+ "sort"
8+ "strings"
9+ "time"
10+
11+ "github.com/kujtimiihoxha/termai/internal/lsp"
12+ "github.com/kujtimiihoxha/termai/internal/lsp/protocol"
13+)
14+
15+type diagnosticsTool struct {
16+ lspClients map[string]*lsp.Client
17+}
18+
19+const (
20+ DiagnosticsToolName = "diagnostics"
21+)
22+
23+type DiagnosticsParams struct {
24+ FilePath string `json:"file_path"`
25+}
26+
27+func (b *diagnosticsTool) Info() ToolInfo {
28+ return ToolInfo{
29+ Name: DiagnosticsToolName,
30+ Description: "Get diagnostics for a file and/or project.",
31+ Parameters: map[string]any{
32+ "file_path": map[string]any{
33+ "type": "string",
34+ "description": "The path to the file to get diagnostics for (leave w empty for project diagnostics)",
35+ },
36+ },
37+ Required: []string{},
38+ }
39+}
40+
41+func (b *diagnosticsTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error) {
42+ var params DiagnosticsParams
43+ if err := json.Unmarshal([]byte(call.Input), &params); err != nil {
44+ return NewTextErrorResponse(fmt.Sprintf("error parsing parameters: %s", err)), nil
45+ }
46+
47+ lsps := b.lspClients
48+
49+ if len(lsps) == 0 {
50+ return NewTextErrorResponse("no LSP clients available"), nil
51+ }
52+
53+ if params.FilePath == "" {
54+ notifyLspOpenFile(ctx, params.FilePath, lsps)
55+ }
56+
57+ output := appendDiagnostics(params.FilePath, lsps)
58+
59+ return NewTextResponse(output), nil
60+}
61+
62+func notifyLspOpenFile(ctx context.Context, filePath string, lsps map[string]*lsp.Client) {
63+ for _, client := range lsps {
64+ err := client.OpenFile(ctx, filePath)
65+ if err != nil {
66+ // Wait for the file to be opened and diagnostics to be received
67+ // TODO: see if we can do this in a more efficient way
68+ time.Sleep(2 * time.Second)
69+ }
70+
71+ }
72+}
73+
74+func appendDiagnostics(filePath string, lsps map[string]*lsp.Client) string {
75+ fileDiagnostics := []string{}
76+ projectDiagnostics := []string{}
77+
78+ // Enhanced format function that includes more diagnostic information
79+ formatDiagnostic := func(pth string, diagnostic protocol.Diagnostic, source string) string {
80+ // Base components
81+ severity := "Info"
82+ switch diagnostic.Severity {
83+ case protocol.SeverityError:
84+ severity = "Error"
85+ case protocol.SeverityWarning:
86+ severity = "Warn"
87+ case protocol.SeverityHint:
88+ severity = "Hint"
89+ }
90+
91+ // Location information
92+ location := fmt.Sprintf("%s:%d:%d", pth, diagnostic.Range.Start.Line+1, diagnostic.Range.Start.Character+1)
93+
94+ // Source information (LSP name)
95+ sourceInfo := ""
96+ if diagnostic.Source != "" {
97+ sourceInfo = diagnostic.Source
98+ } else if source != "" {
99+ sourceInfo = source
100+ }
101+
102+ // Code information
103+ codeInfo := ""
104+ if diagnostic.Code != nil {
105+ codeInfo = fmt.Sprintf("[%v]", diagnostic.Code)
106+ }
107+
108+ // Tags information
109+ tagsInfo := ""
110+ if len(diagnostic.Tags) > 0 {
111+ tags := []string{}
112+ for _, tag := range diagnostic.Tags {
113+ switch tag {
114+ case protocol.Unnecessary:
115+ tags = append(tags, "unnecessary")
116+ case protocol.Deprecated:
117+ tags = append(tags, "deprecated")
118+ }
119+ }
120+ if len(tags) > 0 {
121+ tagsInfo = fmt.Sprintf(" (%s)", strings.Join(tags, ", "))
122+ }
123+ }
124+
125+ // Assemble the full diagnostic message
126+ return fmt.Sprintf("%s: %s [%s]%s%s %s",
127+ severity,
128+ location,
129+ sourceInfo,
130+ codeInfo,
131+ tagsInfo,
132+ diagnostic.Message)
133+ }
134+
135+ for lspName, client := range lsps {
136+ diagnostics := client.GetDiagnostics()
137+ if len(diagnostics) > 0 {
138+ for location, diags := range diagnostics {
139+ isCurrentFile := location.Path() == filePath
140+
141+ // Group diagnostics by severity for better organization
142+ for _, diag := range diags {
143+ formattedDiag := formatDiagnostic(location.Path(), diag, lspName)
144+
145+ if isCurrentFile {
146+ fileDiagnostics = append(fileDiagnostics, formattedDiag)
147+ } else {
148+ projectDiagnostics = append(projectDiagnostics, formattedDiag)
149+ }
150+ }
151+ }
152+ }
153+ }
154+
155+ // Sort diagnostics by severity (errors first) and then by location
156+ sort.Slice(fileDiagnostics, func(i, j int) bool {
157+ iIsError := strings.HasPrefix(fileDiagnostics[i], "Error")
158+ jIsError := strings.HasPrefix(fileDiagnostics[j], "Error")
159+ if iIsError != jIsError {
160+ return iIsError // Errors come first
161+ }
162+ return fileDiagnostics[i] < fileDiagnostics[j] // Then alphabetically
163+ })
164+
165+ sort.Slice(projectDiagnostics, func(i, j int) bool {
166+ iIsError := strings.HasPrefix(projectDiagnostics[i], "Error")
167+ jIsError := strings.HasPrefix(projectDiagnostics[j], "Error")
168+ if iIsError != jIsError {
169+ return iIsError
170+ }
171+ return projectDiagnostics[i] < projectDiagnostics[j]
172+ })
173+
174+ output := ""
175+
176+ if len(fileDiagnostics) > 0 {
177+ output += "\n<file_diagnostics>\n"
178+ if len(fileDiagnostics) > 10 {
179+ output += strings.Join(fileDiagnostics[:10], "\n")
180+ output += fmt.Sprintf("\n... and %d more diagnostics", len(fileDiagnostics)-10)
181+ } else {
182+ output += strings.Join(fileDiagnostics, "\n")
183+ }
184+ output += "\n</file_diagnostics>\n"
185+ }
186+
187+ if len(projectDiagnostics) > 0 {
188+ output += "\n<project_diagnostics>\n"
189+ if len(projectDiagnostics) > 10 {
190+ output += strings.Join(projectDiagnostics[:10], "\n")
191+ output += fmt.Sprintf("\n... and %d more diagnostics", len(projectDiagnostics)-10)
192+ } else {
193+ output += strings.Join(projectDiagnostics, "\n")
194+ }
195+ output += "\n</project_diagnostics>\n"
196+ }
197+
198+ // Add summary counts
199+ if len(fileDiagnostics) > 0 || len(projectDiagnostics) > 0 {
200+ fileErrors := countSeverity(fileDiagnostics, "Error")
201+ fileWarnings := countSeverity(fileDiagnostics, "Warn")
202+ projectErrors := countSeverity(projectDiagnostics, "Error")
203+ projectWarnings := countSeverity(projectDiagnostics, "Warn")
204+
205+ output += "\n<diagnostic_summary>\n"
206+ output += fmt.Sprintf("Current file: %d errors, %d warnings\n", fileErrors, fileWarnings)
207+ output += fmt.Sprintf("Project: %d errors, %d warnings\n", projectErrors, projectWarnings)
208+ output += "</diagnostic_summary>\n"
209+ }
210+
211+ return output
212+}
213+
214+// Helper function to count diagnostics by severity
215+func countSeverity(diagnostics []string, severity string) int {
216+ count := 0
217+ for _, diag := range diagnostics {
218+ if strings.HasPrefix(diag, severity) {
219+ count++
220+ }
221+ }
222+ return count
223+}
224+
225+func NewDiagnosticsTool(lspClients map[string]*lsp.Client) BaseTool {
226+ return &diagnosticsTool{
227+ lspClients,
228+ }
229+}
internal/llm/tools/edit.go+15−6
@@ -10,11 +10,14 @@ import (
1010 "time"
1111
1212 "github.com/kujtimiihoxha/termai/internal/config"
13+ "github.com/kujtimiihoxha/termai/internal/lsp"
1314 "github.com/kujtimiihoxha/termai/internal/permission"
1415 "github.com/sergi/go-diff/diffmatchpatch"
1516)
1617
17−type editTool struct{}
18+type editTool struct {
19+ lspClients map[string]*lsp.Client
20+}
1821
1922const (
2023 EditToolName = "edit"
@@ -71,6 +74,7 @@ func (e *editTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error)
7174 params.FilePath = filepath.Join(wd, params.FilePath)
7275 }
7376
77+ notifyLspOpenFile(ctx, params.FilePath, e.lspClients)
7478 if params.OldString == "" {
7579 result, err := createNewFile(params.FilePath, params.NewString)
7680 if err != nil {
@@ -91,6 +95,9 @@ func (e *editTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error)
9195 if err != nil {
9296 return NewTextErrorResponse(fmt.Sprintf("error replacing content: %s", err)), nil
9397 }
98+
99+ result = fmt.Sprintf("<result>\n%s\n</result>\n", result)
100+ result += appendDiagnostics(params.FilePath, e.lspClients)
94101 return NewTextResponse(result), nil
95102}
96103
@@ -296,18 +303,18 @@ func GenerateDiff(oldContent, newContent string) string {
296303
297304 switch diff.Type {
298305 case diffmatchpatch.DiffInsert:
299− for _, line := range strings.Split(text, "\n") {
306+ for line := range strings.SplitSeq(text, "\n") {
300307 _, _ = buff.WriteString("+ " + line + "\n")
301308 }
302309 case diffmatchpatch.DiffDelete:
303− for _, line := range strings.Split(text, "\n") {
310+ for line := range strings.SplitSeq(text, "\n") {
304311 _, _ = buff.WriteString("- " + line + "\n")
305312 }
306313 case diffmatchpatch.DiffEqual:
307314 if len(text) > 40 {
308315 _, _ = buff.WriteString(" " + text[:20] + "..." + text[len(text)-20:] + "\n")
309316 } else {
310− for _, line := range strings.Split(text, "\n") {
317+ for line := range strings.SplitSeq(text, "\n") {
311318 _, _ = buff.WriteString(" " + line + "\n")
312319 }
313320 }
@@ -366,6 +373,8 @@ When making edits:
366373Remember: when making multiple file edits in a row to the same file, you should prefer to send all edits in a single message with multiple calls to this tool, rather than multiple messages with a single call each.`
367374}
368375
369−func NewEditTool() BaseTool {
370− return &editTool{}
376+func NewEditTool(lspClients map[string]*lsp.Client) BaseTool {
377+ return &editTool{
378+ lspClients,
379+ }
371380}
internal/llm/tools/shell/shell.go+1−1
@@ -221,7 +221,7 @@ func (s *PersistentShell) killChildren() {
221221 return
222222 }
223223
224− for _, pidStr := range strings.Split(string(output), "\n") {
224+ for pidStr := range strings.SplitSeq(string(output), "\n") {
225225 if pidStr = strings.TrimSpace(pidStr); pidStr != "" {
226226 var pid int
227227 fmt.Sscanf(pidStr, "%d", &pid)
internal/llm/tools/view.go+17−9
@@ -11,9 +11,12 @@ import (
1111 "strings"
1212
1313 "github.com/kujtimiihoxha/termai/internal/config"
14+ "github.com/kujtimiihoxha/termai/internal/lsp"
1415)
1516
16−type viewTool struct{}
17+type viewTool struct {
18+ lspClients map[string]*lsp.Client
19+}
1720
1821const (
1922 ViewToolName = "view"
@@ -127,15 +130,18 @@ func (v *viewTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error)
127130 return NewTextErrorResponse(fmt.Sprintf("Failed to read file: %s", err)), nil
128131 }
129132
133+ notifyLspOpenFile(ctx, filePath, v.lspClients)
134+ output := "<file>\n"
130135 // Format the output with line numbers
131− output := addLineNumbers(content, params.Offset+1)
136+ output += addLineNumbers(content, params.Offset+1)
132137
133138 // Add a note if the content was truncated
134139 if lineCount > params.Offset+len(strings.Split(content, "\n")) {
135140 output += fmt.Sprintf("\n\n(File has more lines. Use 'offset' parameter to read beyond line %d)",
136141 params.Offset+len(strings.Split(content, "\n")))
137142 }
138−
143+ output += "\n</file>\n"
144+ output += appendDiagnostics(filePath, v.lspClients)
139145 recordFileRead(filePath)
140146 return NewTextResponse(output), nil
141147}
@@ -155,10 +161,10 @@ func addLineNumbers(content string, startLine int) string {
155161 numStr := fmt.Sprintf("%d", lineNum)
156162
157163 if len(numStr) >= 6 {
158− result = append(result, fmt.Sprintf("%s\t%s", numStr, line))
164+ result = append(result, fmt.Sprintf("%s|%s", numStr, line))
159165 } else {
160166 paddedNum := fmt.Sprintf("%6s", numStr)
161− result = append(result, fmt.Sprintf("%s\t|%s", paddedNum, line))
167+ result = append(result, fmt.Sprintf("%s|%s", paddedNum, line))
162168 }
163169 }
164170
@@ -173,8 +179,9 @@ func readTextFile(filePath string, offset, limit int) (string, int, error) {
173179 defer file.Close()
174180
175181 lineCount := 0
182+
183+ scanner := NewLineScanner(file)
176184 if offset > 0 {
177− scanner := NewLineScanner(file)
178185 for lineCount < offset && scanner.Scan() {
179186 lineCount++
180187 }
@@ -192,7 +199,6 @@ func readTextFile(filePath string, offset, limit int) (string, int, error) {
192199
193200 var lines []string
194201 lineCount = offset
195− scanner := NewLineScanner(file)
196202
197203 for scanner.Scan() && len(lines) < limit {
198204 lineCount++
@@ -290,6 +296,8 @@ TIPS:
290296- When viewing large files, use the offset parameter to read specific sections`
291297}
292298
293−func NewViewTool() BaseTool {
294− return &viewTool{}
299+func NewViewTool(lspClients map[string]*lsp.Client) BaseTool {
300+ return &viewTool{
301+ lspClients,
302+ }
295303}
internal/llm/tools/write.go+14−4
@@ -9,10 +9,13 @@ import (
99 "time"
1010
1111 "github.com/kujtimiihoxha/termai/internal/config"
12+ "github.com/kujtimiihoxha/termai/internal/lsp"
1213 "github.com/kujtimiihoxha/termai/internal/permission"
1314)
1415
15−type writeTool struct{}
16+type writeTool struct {
17+ lspClients map[string]*lsp.Client
18+}
1619
1720const (
1821 WriteToolName = "write"
@@ -96,6 +99,8 @@ func (w *writeTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error
9699 if err = os.MkdirAll(dir, 0o755); err != nil {
97100 return NewTextErrorResponse(fmt.Sprintf("Failed to create parent directories: %s", err)), nil
98101 }
102+
103+ notifyLspOpenFile(ctx, filePath, w.lspClients)
99104 p := permission.Default.Request(
100105 permission.CreatePermissionRequest{
101106 Path: filePath,
@@ -122,7 +127,10 @@ func (w *writeTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error
122127 recordFileWrite(filePath)
123128 recordFileRead(filePath)
124129
125− return NewTextResponse(fmt.Sprintf("File successfully written: %s", filePath)), nil
130+ result := fmt.Sprintf("File successfully written: %s", filePath)
131+ result = fmt.Sprintf("<result>\n%s\n</result>", result)
132+ result += appendDiagnostics(filePath, w.lspClients)
133+ return NewTextResponse(result), nil
126134}
127135
128136func writeDescription() string {
@@ -156,6 +164,8 @@ TIPS:
156164- Always include descriptive comments when making changes to existing code`
157165}
158166
159−func NewWriteTool() BaseTool {
160− return &writeTool{}
167+func NewWriteTool(lspClients map[string]*lsp.Client) BaseTool {
168+ return &writeTool{
169+ lspClients,
170+ }
161171}
internal/llm/tools/write_test.go+39−37
@@ -8,13 +8,14 @@ import (
88 "testing"
99 "time"
1010
11+ "github.com/kujtimiihoxha/termai/internal/lsp"
1112 "github.com/kujtimiihoxha/termai/internal/permission"
1213 "github.com/stretchr/testify/assert"
1314 "github.com/stretchr/testify/require"
1415)
1516
1617func TestWriteTool_Info(t *testing.T) {
17− tool := NewWriteTool()
18+ tool := NewWriteTool(make(map[string]*lsp.Client))
1819 info := tool.Info()
1920
2021 assert.Equal(t, WriteToolName, info.Name)
@@ -40,11 +41,11 @@ func TestWriteTool_Run(t *testing.T) {
4041
4142 t.Run("creates a new file successfully", func(t *testing.T) {
4243 permission.Default = newMockPermissionService(true)
43− tool := NewWriteTool()
44−
44+ tool := NewWriteTool(make(map[string]*lsp.Client))
45+
4546 filePath := filepath.Join(tempDir, "new_file.txt")
4647 content := "This is a test content"
47−
48+
4849 params := WriteParams{
4950 FilePath: filePath,
5051 Content: content,
@@ -70,11 +71,11 @@ func TestWriteTool_Run(t *testing.T) {
7071
7172 t.Run("creates file with nested directories", func(t *testing.T) {
7273 permission.Default = newMockPermissionService(true)
73− tool := NewWriteTool()
74−
74+ tool := NewWriteTool(make(map[string]*lsp.Client))
75+
7576 filePath := filepath.Join(tempDir, "nested/dirs/new_file.txt")
7677 content := "Content in nested directory"
77−
78+
7879 params := WriteParams{
7980 FilePath: filePath,
8081 Content: content,
@@ -100,17 +101,17 @@ func TestWriteTool_Run(t *testing.T) {
100101
101102 t.Run("updates existing file", func(t *testing.T) {
102103 permission.Default = newMockPermissionService(true)
103− tool := NewWriteTool()
104−
104+ tool := NewWriteTool(make(map[string]*lsp.Client))
105+
105106 // Create a file first
106107 filePath := filepath.Join(tempDir, "existing_file.txt")
107108 initialContent := "Initial content"
108− err := os.WriteFile(filePath, []byte(initialContent), 0644)
109+ err := os.WriteFile(filePath, []byte(initialContent), 0o644)
109110 require.NoError(t, err)
110−
111+
111112 // Record the file read to avoid modification time check failure
112113 recordFileRead(filePath)
113−
114+
114115 // Update the file
115116 updatedContent := "Updated content"
116117 params := WriteParams{
@@ -138,8 +139,8 @@ func TestWriteTool_Run(t *testing.T) {
138139
139140 t.Run("handles invalid parameters", func(t *testing.T) {
140141 permission.Default = newMockPermissionService(true)
141− tool := NewWriteTool()
142−
142+ tool := NewWriteTool(make(map[string]*lsp.Client))
143+
143144 call := ToolCall{
144145 Name: WriteToolName,
145146 Input: "invalid json",
@@ -152,8 +153,8 @@ func TestWriteTool_Run(t *testing.T) {
152153
153154 t.Run("handles missing file_path", func(t *testing.T) {
154155 permission.Default = newMockPermissionService(true)
155− tool := NewWriteTool()
156−
156+ tool := NewWriteTool(make(map[string]*lsp.Client))
157+
157158 params := WriteParams{
158159 FilePath: "",
159160 Content: "Some content",
@@ -174,8 +175,8 @@ func TestWriteTool_Run(t *testing.T) {
174175
175176 t.Run("handles missing content", func(t *testing.T) {
176177 permission.Default = newMockPermissionService(true)
177− tool := NewWriteTool()
178−
178+ tool := NewWriteTool(make(map[string]*lsp.Client))
179+
179180 params := WriteParams{
180181 FilePath: filepath.Join(tempDir, "file.txt"),
181182 Content: "",
@@ -196,13 +197,13 @@ func TestWriteTool_Run(t *testing.T) {
196197
197198 t.Run("handles writing to a directory path", func(t *testing.T) {
198199 permission.Default = newMockPermissionService(true)
199− tool := NewWriteTool()
200−
200+ tool := NewWriteTool(make(map[string]*lsp.Client))
201+
201202 // Create a directory
202203 dirPath := filepath.Join(tempDir, "test_dir")
203− err := os.Mkdir(dirPath, 0755)
204+ err := os.Mkdir(dirPath, 0o755)
204205 require.NoError(t, err)
205−
206+
206207 params := WriteParams{
207208 FilePath: dirPath,
208209 Content: "Some content",
@@ -223,8 +224,8 @@ func TestWriteTool_Run(t *testing.T) {
223224
224225 t.Run("handles permission denied", func(t *testing.T) {
225226 permission.Default = newMockPermissionService(false)
226− tool := NewWriteTool()
227−
227+ tool := NewWriteTool(make(map[string]*lsp.Client))
228+
228229 filePath := filepath.Join(tempDir, "permission_denied.txt")
229230 params := WriteParams{
230231 FilePath: filePath,
@@ -242,7 +243,7 @@ func TestWriteTool_Run(t *testing.T) {
242243 response, err := tool.Run(context.Background(), call)
243244 require.NoError(t, err)
244245 assert.Contains(t, response.Content, "Permission denied")
245−
246+
246247 // Verify file was not created
247248 _, err = os.Stat(filePath)
248249 assert.True(t, os.IsNotExist(err))
@@ -250,14 +251,14 @@ func TestWriteTool_Run(t *testing.T) {
250251
251252 t.Run("detects file modified since last read", func(t *testing.T) {
252253 permission.Default = newMockPermissionService(true)
253− tool := NewWriteTool()
254−
254+ tool := NewWriteTool(make(map[string]*lsp.Client))
255+
255256 // Create a file
256257 filePath := filepath.Join(tempDir, "modified_file.txt")
257258 initialContent := "Initial content"
258− err := os.WriteFile(filePath, []byte(initialContent), 0644)
259+ err := os.WriteFile(filePath, []byte(initialContent), 0o644)
259260 require.NoError(t, err)
260−
261+
261262 // Record an old read time
262263 fileRecordMutex.Lock()
263264 fileRecords[filePath] = fileRecord{
@@ -265,7 +266,7 @@ func TestWriteTool_Run(t *testing.T) {
265266 readTime: time.Now().Add(-1 * time.Hour),
266267 }
267268 fileRecordMutex.Unlock()
268−
269+
269270 // Try to update the file
270271 params := WriteParams{
271272 FilePath: filePath,
@@ -283,7 +284,7 @@ func TestWriteTool_Run(t *testing.T) {
283284 response, err := tool.Run(context.Background(), call)
284285 require.NoError(t, err)
285286 assert.Contains(t, response.Content, "has been modified since it was last read")
286−
287+
287288 // Verify file was not modified
288289 fileContent, err := os.ReadFile(filePath)
289290 require.NoError(t, err)
@@ -292,17 +293,17 @@ func TestWriteTool_Run(t *testing.T) {
292293
293294 t.Run("skips writing when content is identical", func(t *testing.T) {
294295 permission.Default = newMockPermissionService(true)
295− tool := NewWriteTool()
296−
296+ tool := NewWriteTool(make(map[string]*lsp.Client))
297+
297298 // Create a file
298299 filePath := filepath.Join(tempDir, "identical_content.txt")
299300 content := "Content that won't change"
300− err := os.WriteFile(filePath, []byte(content), 0644)
301+ err := os.WriteFile(filePath, []byte(content), 0o644)
301302 require.NoError(t, err)
302−
303+
303304 // Record a read time
304305 recordFileRead(filePath)
305−
306+
306307 // Try to write the same content
307308 params := WriteParams{
308309 FilePath: filePath,
@@ -321,4 +322,5 @@ func TestWriteTool_Run(t *testing.T) {
321322 require.NoError(t, err)
322323 assert.Contains(t, response.Content, "already contains the exact content")
323324 })
324−}
325+}
326+
internal/lsp/client.gonew file+429
@@ -0,0 +1,429 @@
1+package lsp
2+
3+import (
4+ "bufio"
5+ "context"
6+ "encoding/json"
7+ "fmt"
8+ "io"
9+ "log"
10+ "os"
11+ "os/exec"
12+ "strings"
13+ "sync"
14+ "sync/atomic"
15+ "time"
16+
17+ "github.com/kujtimiihoxha/termai/internal/lsp/protocol"
18+)
19+
20+type Client struct {
21+ Cmd *exec.Cmd
22+ stdin io.WriteCloser
23+ stdout *bufio.Reader
24+ stderr io.ReadCloser
25+
26+ // Request ID counter
27+ nextID atomic.Int32
28+
29+ // Response handlers
30+ handlers map[int32]chan *Message
31+ handlersMu sync.RWMutex
32+
33+ // Server request handlers
34+ serverRequestHandlers map[string]ServerRequestHandler
35+ serverHandlersMu sync.RWMutex
36+
37+ // Notification handlers
38+ notificationHandlers map[string]NotificationHandler
39+ notificationMu sync.RWMutex
40+
41+ // Diagnostic cache
42+ diagnostics map[protocol.DocumentUri][]protocol.Diagnostic
43+ diagnosticsMu sync.RWMutex
44+
45+ // Files are currently opened by the LSP
46+ openFiles map[string]*OpenFileInfo
47+ openFilesMu sync.RWMutex
48+}
49+
50+func NewClient(command string, args ...string) (*Client, error) {
51+ cmd := exec.Command(command, args...)
52+ // Copy env
53+ cmd.Env = os.Environ()
54+
55+ stdin, err := cmd.StdinPipe()
56+ if err != nil {
57+ return nil, fmt.Errorf("failed to create stdin pipe: %w", err)
58+ }
59+
60+ stdout, err := cmd.StdoutPipe()
61+ if err != nil {
62+ return nil, fmt.Errorf("failed to create stdout pipe: %w", err)
63+ }
64+
65+ stderr, err := cmd.StderrPipe()
66+ if err != nil {
67+ return nil, fmt.Errorf("failed to create stderr pipe: %w", err)
68+ }
69+
70+ client := &Client{
71+ Cmd: cmd,
72+ stdin: stdin,
73+ stdout: bufio.NewReader(stdout),
74+ stderr: stderr,
75+ handlers: make(map[int32]chan *Message),
76+ notificationHandlers: make(map[string]NotificationHandler),
77+ serverRequestHandlers: make(map[string]ServerRequestHandler),
78+ diagnostics: make(map[protocol.DocumentUri][]protocol.Diagnostic),
79+ openFiles: make(map[string]*OpenFileInfo),
80+ }
81+
82+ // Start the LSP server process
83+ if err := cmd.Start(); err != nil {
84+ return nil, fmt.Errorf("failed to start LSP server: %w", err)
85+ }
86+
87+ // Handle stderr in a separate goroutine
88+ go func() {
89+ scanner := bufio.NewScanner(stderr)
90+ for scanner.Scan() {
91+ fmt.Fprintf(os.Stderr, "LSP Server: %s\n", scanner.Text())
92+ }
93+ if err := scanner.Err(); err != nil {
94+ fmt.Fprintf(os.Stderr, "Error reading stderr: %v\n", err)
95+ }
96+ }()
97+
98+ // Start message handling loop
99+ go client.handleMessages()
100+
101+ return client, nil
102+}
103+
104+func (c *Client) RegisterNotificationHandler(method string, handler NotificationHandler) {
105+ c.notificationMu.Lock()
106+ defer c.notificationMu.Unlock()
107+ c.notificationHandlers[method] = handler
108+}
109+
110+func (c *Client) RegisterServerRequestHandler(method string, handler ServerRequestHandler) {
111+ c.serverHandlersMu.Lock()
112+ defer c.serverHandlersMu.Unlock()
113+ c.serverRequestHandlers[method] = handler
114+}
115+
116+func (c *Client) InitializeLSPClient(ctx context.Context, workspaceDir string) (*protocol.InitializeResult, error) {
117+ initParams := &protocol.InitializeParams{
118+ WorkspaceFoldersInitializeParams: protocol.WorkspaceFoldersInitializeParams{
119+ WorkspaceFolders: []protocol.WorkspaceFolder{
120+ {
121+ URI: protocol.URI("file://" + workspaceDir),
122+ Name: workspaceDir,
123+ },
124+ },
125+ },
126+
127+ XInitializeParams: protocol.XInitializeParams{
128+ ProcessID: int32(os.Getpid()),
129+ ClientInfo: &protocol.ClientInfo{
130+ Name: "mcp-language-server",
131+ Version: "0.1.0",
132+ },
133+ RootPath: workspaceDir,
134+ RootURI: protocol.DocumentUri("file://" + workspaceDir),
135+ Capabilities: protocol.ClientCapabilities{
136+ Workspace: protocol.WorkspaceClientCapabilities{
137+ Configuration: true,
138+ DidChangeConfiguration: protocol.DidChangeConfigurationClientCapabilities{
139+ DynamicRegistration: true,
140+ },
141+ DidChangeWatchedFiles: protocol.DidChangeWatchedFilesClientCapabilities{
142+ DynamicRegistration: true,
143+ RelativePatternSupport: true,
144+ },
145+ },
146+ TextDocument: protocol.TextDocumentClientCapabilities{
147+ Synchronization: &protocol.TextDocumentSyncClientCapabilities{
148+ DynamicRegistration: true,
149+ DidSave: true,
150+ },
151+ Completion: protocol.CompletionClientCapabilities{
152+ CompletionItem: protocol.ClientCompletionItemOptions{},
153+ },
154+ CodeLens: &protocol.CodeLensClientCapabilities{
155+ DynamicRegistration: true,
156+ },
157+ DocumentSymbol: protocol.DocumentSymbolClientCapabilities{},
158+ CodeAction: protocol.CodeActionClientCapabilities{
159+ CodeActionLiteralSupport: protocol.ClientCodeActionLiteralOptions{
160+ CodeActionKind: protocol.ClientCodeActionKindOptions{
161+ ValueSet: []protocol.CodeActionKind{},
162+ },
163+ },
164+ },
165+ PublishDiagnostics: protocol.PublishDiagnosticsClientCapabilities{
166+ VersionSupport: true,
167+ },
168+ SemanticTokens: protocol.SemanticTokensClientCapabilities{
169+ Requests: protocol.ClientSemanticTokensRequestOptions{
170+ Range: &protocol.Or_ClientSemanticTokensRequestOptions_range{},
171+ Full: &protocol.Or_ClientSemanticTokensRequestOptions_full{},
172+ },
173+ TokenTypes: []string{},
174+ TokenModifiers: []string{},
175+ Formats: []protocol.TokenFormat{},
176+ },
177+ },
178+ Window: protocol.WindowClientCapabilities{},
179+ },
180+ InitializationOptions: map[string]any{
181+ "codelenses": map[string]bool{
182+ "generate": true,
183+ "regenerate_cgo": true,
184+ "test": true,
185+ "tidy": true,
186+ "upgrade_dependency": true,
187+ "vendor": true,
188+ "vulncheck": false,
189+ },
190+ },
191+ },
192+ }
193+
194+ var result protocol.InitializeResult
195+ if err := c.Call(ctx, "initialize", initParams, &result); err != nil {
196+ return nil, fmt.Errorf("initialize failed: %w", err)
197+ }
198+
199+ if err := c.Notify(ctx, "initialized", struct{}{}); err != nil {
200+ return nil, fmt.Errorf("initialized notification failed: %w", err)
201+ }
202+
203+ // Register handlers
204+ c.RegisterServerRequestHandler("workspace/applyEdit", HandleApplyEdit)
205+ c.RegisterServerRequestHandler("workspace/configuration", HandleWorkspaceConfiguration)
206+ c.RegisterServerRequestHandler("client/registerCapability", HandleRegisterCapability)
207+ c.RegisterNotificationHandler("window/showMessage", HandleServerMessage)
208+ c.RegisterNotificationHandler("textDocument/publishDiagnostics",
209+ func(params json.RawMessage) { HandleDiagnostics(c, params) })
210+
211+ // Notify the LSP server
212+ err := c.Initialized(ctx, protocol.InitializedParams{})
213+ if err != nil {
214+ return nil, fmt.Errorf("initialization failed: %w", err)
215+ }
216+
217+ // LSP sepecific Initialization
218+ path := strings.ToLower(c.Cmd.Path)
219+ switch {
220+ case strings.Contains(path, "typescript-language-server"):
221+ // err := initializeTypescriptLanguageServer(ctx, c, workspaceDir)
222+ // if err != nil {
223+ // return nil, err
224+ // }
225+ }
226+
227+ return &result, nil
228+}
229+
230+func (c *Client) Close() error {
231+ // Try to close all open files first
232+ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
233+ defer cancel()
234+
235+ // Attempt to close files but continue shutdown regardless
236+ c.CloseAllFiles(ctx)
237+
238+ // Close stdin to signal the server
239+ if err := c.stdin.Close(); err != nil {
240+ return fmt.Errorf("failed to close stdin: %w", err)
241+ }
242+
243+ // Use a channel to handle the Wait with timeout
244+ done := make(chan error, 1)
245+ go func() {
246+ done <- c.Cmd.Wait()
247+ }()
248+
249+ // Wait for process to exit with timeout
250+ select {
251+ case err := <-done:
252+ return err
253+ case <-time.After(2 * time.Second):
254+ // If we timeout, try to kill the process
255+ if err := c.Cmd.Process.Kill(); err != nil {
256+ return fmt.Errorf("failed to kill process: %w", err)
257+ }
258+ return fmt.Errorf("process killed after timeout")
259+ }
260+}
261+
262+type ServerState int
263+
264+const (
265+ StateStarting ServerState = iota
266+ StateReady
267+ StateError
268+)
269+
270+func (c *Client) WaitForServerReady(ctx context.Context) error {
271+ // TODO: wait for specific messages or poll workspace/symbol
272+ time.Sleep(time.Second * 1)
273+ return nil
274+}
275+
276+type OpenFileInfo struct {
277+ Version int32
278+ URI protocol.DocumentUri
279+}
280+
281+func (c *Client) OpenFile(ctx context.Context, filepath string) error {
282+ uri := fmt.Sprintf("file://%s", filepath)
283+
284+ c.openFilesMu.Lock()
285+ if _, exists := c.openFiles[uri]; exists {
286+ c.openFilesMu.Unlock()
287+ return nil // Already open
288+ }
289+ c.openFilesMu.Unlock()
290+
291+ // Skip files that do not exist or cannot be read
292+ content, err := os.ReadFile(filepath)
293+ if err != nil {
294+ return fmt.Errorf("error reading file: %w", err)
295+ }
296+
297+ params := protocol.DidOpenTextDocumentParams{
298+ TextDocument: protocol.TextDocumentItem{
299+ URI: protocol.DocumentUri(uri),
300+ LanguageID: DetectLanguageID(uri),
301+ Version: 1,
302+ Text: string(content),
303+ },
304+ }
305+
306+ if err := c.Notify(ctx, "textDocument/didOpen", params); err != nil {
307+ return err
308+ }
309+
310+ c.openFilesMu.Lock()
311+ c.openFiles[uri] = &OpenFileInfo{
312+ Version: 1,
313+ URI: protocol.DocumentUri(uri),
314+ }
315+ c.openFilesMu.Unlock()
316+
317+ return nil
318+}
319+
320+func (c *Client) NotifyChange(ctx context.Context, filepath string) error {
321+ uri := fmt.Sprintf("file://%s", filepath)
322+
323+ content, err := os.ReadFile(filepath)
324+ if err != nil {
325+ return fmt.Errorf("error reading file: %w", err)
326+ }
327+
328+ c.openFilesMu.Lock()
329+ fileInfo, isOpen := c.openFiles[uri]
330+ if !isOpen {
331+ c.openFilesMu.Unlock()
332+ return fmt.Errorf("cannot notify change for unopened file: %s", filepath)
333+ }
334+
335+ // Increment version
336+ fileInfo.Version++
337+ version := fileInfo.Version
338+ c.openFilesMu.Unlock()
339+
340+ params := protocol.DidChangeTextDocumentParams{
341+ TextDocument: protocol.VersionedTextDocumentIdentifier{
342+ TextDocumentIdentifier: protocol.TextDocumentIdentifier{
343+ URI: protocol.DocumentUri(uri),
344+ },
345+ Version: version,
346+ },
347+ ContentChanges: []protocol.TextDocumentContentChangeEvent{
348+ {
349+ Value: protocol.TextDocumentContentChangeWholeDocument{
350+ Text: string(content),
351+ },
352+ },
353+ },
354+ }
355+
356+ return c.Notify(ctx, "textDocument/didChange", params)
357+}
358+
359+func (c *Client) CloseFile(ctx context.Context, filepath string) error {
360+ uri := fmt.Sprintf("file://%s", filepath)
361+
362+ c.openFilesMu.Lock()
363+ if _, exists := c.openFiles[uri]; !exists {
364+ c.openFilesMu.Unlock()
365+ return nil // Already closed
366+ }
367+ c.openFilesMu.Unlock()
368+
369+ params := protocol.DidCloseTextDocumentParams{
370+ TextDocument: protocol.TextDocumentIdentifier{
371+ URI: protocol.DocumentUri(uri),
372+ },
373+ }
374+ log.Println("Closing", params.TextDocument.URI.Dir())
375+ if err := c.Notify(ctx, "textDocument/didClose", params); err != nil {
376+ return err
377+ }
378+
379+ c.openFilesMu.Lock()
380+ delete(c.openFiles, uri)
381+ c.openFilesMu.Unlock()
382+
383+ return nil
384+}
385+
386+func (c *Client) IsFileOpen(filepath string) bool {
387+ uri := fmt.Sprintf("file://%s", filepath)
388+ c.openFilesMu.RLock()
389+ defer c.openFilesMu.RUnlock()
390+ _, exists := c.openFiles[uri]
391+ return exists
392+}
393+
394+// CloseAllFiles closes all currently open files
395+func (c *Client) CloseAllFiles(ctx context.Context) {
396+ c.openFilesMu.Lock()
397+ filesToClose := make([]string, 0, len(c.openFiles))
398+
399+ // First collect all URIs that need to be closed
400+ for uri := range c.openFiles {
401+ // Convert URI back to file path by trimming "file://" prefix
402+ filePath := strings.TrimPrefix(uri, "file://")
403+ filesToClose = append(filesToClose, filePath)
404+ }
405+ c.openFilesMu.Unlock()
406+
407+ // Then close them all
408+ for _, filePath := range filesToClose {
409+ err := c.CloseFile(ctx, filePath)
410+ if err != nil && debug {
411+ log.Printf("Error closing file %s: %v", filePath, err)
412+ }
413+ }
414+
415+ if debug {
416+ log.Printf("Closed %d files", len(filesToClose))
417+ }
418+}
419+
420+func (c *Client) GetFileDiagnostics(uri protocol.DocumentUri) []protocol.Diagnostic {
421+ c.diagnosticsMu.RLock()
422+ defer c.diagnosticsMu.RUnlock()
423+
424+ return c.diagnostics[uri]
425+}
426+
427+func (c *Client) GetDiagnostics() map[protocol.DocumentUri][]protocol.Diagnostic {
428+ return c.diagnostics
429+}
internal/lsp/handlers.gonew file+104
@@ -0,0 +1,104 @@
1+package lsp
2+
3+import (
4+ "encoding/json"
5+ "log"
6+
7+ "github.com/kujtimiihoxha/termai/internal/lsp/protocol"
8+ "github.com/kujtimiihoxha/termai/internal/lsp/util"
9+)
10+
11+// Requests
12+
13+func HandleWorkspaceConfiguration(params json.RawMessage) (any, error) {
14+ return []map[string]any{{}}, nil
15+}
16+
17+func HandleRegisterCapability(params json.RawMessage) (any, error) {
18+ var registerParams protocol.RegistrationParams
19+ if err := json.Unmarshal(params, &registerParams); err != nil {
20+ log.Printf("Error unmarshaling registration params: %v", err)
21+ return nil, err
22+ }
23+
24+ for _, reg := range registerParams.Registrations {
25+ switch reg.Method {
26+ case "workspace/didChangeWatchedFiles":
27+ // Parse the registration options
28+ optionsJSON, err := json.Marshal(reg.RegisterOptions)
29+ if err != nil {
30+ log.Printf("Error marshaling registration options: %v", err)
31+ continue
32+ }
33+
34+ var options protocol.DidChangeWatchedFilesRegistrationOptions
35+ if err := json.Unmarshal(optionsJSON, &options); err != nil {
36+ log.Printf("Error unmarshaling registration options: %v", err)
37+ continue
38+ }
39+
40+ // Store the file watchers registrations
41+ notifyFileWatchRegistration(reg.ID, options.Watchers)
42+ }
43+ }
44+
45+ return nil, nil
46+}
47+
48+func HandleApplyEdit(params json.RawMessage) (any, error) {
49+ var edit protocol.ApplyWorkspaceEditParams
50+ if err := json.Unmarshal(params, &edit); err != nil {
51+ return nil, err
52+ }
53+
54+ err := util.ApplyWorkspaceEdit(edit.Edit)
55+ if err != nil {
56+ log.Printf("Error applying workspace edit: %v", err)
57+ return protocol.ApplyWorkspaceEditResult{Applied: false, FailureReason: err.Error()}, nil
58+ }
59+
60+ return protocol.ApplyWorkspaceEditResult{Applied: true}, nil
61+}
62+
63+// FileWatchRegistrationHandler is a function that will be called when file watch registrations are received
64+type FileWatchRegistrationHandler func(id string, watchers []protocol.FileSystemWatcher)
65+
66+// fileWatchHandler holds the current handler for file watch registrations
67+var fileWatchHandler FileWatchRegistrationHandler
68+
69+// RegisterFileWatchHandler sets the handler for file watch registrations
70+func RegisterFileWatchHandler(handler FileWatchRegistrationHandler) {
71+ fileWatchHandler = handler
72+}
73+
74+// notifyFileWatchRegistration notifies the handler about new file watch registrations
75+func notifyFileWatchRegistration(id string, watchers []protocol.FileSystemWatcher) {
76+ if fileWatchHandler != nil {
77+ fileWatchHandler(id, watchers)
78+ }
79+}
80+
81+// Notifications
82+
83+func HandleServerMessage(params json.RawMessage) {
84+ var msg struct {
85+ Type int `json:"type"`
86+ Message string `json:"message"`
87+ }
88+ if err := json.Unmarshal(params, &msg); err == nil {
89+ log.Printf("Server message: %s\n", msg.Message)
90+ }
91+}
92+
93+func HandleDiagnostics(client *Client, params json.RawMessage) {
94+ var diagParams protocol.PublishDiagnosticsParams
95+ if err := json.Unmarshal(params, &diagParams); err != nil {
96+ log.Printf("Error unmarshaling diagnostic params: %v", err)
97+ return
98+ }
99+
100+ client.diagnosticsMu.Lock()
101+ defer client.diagnosticsMu.Unlock()
102+
103+ client.diagnostics[diagParams.URI] = diagParams.Diagnostics
104+}
internal/lsp/language.gonew file+132
@@ -0,0 +1,132 @@
1+package lsp
2+
3+import (
4+ "path/filepath"
5+ "strings"
6+
7+ "github.com/kujtimiihoxha/termai/internal/lsp/protocol"
8+)
9+
10+func DetectLanguageID(uri string) protocol.LanguageKind {
11+ ext := strings.ToLower(filepath.Ext(uri))
12+ switch ext {
13+ case ".abap":
14+ return protocol.LangABAP
15+ case ".bat":
16+ return protocol.LangWindowsBat
17+ case ".bib", ".bibtex":
18+ return protocol.LangBibTeX
19+ case ".clj":
20+ return protocol.LangClojure
21+ case ".coffee":
22+ return protocol.LangCoffeescript
23+ case ".c":
24+ return protocol.LangC
25+ case ".cpp", ".cxx", ".cc", ".c++":
26+ return protocol.LangCPP
27+ case ".cs":
28+ return protocol.LangCSharp
29+ case ".css":
30+ return protocol.LangCSS
31+ case ".d":
32+ return protocol.LangD
33+ case ".pas", ".pascal":
34+ return protocol.LangDelphi
35+ case ".diff", ".patch":
36+ return protocol.LangDiff
37+ case ".dart":
38+ return protocol.LangDart
39+ case ".dockerfile":
40+ return protocol.LangDockerfile
41+ case ".ex", ".exs":
42+ return protocol.LangElixir
43+ case ".erl", ".hrl":
44+ return protocol.LangErlang
45+ case ".fs", ".fsi", ".fsx", ".fsscript":
46+ return protocol.LangFSharp
47+ case ".gitcommit":
48+ return protocol.LangGitCommit
49+ case ".gitrebase":
50+ return protocol.LangGitRebase
51+ case ".go":
52+ return protocol.LangGo
53+ case ".groovy":
54+ return protocol.LangGroovy
55+ case ".hbs", ".handlebars":
56+ return protocol.LangHandlebars
57+ case ".hs":
58+ return protocol.LangHaskell
59+ case ".html", ".htm":
60+ return protocol.LangHTML
61+ case ".ini":
62+ return protocol.LangIni
63+ case ".java":
64+ return protocol.LangJava
65+ case ".js":
66+ return protocol.LangJavaScript
67+ case ".jsx":
68+ return protocol.LangJavaScriptReact
69+ case ".json":
70+ return protocol.LangJSON
71+ case ".tex", ".latex":
72+ return protocol.LangLaTeX
73+ case ".less":
74+ return protocol.LangLess
75+ case ".lua":
76+ return protocol.LangLua
77+ case ".makefile", "makefile":
78+ return protocol.LangMakefile
79+ case ".md", ".markdown":
80+ return protocol.LangMarkdown
81+ case ".m":
82+ return protocol.LangObjectiveC
83+ case ".mm":
84+ return protocol.LangObjectiveCPP
85+ case ".pl":
86+ return protocol.LangPerl
87+ case ".pm":
88+ return protocol.LangPerl6
89+ case ".php":
90+ return protocol.LangPHP
91+ case ".ps1", ".psm1":
92+ return protocol.LangPowershell
93+ case ".pug", ".jade":
94+ return protocol.LangPug
95+ case ".py":
96+ return protocol.LangPython
97+ case ".r":
98+ return protocol.LangR
99+ case ".cshtml", ".razor":
100+ return protocol.LangRazor
101+ case ".rb":
102+ return protocol.LangRuby
103+ case ".rs":
104+ return protocol.LangRust
105+ case ".scss":
106+ return protocol.LangSCSS
107+ case ".sass":
108+ return protocol.LangSASS
109+ case ".scala":
110+ return protocol.LangScala
111+ case ".shader":
112+ return protocol.LangShaderLab
113+ case ".sh", ".bash", ".zsh", ".ksh":
114+ return protocol.LangShellScript
115+ case ".sql":
116+ return protocol.LangSQL
117+ case ".swift":
118+ return protocol.LangSwift
119+ case ".ts":
120+ return protocol.LangTypeScript
121+ case ".tsx":
122+ return protocol.LangTypeScriptReact
123+ case ".xml":
124+ return protocol.LangXML
125+ case ".xsl":
126+ return protocol.LangXSL
127+ case ".yaml", ".yml":
128+ return protocol.LangYAML
129+ default:
130+ return protocol.LanguageKind("") // Unknown language
131+ }
132+}
internal/lsp/methods.gonew file+554
@@ -0,0 +1,554 @@
1+// Generated code. Do not edit
2+package lsp
3+
4+import (
5+ "context"
6+
7+ "github.com/kujtimiihoxha/termai/internal/lsp/protocol"
8+)
9+
10+// Implementation sends a textDocument/implementation request to the LSP server.
11+// A request to resolve the implementation locations of a symbol at a given text document position. The request's parameter is of type TextDocumentPositionParams the response is of type Definition or a Thenable that resolves to such.
12+func (c *Client) Implementation(ctx context.Context, params protocol.ImplementationParams) (protocol.Or_Result_textDocument_implementation, error) {
13+ var result protocol.Or_Result_textDocument_implementation
14+ err := c.Call(ctx, "textDocument/implementation", params, &result)
15+ return result, err
16+}
17+
18+// TypeDefinition sends a textDocument/typeDefinition request to the LSP server.
19+// A request to resolve the type definition locations of a symbol at a given text document position. The request's parameter is of type TextDocumentPositionParams the response is of type Definition or a Thenable that resolves to such.
20+func (c *Client) TypeDefinition(ctx context.Context, params protocol.TypeDefinitionParams) (protocol.Or_Result_textDocument_typeDefinition, error) {
21+ var result protocol.Or_Result_textDocument_typeDefinition
22+ err := c.Call(ctx, "textDocument/typeDefinition", params, &result)
23+ return result, err
24+}
25+
26+// DocumentColor sends a textDocument/documentColor request to the LSP server.
27+// A request to list all color symbols found in a given text document. The request's parameter is of type DocumentColorParams the response is of type ColorInformation ColorInformation[] or a Thenable that resolves to such.
28+func (c *Client) DocumentColor(ctx context.Context, params protocol.DocumentColorParams) ([]protocol.ColorInformation, error) {
29+ var result []protocol.ColorInformation
30+ err := c.Call(ctx, "textDocument/documentColor", params, &result)
31+ return result, err
32+}
33+
34+// ColorPresentation sends a textDocument/colorPresentation request to the LSP server.
35+// A request to list all presentation for a color. The request's parameter is of type ColorPresentationParams the response is of type ColorInformation ColorInformation[] or a Thenable that resolves to such.
36+func (c *Client) ColorPresentation(ctx context.Context, params protocol.ColorPresentationParams) ([]protocol.ColorPresentation, error) {
37+ var result []protocol.ColorPresentation
38+ err := c.Call(ctx, "textDocument/colorPresentation", params, &result)
39+ return result, err
40+}
41+
42+// FoldingRange sends a textDocument/foldingRange request to the LSP server.
43+// A request to provide folding ranges in a document. The request's parameter is of type FoldingRangeParams, the response is of type FoldingRangeList or a Thenable that resolves to such.
44+func (c *Client) FoldingRange(ctx context.Context, params protocol.FoldingRangeParams) ([]protocol.FoldingRange, error) {
45+ var result []protocol.FoldingRange
46+ err := c.Call(ctx, "textDocument/foldingRange", params, &result)
47+ return result, err
48+}
49+
50+// Declaration sends a textDocument/declaration request to the LSP server.
51+// A request to resolve the type definition locations of a symbol at a given text document position. The request's parameter is of type TextDocumentPositionParams the response is of type Declaration or a typed array of DeclarationLink or a Thenable that resolves to such.
52+func (c *Client) Declaration(ctx context.Context, params protocol.DeclarationParams) (protocol.Or_Result_textDocument_declaration, error) {
53+ var result protocol.Or_Result_textDocument_declaration
54+ err := c.Call(ctx, "textDocument/declaration", params, &result)
55+ return result, err
56+}
57+
58+// SelectionRange sends a textDocument/selectionRange request to the LSP server.
59+// A request to provide selection ranges in a document. The request's parameter is of type SelectionRangeParams, the response is of type SelectionRange SelectionRange[] or a Thenable that resolves to such.
60+func (c *Client) SelectionRange(ctx context.Context, params protocol.SelectionRangeParams) ([]protocol.SelectionRange, error) {
61+ var result []protocol.SelectionRange
62+ err := c.Call(ctx, "textDocument/selectionRange", params, &result)
63+ return result, err
64+}
65+
66+// PrepareCallHierarchy sends a textDocument/prepareCallHierarchy request to the LSP server.
67+// A request to result a CallHierarchyItem in a document at a given position. Can be used as an input to an incoming or outgoing call hierarchy. Since 3.16.0
68+func (c *Client) PrepareCallHierarchy(ctx context.Context, params protocol.CallHierarchyPrepareParams) ([]protocol.CallHierarchyItem, error) {
69+ var result []protocol.CallHierarchyItem
70+ err := c.Call(ctx, "textDocument/prepareCallHierarchy", params, &result)
71+ return result, err
72+}
73+
74+// IncomingCalls sends a callHierarchy/incomingCalls request to the LSP server.
75+// A request to resolve the incoming calls for a given CallHierarchyItem. Since 3.16.0
76+func (c *Client) IncomingCalls(ctx context.Context, params protocol.CallHierarchyIncomingCallsParams) ([]protocol.CallHierarchyIncomingCall, error) {
77+ var result []protocol.CallHierarchyIncomingCall
78+ err := c.Call(ctx, "callHierarchy/incomingCalls", params, &result)
79+ return result, err
80+}
81+
82+// OutgoingCalls sends a callHierarchy/outgoingCalls request to the LSP server.
83+// A request to resolve the outgoing calls for a given CallHierarchyItem. Since 3.16.0
84+func (c *Client) OutgoingCalls(ctx context.Context, params protocol.CallHierarchyOutgoingCallsParams) ([]protocol.CallHierarchyOutgoingCall, error) {
85+ var result []protocol.CallHierarchyOutgoingCall
86+ err := c.Call(ctx, "callHierarchy/outgoingCalls", params, &result)
87+ return result, err
88+}
89+
90+// SemanticTokensFull sends a textDocument/semanticTokens/full request to the LSP server.
91+// Since 3.16.0
92+func (c *Client) SemanticTokensFull(ctx context.Context, params protocol.SemanticTokensParams) (protocol.SemanticTokens, error) {
93+ var result protocol.SemanticTokens
94+ err := c.Call(ctx, "textDocument/semanticTokens/full", params, &result)
95+ return result, err
96+}
97+
98+// SemanticTokensFullDelta sends a textDocument/semanticTokens/full/delta request to the LSP server.
99+// Since 3.16.0
100+func (c *Client) SemanticTokensFullDelta(ctx context.Context, params protocol.SemanticTokensDeltaParams) (protocol.Or_Result_textDocument_semanticTokens_full_delta, error) {
101+ var result protocol.Or_Result_textDocument_semanticTokens_full_delta
102+ err := c.Call(ctx, "textDocument/semanticTokens/full/delta", params, &result)
103+ return result, err
104+}
105+
106+// SemanticTokensRange sends a textDocument/semanticTokens/range request to the LSP server.
107+// Since 3.16.0
108+func (c *Client) SemanticTokensRange(ctx context.Context, params protocol.SemanticTokensRangeParams) (protocol.SemanticTokens, error) {
109+ var result protocol.SemanticTokens
110+ err := c.Call(ctx, "textDocument/semanticTokens/range", params, &result)
111+ return result, err
112+}
113+
114+// LinkedEditingRange sends a textDocument/linkedEditingRange request to the LSP server.
115+// A request to provide ranges that can be edited together. Since 3.16.0
116+func (c *Client) LinkedEditingRange(ctx context.Context, params protocol.LinkedEditingRangeParams) (protocol.LinkedEditingRanges, error) {
117+ var result protocol.LinkedEditingRanges
118+ err := c.Call(ctx, "textDocument/linkedEditingRange", params, &result)
119+ return result, err
120+}
121+
122+// WillCreateFiles sends a workspace/willCreateFiles request to the LSP server.
123+// The will create files request is sent from the client to the server before files are actually created as long as the creation is triggered from within the client. The request can return a WorkspaceEdit which will be applied to workspace before the files are created. Hence the WorkspaceEdit can not manipulate the content of the file to be created. Since 3.16.0
124+func (c *Client) WillCreateFiles(ctx context.Context, params protocol.CreateFilesParams) (protocol.WorkspaceEdit, error) {
125+ var result protocol.WorkspaceEdit
126+ err := c.Call(ctx, "workspace/willCreateFiles", params, &result)
127+ return result, err
128+}
129+
130+// WillRenameFiles sends a workspace/willRenameFiles request to the LSP server.
131+// The will rename files request is sent from the client to the server before files are actually renamed as long as the rename is triggered from within the client. Since 3.16.0
132+func (c *Client) WillRenameFiles(ctx context.Context, params protocol.RenameFilesParams) (protocol.WorkspaceEdit, error) {
133+ var result protocol.WorkspaceEdit
134+ err := c.Call(ctx, "workspace/willRenameFiles", params, &result)
135+ return result, err
136+}
137+
138+// WillDeleteFiles sends a workspace/willDeleteFiles request to the LSP server.
139+// The did delete files notification is sent from the client to the server when files were deleted from within the client. Since 3.16.0
140+func (c *Client) WillDeleteFiles(ctx context.Context, params protocol.DeleteFilesParams) (protocol.WorkspaceEdit, error) {
141+ var result protocol.WorkspaceEdit
142+ err := c.Call(ctx, "workspace/willDeleteFiles", params, &result)
143+ return result, err
144+}
145+
146+// Moniker sends a textDocument/moniker request to the LSP server.
147+// A request to get the moniker of a symbol at a given text document position. The request parameter is of type TextDocumentPositionParams. The response is of type Moniker Moniker[] or null.
148+func (c *Client) Moniker(ctx context.Context, params protocol.MonikerParams) ([]protocol.Moniker, error) {
149+ var result []protocol.Moniker
150+ err := c.Call(ctx, "textDocument/moniker", params, &result)
151+ return result, err
152+}
153+
154+// PrepareTypeHierarchy sends a textDocument/prepareTypeHierarchy request to the LSP server.
155+// A request to result a TypeHierarchyItem in a document at a given position. Can be used as an input to a subtypes or supertypes type hierarchy. Since 3.17.0
156+func (c *Client) PrepareTypeHierarchy(ctx context.Context, params protocol.TypeHierarchyPrepareParams) ([]protocol.TypeHierarchyItem, error) {
157+ var result []protocol.TypeHierarchyItem
158+ err := c.Call(ctx, "textDocument/prepareTypeHierarchy", params, &result)
159+ return result, err
160+}
161+
162+// Supertypes sends a typeHierarchy/supertypes request to the LSP server.
163+// A request to resolve the supertypes for a given TypeHierarchyItem. Since 3.17.0
164+func (c *Client) Supertypes(ctx context.Context, params protocol.TypeHierarchySupertypesParams) ([]protocol.TypeHierarchyItem, error) {
165+ var result []protocol.TypeHierarchyItem
166+ err := c.Call(ctx, "typeHierarchy/supertypes", params, &result)
167+ return result, err
168+}
169+
170+// Subtypes sends a typeHierarchy/subtypes request to the LSP server.
171+// A request to resolve the subtypes for a given TypeHierarchyItem. Since 3.17.0
172+func (c *Client) Subtypes(ctx context.Context, params protocol.TypeHierarchySubtypesParams) ([]protocol.TypeHierarchyItem, error) {
173+ var result []protocol.TypeHierarchyItem
174+ err := c.Call(ctx, "typeHierarchy/subtypes", params, &result)
175+ return result, err
176+}
177+
178+// InlineValue sends a textDocument/inlineValue request to the LSP server.
179+// A request to provide inline values in a document. The request's parameter is of type InlineValueParams, the response is of type InlineValue InlineValue[] or a Thenable that resolves to such. Since 3.17.0
180+func (c *Client) InlineValue(ctx context.Context, params protocol.InlineValueParams) ([]protocol.InlineValue, error) {
181+ var result []protocol.InlineValue
182+ err := c.Call(ctx, "textDocument/inlineValue", params, &result)
183+ return result, err
184+}
185+
186+// InlayHint sends a textDocument/inlayHint request to the LSP server.
187+// A request to provide inlay hints in a document. The request's parameter is of type InlayHintsParams, the response is of type InlayHint InlayHint[] or a Thenable that resolves to such. Since 3.17.0
188+func (c *Client) InlayHint(ctx context.Context, params protocol.InlayHintParams) ([]protocol.InlayHint, error) {
189+ var result []protocol.InlayHint
190+ err := c.Call(ctx, "textDocument/inlayHint", params, &result)
191+ return result, err
192+}
193+
194+// Resolve sends a inlayHint/resolve request to the LSP server.
195+// A request to resolve additional properties for an inlay hint. The request's parameter is of type InlayHint, the response is of type InlayHint or a Thenable that resolves to such. Since 3.17.0
196+func (c *Client) Resolve(ctx context.Context, params protocol.InlayHint) (protocol.InlayHint, error) {
197+ var result protocol.InlayHint
198+ err := c.Call(ctx, "inlayHint/resolve", params, &result)
199+ return result, err
200+}
201+
202+// Diagnostic sends a textDocument/diagnostic request to the LSP server.
203+// The document diagnostic request definition. Since 3.17.0
204+func (c *Client) Diagnostic(ctx context.Context, params protocol.DocumentDiagnosticParams) (protocol.DocumentDiagnosticReport, error) {
205+ var result protocol.DocumentDiagnosticReport
206+ err := c.Call(ctx, "textDocument/diagnostic", params, &result)
207+ return result, err
208+}
209+
210+// DiagnosticWorkspace sends a workspace/diagnostic request to the LSP server.
211+// The workspace diagnostic request definition. Since 3.17.0
212+func (c *Client) DiagnosticWorkspace(ctx context.Context, params protocol.WorkspaceDiagnosticParams) (protocol.WorkspaceDiagnosticReport, error) {
213+ var result protocol.WorkspaceDiagnosticReport
214+ err := c.Call(ctx, "workspace/diagnostic", params, &result)
215+ return result, err
216+}
217+
218+// InlineCompletion sends a textDocument/inlineCompletion request to the LSP server.
219+// A request to provide inline completions in a document. The request's parameter is of type InlineCompletionParams, the response is of type InlineCompletion InlineCompletion[] or a Thenable that resolves to such. Since 3.18.0 PROPOSED
220+func (c *Client) InlineCompletion(ctx context.Context, params protocol.InlineCompletionParams) (protocol.Or_Result_textDocument_inlineCompletion, error) {
221+ var result protocol.Or_Result_textDocument_inlineCompletion
222+ err := c.Call(ctx, "textDocument/inlineCompletion", params, &result)
223+ return result, err
224+}
225+
226+// TextDocumentContent sends a workspace/textDocumentContent request to the LSP server.
227+// The workspace/textDocumentContent request is sent from the client to the server to request the content of a text document. Since 3.18.0 PROPOSED
228+func (c *Client) TextDocumentContent(ctx context.Context, params protocol.TextDocumentContentParams) (string, error) {
229+ var result string
230+ err := c.Call(ctx, "workspace/textDocumentContent", params, &result)
231+ return result, err
232+}
233+
234+// Initialize sends a initialize request to the LSP server.
235+// The initialize request is sent from the client to the server. It is sent once as the request after starting up the server. The requests parameter is of type InitializeParams the response if of type InitializeResult of a Thenable that resolves to such.
236+func (c *Client) Initialize(ctx context.Context, params protocol.ParamInitialize) (protocol.InitializeResult, error) {
237+ var result protocol.InitializeResult
238+ err := c.Call(ctx, "initialize", params, &result)
239+ return result, err
240+}
241+
242+// Shutdown sends a shutdown request to the LSP server.
243+// A shutdown request is sent from the client to the server. It is sent once when the client decides to shutdown the server. The only notification that is sent after a shutdown request is the exit event.
244+func (c *Client) Shutdown(ctx context.Context) error {
245+ return c.Call(ctx, "shutdown", nil, nil)
246+}
247+
248+// WillSaveWaitUntil sends a textDocument/willSaveWaitUntil request to the LSP server.
249+// A document will save request is sent from the client to the server before the document is actually saved. The request can return an array of TextEdits which will be applied to the text document before it is saved. Please note that clients might drop results if computing the text edits took too long or if a server constantly fails on this request. This is done to keep the save fast and reliable.
250+func (c *Client) WillSaveWaitUntil(ctx context.Context, params protocol.WillSaveTextDocumentParams) ([]protocol.TextEdit, error) {
251+ var result []protocol.TextEdit
252+ err := c.Call(ctx, "textDocument/willSaveWaitUntil", params, &result)
253+ return result, err
254+}
255+
256+// Completion sends a textDocument/completion request to the LSP server.
257+// Request to request completion at a given text document position. The request's parameter is of type TextDocumentPosition the response is of type CompletionItem CompletionItem[] or CompletionList or a Thenable that resolves to such. The request can delay the computation of the CompletionItem.detail detail and CompletionItem.documentation documentation properties to the completionItem/resolve request. However, properties that are needed for the initial sorting and filtering, like sortText, filterText, insertText, and textEdit, must not be changed during resolve.
258+func (c *Client) Completion(ctx context.Context, params protocol.CompletionParams) (protocol.Or_Result_textDocument_completion, error) {
259+ var result protocol.Or_Result_textDocument_completion
260+ err := c.Call(ctx, "textDocument/completion", params, &result)
261+ return result, err
262+}
263+
264+// ResolveCompletionItem sends a completionItem/resolve request to the LSP server.
265+// Request to resolve additional information for a given completion item.The request's parameter is of type CompletionItem the response is of type CompletionItem or a Thenable that resolves to such.
266+func (c *Client) ResolveCompletionItem(ctx context.Context, params protocol.CompletionItem) (protocol.CompletionItem, error) {
267+ var result protocol.CompletionItem
268+ err := c.Call(ctx, "completionItem/resolve", params, &result)
269+ return result, err
270+}
271+
272+// Hover sends a textDocument/hover request to the LSP server.
273+// Request to request hover information at a given text document position. The request's parameter is of type TextDocumentPosition the response is of type Hover or a Thenable that resolves to such.
274+func (c *Client) Hover(ctx context.Context, params protocol.HoverParams) (protocol.Hover, error) {
275+ var result protocol.Hover
276+ err := c.Call(ctx, "textDocument/hover", params, &result)
277+ return result, err
278+}
279+
280+// SignatureHelp sends a textDocument/signatureHelp request to the LSP server.
281+func (c *Client) SignatureHelp(ctx context.Context, params protocol.SignatureHelpParams) (protocol.SignatureHelp, error) {
282+ var result protocol.SignatureHelp
283+ err := c.Call(ctx, "textDocument/signatureHelp", params, &result)
284+ return result, err
285+}
286+
287+// Definition sends a textDocument/definition request to the LSP server.
288+// A request to resolve the definition location of a symbol at a given text document position. The request's parameter is of type TextDocumentPosition the response is of either type Definition or a typed array of DefinitionLink or a Thenable that resolves to such.
289+func (c *Client) Definition(ctx context.Context, params protocol.DefinitionParams) (protocol.Or_Result_textDocument_definition, error) {
290+ var result protocol.Or_Result_textDocument_definition
291+ err := c.Call(ctx, "textDocument/definition", params, &result)
292+ return result, err
293+}
294+
295+// References sends a textDocument/references request to the LSP server.
296+// A request to resolve project-wide references for the symbol denoted by the given text document position. The request's parameter is of type ReferenceParams the response is of type Location Location[] or a Thenable that resolves to such.
297+func (c *Client) References(ctx context.Context, params protocol.ReferenceParams) ([]protocol.Location, error) {
298+ var result []protocol.Location
299+ err := c.Call(ctx, "textDocument/references", params, &result)
300+ return result, err
301+}
302+
303+// DocumentHighlight sends a textDocument/documentHighlight request to the LSP server.
304+// Request to resolve a DocumentHighlight for a given text document position. The request's parameter is of type TextDocumentPosition the request response is an array of type DocumentHighlight or a Thenable that resolves to such.
305+func (c *Client) DocumentHighlight(ctx context.Context, params protocol.DocumentHighlightParams) ([]protocol.DocumentHighlight, error) {
306+ var result []protocol.DocumentHighlight
307+ err := c.Call(ctx, "textDocument/documentHighlight", params, &result)
308+ return result, err
309+}
310+
311+// DocumentSymbol sends a textDocument/documentSymbol request to the LSP server.
312+// A request to list all symbols found in a given text document. The request's parameter is of type TextDocumentIdentifier the response is of type SymbolInformation SymbolInformation[] or a Thenable that resolves to such.
313+func (c *Client) DocumentSymbol(ctx context.Context, params protocol.DocumentSymbolParams) (protocol.Or_Result_textDocument_documentSymbol, error) {
314+ var result protocol.Or_Result_textDocument_documentSymbol
315+ err := c.Call(ctx, "textDocument/documentSymbol", params, &result)
316+ return result, err
317+}
318+
319+// CodeAction sends a textDocument/codeAction request to the LSP server.
320+// A request to provide commands for the given text document and range.
321+func (c *Client) CodeAction(ctx context.Context, params protocol.CodeActionParams) ([]protocol.Or_Result_textDocument_codeAction_Item0_Elem, error) {
322+ var result []protocol.Or_Result_textDocument_codeAction_Item0_Elem
323+ err := c.Call(ctx, "textDocument/codeAction", params, &result)
324+ return result, err
325+}
326+
327+// ResolveCodeAction sends a codeAction/resolve request to the LSP server.
328+// Request to resolve additional information for a given code action.The request's parameter is of type CodeAction the response is of type CodeAction or a Thenable that resolves to such.
329+func (c *Client) ResolveCodeAction(ctx context.Context, params protocol.CodeAction) (protocol.CodeAction, error) {
330+ var result protocol.CodeAction
331+ err := c.Call(ctx, "codeAction/resolve", params, &result)
332+ return result, err
333+}
334+
335+// Symbol sends a workspace/symbol request to the LSP server.
336+// A request to list project-wide symbols matching the query string given by the WorkspaceSymbolParams. The response is of type SymbolInformation SymbolInformation[] or a Thenable that resolves to such. Since 3.17.0 - support for WorkspaceSymbol in the returned data. Clients need to advertise support for WorkspaceSymbols via the client capability workspace.symbol.resolveSupport.
337+func (c *Client) Symbol(ctx context.Context, params protocol.WorkspaceSymbolParams) (protocol.Or_Result_workspace_symbol, error) {
338+ var result protocol.Or_Result_workspace_symbol
339+ err := c.Call(ctx, "workspace/symbol", params, &result)
340+ return result, err
341+}
342+
343+// ResolveWorkspaceSymbol sends a workspaceSymbol/resolve request to the LSP server.
344+// A request to resolve the range inside the workspace symbol's location. Since 3.17.0
345+func (c *Client) ResolveWorkspaceSymbol(ctx context.Context, params protocol.WorkspaceSymbol) (protocol.WorkspaceSymbol, error) {
346+ var result protocol.WorkspaceSymbol
347+ err := c.Call(ctx, "workspaceSymbol/resolve", params, &result)
348+ return result, err
349+}
350+
351+// CodeLens sends a textDocument/codeLens request to the LSP server.
352+// A request to provide code lens for the given text document.
353+func (c *Client) CodeLens(ctx context.Context, params protocol.CodeLensParams) ([]protocol.CodeLens, error) {
354+ var result []protocol.CodeLens
355+ err := c.Call(ctx, "textDocument/codeLens", params, &result)
356+ return result, err
357+}
358+
359+// ResolveCodeLens sends a codeLens/resolve request to the LSP server.
360+// A request to resolve a command for a given code lens.
361+func (c *Client) ResolveCodeLens(ctx context.Context, params protocol.CodeLens) (protocol.CodeLens, error) {
362+ var result protocol.CodeLens
363+ err := c.Call(ctx, "codeLens/resolve", params, &result)
364+ return result, err
365+}
366+
367+// DocumentLink sends a textDocument/documentLink request to the LSP server.
368+// A request to provide document links
369+func (c *Client) DocumentLink(ctx context.Context, params protocol.DocumentLinkParams) ([]protocol.DocumentLink, error) {
370+ var result []protocol.DocumentLink
371+ err := c.Call(ctx, "textDocument/documentLink", params, &result)
372+ return result, err
373+}
374+
375+// ResolveDocumentLink sends a documentLink/resolve request to the LSP server.
376+// Request to resolve additional information for a given document link. The request's parameter is of type DocumentLink the response is of type DocumentLink or a Thenable that resolves to such.
377+func (c *Client) ResolveDocumentLink(ctx context.Context, params protocol.DocumentLink) (protocol.DocumentLink, error) {
378+ var result protocol.DocumentLink
379+ err := c.Call(ctx, "documentLink/resolve", params, &result)
380+ return result, err
381+}
382+
383+// Formatting sends a textDocument/formatting request to the LSP server.
384+// A request to format a whole document.
385+func (c *Client) Formatting(ctx context.Context, params protocol.DocumentFormattingParams) ([]protocol.TextEdit, error) {
386+ var result []protocol.TextEdit
387+ err := c.Call(ctx, "textDocument/formatting", params, &result)
388+ return result, err
389+}
390+
391+// RangeFormatting sends a textDocument/rangeFormatting request to the LSP server.
392+// A request to format a range in a document.
393+func (c *Client) RangeFormatting(ctx context.Context, params protocol.DocumentRangeFormattingParams) ([]protocol.TextEdit, error) {
394+ var result []protocol.TextEdit
395+ err := c.Call(ctx, "textDocument/rangeFormatting", params, &result)
396+ return result, err
397+}
398+
399+// RangesFormatting sends a textDocument/rangesFormatting request to the LSP server.
400+// A request to format ranges in a document. Since 3.18.0 PROPOSED
401+func (c *Client) RangesFormatting(ctx context.Context, params protocol.DocumentRangesFormattingParams) ([]protocol.TextEdit, error) {
402+ var result []protocol.TextEdit
403+ err := c.Call(ctx, "textDocument/rangesFormatting", params, &result)
404+ return result, err
405+}
406+
407+// OnTypeFormatting sends a textDocument/onTypeFormatting request to the LSP server.
408+// A request to format a document on type.
409+func (c *Client) OnTypeFormatting(ctx context.Context, params protocol.DocumentOnTypeFormattingParams) ([]protocol.TextEdit, error) {
410+ var result []protocol.TextEdit
411+ err := c.Call(ctx, "textDocument/onTypeFormatting", params, &result)
412+ return result, err
413+}
414+
415+// Rename sends a textDocument/rename request to the LSP server.
416+// A request to rename a symbol.
417+func (c *Client) Rename(ctx context.Context, params protocol.RenameParams) (protocol.WorkspaceEdit, error) {
418+ var result protocol.WorkspaceEdit
419+ err := c.Call(ctx, "textDocument/rename", params, &result)
420+ return result, err
421+}
422+
423+// PrepareRename sends a textDocument/prepareRename request to the LSP server.
424+// A request to test and perform the setup necessary for a rename. Since 3.16 - support for default behavior
425+func (c *Client) PrepareRename(ctx context.Context, params protocol.PrepareRenameParams) (protocol.PrepareRenameResult, error) {
426+ var result protocol.PrepareRenameResult
427+ err := c.Call(ctx, "textDocument/prepareRename", params, &result)
428+ return result, err
429+}
430+
431+// ExecuteCommand sends a workspace/executeCommand request to the LSP server.
432+// A request send from the client to the server to execute a command. The request might return a workspace edit which the client will apply to the workspace.
433+func (c *Client) ExecuteCommand(ctx context.Context, params protocol.ExecuteCommandParams) (any, error) {
434+ var result any
435+ err := c.Call(ctx, "workspace/executeCommand", params, &result)
436+ return result, err
437+}
438+
439+// DidChangeWorkspaceFolders sends a workspace/didChangeWorkspaceFolders notification to the LSP server.
440+// The workspace/didChangeWorkspaceFolders notification is sent from the client to the server when the workspace folder configuration changes.
441+func (c *Client) DidChangeWorkspaceFolders(ctx context.Context, params protocol.DidChangeWorkspaceFoldersParams) error {
442+ return c.Notify(ctx, "workspace/didChangeWorkspaceFolders", params)
443+}
444+
445+// WorkDoneProgressCancel sends a window/workDoneProgress/cancel notification to the LSP server.
446+// The window/workDoneProgress/cancel notification is sent from the client to the server to cancel a progress initiated on the server side.
447+func (c *Client) WorkDoneProgressCancel(ctx context.Context, params protocol.WorkDoneProgressCancelParams) error {
448+ return c.Notify(ctx, "window/workDoneProgress/cancel", params)
449+}
450+
451+// DidCreateFiles sends a workspace/didCreateFiles notification to the LSP server.
452+// The did create files notification is sent from the client to the server when files were created from within the client. Since 3.16.0
453+func (c *Client) DidCreateFiles(ctx context.Context, params protocol.CreateFilesParams) error {
454+ return c.Notify(ctx, "workspace/didCreateFiles", params)
455+}
456+
457+// DidRenameFiles sends a workspace/didRenameFiles notification to the LSP server.
458+// The did rename files notification is sent from the client to the server when files were renamed from within the client. Since 3.16.0
459+func (c *Client) DidRenameFiles(ctx context.Context, params protocol.RenameFilesParams) error {
460+ return c.Notify(ctx, "workspace/didRenameFiles", params)
461+}
462+
463+// DidDeleteFiles sends a workspace/didDeleteFiles notification to the LSP server.
464+// The will delete files request is sent from the client to the server before files are actually deleted as long as the deletion is triggered from within the client. Since 3.16.0
465+func (c *Client) DidDeleteFiles(ctx context.Context, params protocol.DeleteFilesParams) error {
466+ return c.Notify(ctx, "workspace/didDeleteFiles", params)
467+}
468+
469+// DidOpenNotebookDocument sends a notebookDocument/didOpen notification to the LSP server.
470+// A notification sent when a notebook opens. Since 3.17.0
471+func (c *Client) DidOpenNotebookDocument(ctx context.Context, params protocol.DidOpenNotebookDocumentParams) error {
472+ return c.Notify(ctx, "notebookDocument/didOpen", params)
473+}
474+
475+// DidChangeNotebookDocument sends a notebookDocument/didChange notification to the LSP server.
476+func (c *Client) DidChangeNotebookDocument(ctx context.Context, params protocol.DidChangeNotebookDocumentParams) error {
477+ return c.Notify(ctx, "notebookDocument/didChange", params)
478+}
479+
480+// DidSaveNotebookDocument sends a notebookDocument/didSave notification to the LSP server.
481+// A notification sent when a notebook document is saved. Since 3.17.0
482+func (c *Client) DidSaveNotebookDocument(ctx context.Context, params protocol.DidSaveNotebookDocumentParams) error {
483+ return c.Notify(ctx, "notebookDocument/didSave", params)
484+}
485+
486+// DidCloseNotebookDocument sends a notebookDocument/didClose notification to the LSP server.
487+// A notification sent when a notebook closes. Since 3.17.0
488+func (c *Client) DidCloseNotebookDocument(ctx context.Context, params protocol.DidCloseNotebookDocumentParams) error {
489+ return c.Notify(ctx, "notebookDocument/didClose", params)
490+}
491+
492+// Initialized sends a initialized notification to the LSP server.
493+// The initialized notification is sent from the client to the server after the client is fully initialized and the server is allowed to send requests from the server to the client.
494+func (c *Client) Initialized(ctx context.Context, params protocol.InitializedParams) error {
495+ return c.Notify(ctx, "initialized", params)
496+}
497+
498+// Exit sends a exit notification to the LSP server.
499+// The exit event is sent from the client to the server to ask the server to exit its process.
500+func (c *Client) Exit(ctx context.Context) error {
501+ return c.Notify(ctx, "exit", nil)
502+}
503+
504+// DidChangeConfiguration sends a workspace/didChangeConfiguration notification to the LSP server.
505+// The configuration change notification is sent from the client to the server when the client's configuration has changed. The notification contains the changed configuration as defined by the language client.
506+func (c *Client) DidChangeConfiguration(ctx context.Context, params protocol.DidChangeConfigurationParams) error {
507+ return c.Notify(ctx, "workspace/didChangeConfiguration", params)
508+}
509+
510+// DidOpen sends a textDocument/didOpen notification to the LSP server.
511+// The document open notification is sent from the client to the server to signal newly opened text documents. The document's truth is now managed by the client and the server must not try to read the document's truth using the document's uri. Open in this sense means it is managed by the client. It doesn't necessarily mean that its content is presented in an editor. An open notification must not be sent more than once without a corresponding close notification send before. This means open and close notification must be balanced and the max open count is one.
512+func (c *Client) DidOpen(ctx context.Context, params protocol.DidOpenTextDocumentParams) error {
513+ return c.Notify(ctx, "textDocument/didOpen", params)
514+}
515+
516+// DidChange sends a textDocument/didChange notification to the LSP server.
517+// The document change notification is sent from the client to the server to signal changes to a text document.
518+func (c *Client) DidChange(ctx context.Context, params protocol.DidChangeTextDocumentParams) error {
519+ return c.Notify(ctx, "textDocument/didChange", params)
520+}
521+
522+// DidClose sends a textDocument/didClose notification to the LSP server.
523+// The document close notification is sent from the client to the server when the document got closed in the client. The document's truth now exists where the document's uri points to (e.g. if the document's uri is a file uri the truth now exists on disk). As with the open notification the close notification is about managing the document's content. Receiving a close notification doesn't mean that the document was open in an editor before. A close notification requires a previous open notification to be sent.
524+func (c *Client) DidClose(ctx context.Context, params protocol.DidCloseTextDocumentParams) error {
525+ return c.Notify(ctx, "textDocument/didClose", params)
526+}
527+
528+// DidSave sends a textDocument/didSave notification to the LSP server.
529+// The document save notification is sent from the client to the server when the document got saved in the client.
530+func (c *Client) DidSave(ctx context.Context, params protocol.DidSaveTextDocumentParams) error {
531+ return c.Notify(ctx, "textDocument/didSave", params)
532+}
533+
534+// WillSave sends a textDocument/willSave notification to the LSP server.
535+// A document will save notification is sent from the client to the server before the document is actually saved.
536+func (c *Client) WillSave(ctx context.Context, params protocol.WillSaveTextDocumentParams) error {
537+ return c.Notify(ctx, "textDocument/willSave", params)
538+}
539+
540+// DidChangeWatchedFiles sends a workspace/didChangeWatchedFiles notification to the LSP server.
541+// The watched files notification is sent from the client to the server when the client detects changes to file watched by the language client.
542+func (c *Client) DidChangeWatchedFiles(ctx context.Context, params protocol.DidChangeWatchedFilesParams) error {
543+ return c.Notify(ctx, "workspace/didChangeWatchedFiles", params)
544+}
545+
546+// SetTrace sends a $/setTrace notification to the LSP server.
547+func (c *Client) SetTrace(ctx context.Context, params protocol.SetTraceParams) error {
548+ return c.Notify(ctx, "$/setTrace", params)
549+}
550+
551+// Progress sends a $/progress notification to the LSP server.
552+func (c *Client) Progress(ctx context.Context, params protocol.ProgressParams) error {
553+ return c.Notify(ctx, "$/progress", params)
554+}
internal/lsp/protocol.gonew file+48
@@ -0,0 +1,48 @@
1+package lsp
2+
3+import (
4+ "encoding/json"
5+)
6+
7+// Message represents a JSON-RPC 2.0 message
8+type Message struct {
9+ JSONRPC string `json:"jsonrpc"`
10+ ID int32 `json:"id,omitempty"`
11+ Method string `json:"method,omitempty"`
12+ Params json.RawMessage `json:"params,omitempty"`
13+ Result json.RawMessage `json:"result,omitempty"`
14+ Error *ResponseError `json:"error,omitempty"`
15+}
16+
17+// ResponseError represents a JSON-RPC 2.0 error
18+type ResponseError struct {
19+ Code int `json:"code"`
20+ Message string `json:"message"`
21+}
22+
23+func NewRequest(id int32, method string, params any) (*Message, error) {
24+ paramsJSON, err := json.Marshal(params)
25+ if err != nil {
26+ return nil, err
27+ }
28+
29+ return &Message{
30+ JSONRPC: "2.0",
31+ ID: id,
32+ Method: method,
33+ Params: paramsJSON,
34+ }, nil
35+}
36+
37+func NewNotification(method string, params any) (*Message, error) {
38+ paramsJSON, err := json.Marshal(params)
39+ if err != nil {
40+ return nil, err
41+ }
42+
43+ return &Message{
44+ JSONRPC: "2.0",
45+ Method: method,
46+ Params: paramsJSON,
47+ }, nil
48+}
internal/lsp/protocol/LICENSEnew file+27
@@ -0,0 +1,27 @@
1+Copyright 2009 The Go Authors.
2+
3+Redistribution and use in source and binary forms, with or without
4+modification, are permitted provided that the following conditions are
5+met:
6+
7+ * Redistributions of source code must retain the above copyright
8+notice, this list of conditions and the following disclaimer.
9+ * Redistributions in binary form must reproduce the above
10+copyright notice, this list of conditions and the following disclaimer
11+in the documentation and/or other materials provided with the
12+distribution.
13+ * Neither the name of Google LLC nor the names of its
14+contributors may be used to endorse or promote products derived from
15+this software without specific prior written permission.
16+
17+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
internal/lsp/protocol/interface.gonew file+117
@@ -0,0 +1,117 @@
1+package protocol
2+
3+import "fmt"
4+
5+// TextEditResult is an interface for types that represent workspace symbols
6+type WorkspaceSymbolResult interface {
7+ GetName() string
8+ GetLocation() Location
9+ isWorkspaceSymbol() // marker method
10+}
11+
12+func (ws *WorkspaceSymbol) GetName() string { return ws.Name }
13+func (ws *WorkspaceSymbol) GetLocation() Location {
14+ switch v := ws.Location.Value.(type) {
15+ case Location:
16+ return v
17+ case LocationUriOnly:
18+ return Location{URI: v.URI}
19+ }
20+ return Location{}
21+}
22+func (ws *WorkspaceSymbol) isWorkspaceSymbol() {}
23+
24+func (si *SymbolInformation) GetName() string { return si.Name }
25+func (si *SymbolInformation) GetLocation() Location { return si.Location }
26+func (si *SymbolInformation) isWorkspaceSymbol() {}
27+
28+// Results converts the Value to a slice of WorkspaceSymbolResult
29+func (r Or_Result_workspace_symbol) Results() ([]WorkspaceSymbolResult, error) {
30+ if r.Value == nil {
31+ return make([]WorkspaceSymbolResult, 0), nil
32+ }
33+ switch v := r.Value.(type) {
34+ case []WorkspaceSymbol:
35+ results := make([]WorkspaceSymbolResult, len(v))
36+ for i := range v {
37+ results[i] = &v[i]
38+ }
39+ return results, nil
40+ case []SymbolInformation:
41+ results := make([]WorkspaceSymbolResult, len(v))
42+ for i := range v {
43+ results[i] = &v[i]
44+ }
45+ return results, nil
46+ default:
47+ return nil, fmt.Errorf("unknown symbol type: %T", r.Value)
48+ }
49+}
50+
51+// TextEditResult is an interface for types that represent document symbols
52+type DocumentSymbolResult interface {
53+ GetRange() Range
54+ GetName() string
55+ isDocumentSymbol() // marker method
56+}
57+
58+func (ds *DocumentSymbol) GetRange() Range { return ds.Range }
59+func (ds *DocumentSymbol) GetName() string { return ds.Name }
60+func (ds *DocumentSymbol) isDocumentSymbol() {}
61+
62+func (si *SymbolInformation) GetRange() Range { return si.Location.Range }
63+
64+// Note: SymbolInformation already has GetName() implemented above
65+func (si *SymbolInformation) isDocumentSymbol() {}
66+
67+// Results converts the Value to a slice of DocumentSymbolResult
68+func (r Or_Result_textDocument_documentSymbol) Results() ([]DocumentSymbolResult, error) {
69+ if r.Value == nil {
70+ return make([]DocumentSymbolResult, 0), nil
71+ }
72+ switch v := r.Value.(type) {
73+ case []DocumentSymbol:
74+ results := make([]DocumentSymbolResult, len(v))
75+ for i := range v {
76+ results[i] = &v[i]
77+ }
78+ return results, nil
79+ case []SymbolInformation:
80+ results := make([]DocumentSymbolResult, len(v))
81+ for i := range v {
82+ results[i] = &v[i]
83+ }
84+ return results, nil
85+ default:
86+ return nil, fmt.Errorf("unknown document symbol type: %T", v)
87+ }
88+}
89+
90+// TextEditResult is an interface for types that can be used as text edits
91+type TextEditResult interface {
92+ GetRange() Range
93+ GetNewText() string
94+ isTextEdit() // marker method
95+}
96+
97+func (te *TextEdit) GetRange() Range { return te.Range }
98+func (te *TextEdit) GetNewText() string { return te.NewText }
99+func (te *TextEdit) isTextEdit() {}
100+
101+// Convert Or_TextDocumentEdit_edits_Elem to TextEdit
102+func (e Or_TextDocumentEdit_edits_Elem) AsTextEdit() (TextEdit, error) {
103+ if e.Value == nil {
104+ return TextEdit{}, fmt.Errorf("nil text edit")
105+ }
106+ switch v := e.Value.(type) {
107+ case TextEdit:
108+ return v, nil
109+ case AnnotatedTextEdit:
110+ return TextEdit{
111+ Range: v.Range,
112+ NewText: v.NewText,
113+ }, nil
114+ default:
115+ return TextEdit{}, fmt.Errorf("unknown text edit type: %T", e.Value)
116+ }
117+}
internal/lsp/protocol/pattern_interfaces.gonew file+58
@@ -0,0 +1,58 @@
1+package protocol
2+
3+import (
4+ "fmt"
5+ "strings"
6+)
7+
8+// PatternInfo is an interface for types that represent glob patterns
9+type PatternInfo interface {
10+ GetPattern() string
11+ GetBasePath() string
12+ isPattern() // marker method
13+}
14+
15+// StringPattern implements PatternInfo for string patterns
16+type StringPattern struct {
17+ Pattern string
18+}
19+
20+func (p StringPattern) GetPattern() string { return p.Pattern }
21+func (p StringPattern) GetBasePath() string { return "" }
22+func (p StringPattern) isPattern() {}
23+
24+// RelativePatternInfo implements PatternInfo for RelativePattern
25+type RelativePatternInfo struct {
26+ RP RelativePattern
27+ BasePath string
28+}
29+
30+func (p RelativePatternInfo) GetPattern() string { return string(p.RP.Pattern) }
31+func (p RelativePatternInfo) GetBasePath() string { return p.BasePath }
32+func (p RelativePatternInfo) isPattern() {}
33+
34+// AsPattern converts GlobPattern to a PatternInfo object
35+func (g *GlobPattern) AsPattern() (PatternInfo, error) {
36+ if g.Value == nil {
37+ return nil, fmt.Errorf("nil pattern")
38+ }
39+
40+ switch v := g.Value.(type) {
41+ case string:
42+ return StringPattern{Pattern: v}, nil
43+ case RelativePattern:
44+ // Handle BaseURI which could be string or DocumentUri
45+ basePath := ""
46+ switch baseURI := v.BaseURI.Value.(type) {
47+ case string:
48+ basePath = strings.TrimPrefix(baseURI, "file://")
49+ case DocumentUri:
50+ basePath = strings.TrimPrefix(string(baseURI), "file://")
51+ default:
52+ return nil, fmt.Errorf("unknown BaseURI type: %T", v.BaseURI.Value)
53+ }
54+ return RelativePatternInfo{RP: v, BasePath: basePath}, nil
55+ default:
56+ return nil, fmt.Errorf("unknown pattern type: %T", g.Value)
57+ }
58+}
internal/lsp/protocol/tables.gonew file+30
@@ -0,0 +1,30 @@
1+package protocol
2+
3+var TableKindMap = map[SymbolKind]string{
4+ File: "File",
5+ Module: "Module",
6+ Namespace: "Namespace",
7+ Package: "Package",
8+ Class: "Class",
9+ Method: "Method",
10+ Property: "Property",
11+ Field: "Field",
12+ Constructor: "Constructor",
13+ Enum: "Enum",
14+ Interface: "Interface",
15+ Function: "Function",
16+ Variable: "Variable",
17+ Constant: "Constant",
18+ String: "String",
19+ Number: "Number",
20+ Boolean: "Boolean",
21+ Array: "Array",
22+ Object: "Object",
23+ Key: "Key",
24+ Null: "Null",
25+ EnumMember: "EnumMember",
26+ Struct: "Struct",
27+ Event: "Event",
28+ Operator: "Operator",
29+ TypeParameter: "TypeParameter",
30+}
internal/lsp/protocol/tsdocument-changes.gonew file+81
@@ -0,0 +1,81 @@
1+// Copyright 2022 The Go Authors. All rights reserved.
2+// Use of this source code is governed by a BSD-style
3+// license that can be found in the LICENSE file.
4+
5+package protocol
6+
7+import (
8+ "encoding/json"
9+ "fmt"
10+)
11+
12+// DocumentChange is a union of various file edit operations.
13+//
14+// Exactly one field of this struct is non-nil; see [DocumentChange.Valid].
15+//
16+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#resourceChanges
17+type DocumentChange struct {
18+ TextDocumentEdit *TextDocumentEdit
19+ CreateFile *CreateFile
20+ RenameFile *RenameFile
21+ DeleteFile *DeleteFile
22+}
23+
24+// Valid reports whether the DocumentChange sum-type value is valid,
25+// that is, exactly one of create, delete, edit, or rename.
26+func (ch DocumentChange) Valid() bool {
27+ n := 0
28+ if ch.TextDocumentEdit != nil {
29+ n++
30+ }
31+ if ch.CreateFile != nil {
32+ n++
33+ }
34+ if ch.RenameFile != nil {
35+ n++
36+ }
37+ if ch.DeleteFile != nil {
38+ n++
39+ }
40+ return n == 1
41+}
42+
43+func (d *DocumentChange) UnmarshalJSON(data []byte) error {
44+ var m map[string]any
45+ if err := json.Unmarshal(data, &m); err != nil {
46+ return err
47+ }
48+
49+ if _, ok := m["textDocument"]; ok {
50+ d.TextDocumentEdit = new(TextDocumentEdit)
51+ return json.Unmarshal(data, d.TextDocumentEdit)
52+ }
53+
54+ // The {Create,Rename,Delete}File types all share a 'kind' field.
55+ kind := m["kind"]
56+ switch kind {
57+ case "create":
58+ d.CreateFile = new(CreateFile)
59+ return json.Unmarshal(data, d.CreateFile)
60+ case "rename":
61+ d.RenameFile = new(RenameFile)
62+ return json.Unmarshal(data, d.RenameFile)
63+ case "delete":
64+ d.DeleteFile = new(DeleteFile)
65+ return json.Unmarshal(data, d.DeleteFile)
66+ }
67+ return fmt.Errorf("DocumentChanges: unexpected kind: %q", kind)
68+}
69+
70+func (d *DocumentChange) MarshalJSON() ([]byte, error) {
71+ if d.TextDocumentEdit != nil {
72+ return json.Marshal(d.TextDocumentEdit)
73+ } else if d.CreateFile != nil {
74+ return json.Marshal(d.CreateFile)
75+ } else if d.RenameFile != nil {
76+ return json.Marshal(d.RenameFile)
77+ } else if d.DeleteFile != nil {
78+ return json.Marshal(d.DeleteFile)
79+ }
80+ return nil, fmt.Errorf("empty DocumentChanges union value")
81+}
internal/lsp/protocol/tsjson.gonew file+3072
@@ -0,0 +1,3072 @@
1+// Copyright 2023 The Go Authors. All rights reserved.
2+// Use of this source code is governed by a BSD-style
3+// license that can be found in the LICENSE file.
4+
5+// Code generated for LSP. DO NOT EDIT.
6+
7+package protocol
8+
9+// Code generated from protocol/metaModel.json at ref release/protocol/3.17.6-next.9 (hash c94395b5da53729e6dff931293b051009ccaaaa4).
10+// https://github.com/microsoft/vscode-languageserver-node/blob/release/protocol/3.17.6-next.9/protocol/metaModel.json
11+// LSP metaData.version = 3.17.0.
12+
13+import "bytes"
14+import "encoding/json"
15+
16+import "fmt"
17+
18+// UnmarshalError indicates that a JSON value did not conform to
19+// one of the expected cases of an LSP union type.
20+type UnmarshalError struct {
21+ msg string
22+}
23+
24+func (e UnmarshalError) Error() string {
25+ return e.msg
26+}
27+func (t Or_CancelParams_id) MarshalJSON() ([]byte, error) {
28+ switch x := t.Value.(type) {
29+ case int32:
30+ return json.Marshal(x)
31+ case string:
32+ return json.Marshal(x)
33+ case nil:
34+ return []byte("null"), nil
35+ }
36+ return nil, fmt.Errorf("type %T not one of [int32 string]", t)
37+}
38+
39+func (t *Or_CancelParams_id) UnmarshalJSON(x []byte) error {
40+ if string(x) == "null" {
41+ t.Value = nil
42+ return nil
43+ }
44+ decoder41 := json.NewDecoder(bytes.NewReader(x))
45+ decoder41.DisallowUnknownFields()
46+ var int32Val int32
47+ if err := decoder41.Decode(&int32Val); err == nil {
48+ t.Value = int32Val
49+ return nil
50+ }
51+ decoder42 := json.NewDecoder(bytes.NewReader(x))
52+ decoder42.DisallowUnknownFields()
53+ var stringVal string
54+ if err := decoder42.Decode(&stringVal); err == nil {
55+ t.Value = stringVal
56+ return nil
57+ }
58+ return &UnmarshalError{"unmarshal failed to match one of [int32 string]"}
59+}
60+
61+func (t Or_ClientSemanticTokensRequestOptions_full) MarshalJSON() ([]byte, error) {
62+ switch x := t.Value.(type) {
63+ case ClientSemanticTokensRequestFullDelta:
64+ return json.Marshal(x)
65+ case bool:
66+ return json.Marshal(x)
67+ case nil:
68+ return []byte("null"), nil
69+ }
70+ return nil, fmt.Errorf("type %T not one of [ClientSemanticTokensRequestFullDelta bool]", t)
71+}
72+
73+func (t *Or_ClientSemanticTokensRequestOptions_full) UnmarshalJSON(x []byte) error {
74+ if string(x) == "null" {
75+ t.Value = nil
76+ return nil
77+ }
78+ decoder220 := json.NewDecoder(bytes.NewReader(x))
79+ decoder220.DisallowUnknownFields()
80+ var boolVal bool
81+ if err := decoder220.Decode(&boolVal); err == nil {
82+ t.Value = boolVal
83+ return nil
84+ }
85+ decoder221 := json.NewDecoder(bytes.NewReader(x))
86+ decoder221.DisallowUnknownFields()
87+ var h221 ClientSemanticTokensRequestFullDelta
88+ if err := decoder221.Decode(&h221); err == nil {
89+ t.Value = h221
90+ return nil
91+ }
92+ return &UnmarshalError{"unmarshal failed to match one of [ClientSemanticTokensRequestFullDelta bool]"}
93+}
94+
95+func (t Or_ClientSemanticTokensRequestOptions_range) MarshalJSON() ([]byte, error) {
96+ switch x := t.Value.(type) {
97+ case Lit_ClientSemanticTokensRequestOptions_range_Item1:
98+ return json.Marshal(x)
99+ case bool:
100+ return json.Marshal(x)
101+ case nil:
102+ return []byte("null"), nil
103+ }
104+ return nil, fmt.Errorf("type %T not one of [Lit_ClientSemanticTokensRequestOptions_range_Item1 bool]", t)
105+}
106+
107+func (t *Or_ClientSemanticTokensRequestOptions_range) UnmarshalJSON(x []byte) error {
108+ if string(x) == "null" {
109+ t.Value = nil
110+ return nil
111+ }
112+ decoder217 := json.NewDecoder(bytes.NewReader(x))
113+ decoder217.DisallowUnknownFields()
114+ var boolVal bool
115+ if err := decoder217.Decode(&boolVal); err == nil {
116+ t.Value = boolVal
117+ return nil
118+ }
119+ decoder218 := json.NewDecoder(bytes.NewReader(x))
120+ decoder218.DisallowUnknownFields()
121+ var h218 Lit_ClientSemanticTokensRequestOptions_range_Item1
122+ if err := decoder218.Decode(&h218); err == nil {
123+ t.Value = h218
124+ return nil
125+ }
126+ return &UnmarshalError{"unmarshal failed to match one of [Lit_ClientSemanticTokensRequestOptions_range_Item1 bool]"}
127+}
128+
129+func (t Or_CompletionItemDefaults_editRange) MarshalJSON() ([]byte, error) {
130+ switch x := t.Value.(type) {
131+ case EditRangeWithInsertReplace:
132+ return json.Marshal(x)
133+ case Range:
134+ return json.Marshal(x)
135+ case nil:
136+ return []byte("null"), nil
137+ }
138+ return nil, fmt.Errorf("type %T not one of [EditRangeWithInsertReplace Range]", t)
139+}
140+
141+func (t *Or_CompletionItemDefaults_editRange) UnmarshalJSON(x []byte) error {
142+ if string(x) == "null" {
143+ t.Value = nil
144+ return nil
145+ }
146+ decoder183 := json.NewDecoder(bytes.NewReader(x))
147+ decoder183.DisallowUnknownFields()
148+ var h183 EditRangeWithInsertReplace
149+ if err := decoder183.Decode(&h183); err == nil {
150+ t.Value = h183
151+ return nil
152+ }
153+ decoder184 := json.NewDecoder(bytes.NewReader(x))
154+ decoder184.DisallowUnknownFields()
155+ var h184 Range
156+ if err := decoder184.Decode(&h184); err == nil {
157+ t.Value = h184
158+ return nil
159+ }
160+ return &UnmarshalError{"unmarshal failed to match one of [EditRangeWithInsertReplace Range]"}
161+}
162+
163+func (t Or_CompletionItem_documentation) MarshalJSON() ([]byte, error) {
164+ switch x := t.Value.(type) {
165+ case MarkupContent:
166+ return json.Marshal(x)
167+ case string:
168+ return json.Marshal(x)
169+ case nil:
170+ return []byte("null"), nil
171+ }
172+ return nil, fmt.Errorf("type %T not one of [MarkupContent string]", t)
173+}
174+
175+func (t *Or_CompletionItem_documentation) UnmarshalJSON(x []byte) error {
176+ if string(x) == "null" {
177+ t.Value = nil
178+ return nil
179+ }
180+ decoder25 := json.NewDecoder(bytes.NewReader(x))
181+ decoder25.DisallowUnknownFields()
182+ var stringVal string
183+ if err := decoder25.Decode(&stringVal); err == nil {
184+ t.Value = stringVal
185+ return nil
186+ }
187+ decoder26 := json.NewDecoder(bytes.NewReader(x))
188+ decoder26.DisallowUnknownFields()
189+ var h26 MarkupContent
190+ if err := decoder26.Decode(&h26); err == nil {
191+ t.Value = h26
192+ return nil
193+ }
194+ return &UnmarshalError{"unmarshal failed to match one of [MarkupContent string]"}
195+}
196+
197+func (t Or_CompletionItem_textEdit) MarshalJSON() ([]byte, error) {
198+ switch x := t.Value.(type) {
199+ case InsertReplaceEdit:
200+ return json.Marshal(x)
201+ case TextEdit:
202+ return json.Marshal(x)
203+ case nil:
204+ return []byte("null"), nil
205+ }
206+ return nil, fmt.Errorf("type %T not one of [InsertReplaceEdit TextEdit]", t)
207+}
208+
209+func (t *Or_CompletionItem_textEdit) UnmarshalJSON(x []byte) error {
210+ if string(x) == "null" {
211+ t.Value = nil
212+ return nil
213+ }
214+ decoder29 := json.NewDecoder(bytes.NewReader(x))
215+ decoder29.DisallowUnknownFields()
216+ var h29 InsertReplaceEdit
217+ if err := decoder29.Decode(&h29); err == nil {
218+ t.Value = h29
219+ return nil
220+ }
221+ decoder30 := json.NewDecoder(bytes.NewReader(x))
222+ decoder30.DisallowUnknownFields()
223+ var h30 TextEdit
224+ if err := decoder30.Decode(&h30); err == nil {
225+ t.Value = h30
226+ return nil
227+ }
228+ return &UnmarshalError{"unmarshal failed to match one of [InsertReplaceEdit TextEdit]"}
229+}
230+
231+func (t Or_Declaration) MarshalJSON() ([]byte, error) {
232+ switch x := t.Value.(type) {
233+ case Location:
234+ return json.Marshal(x)
235+ case []Location:
236+ return json.Marshal(x)
237+ case nil:
238+ return []byte("null"), nil
239+ }
240+ return nil, fmt.Errorf("type %T not one of [Location []Location]", t)
241+}
242+
243+func (t *Or_Declaration) UnmarshalJSON(x []byte) error {
244+ if string(x) == "null" {
245+ t.Value = nil
246+ return nil
247+ }
248+ decoder237 := json.NewDecoder(bytes.NewReader(x))
249+ decoder237.DisallowUnknownFields()
250+ var h237 Location
251+ if err := decoder237.Decode(&h237); err == nil {
252+ t.Value = h237
253+ return nil
254+ }
255+ decoder238 := json.NewDecoder(bytes.NewReader(x))
256+ decoder238.DisallowUnknownFields()
257+ var h238 []Location
258+ if err := decoder238.Decode(&h238); err == nil {
259+ t.Value = h238
260+ return nil
261+ }
262+ return &UnmarshalError{"unmarshal failed to match one of [Location []Location]"}
263+}
264+
265+func (t Or_Definition) MarshalJSON() ([]byte, error) {
266+ switch x := t.Value.(type) {
267+ case Location:
268+ return json.Marshal(x)
269+ case []Location:
270+ return json.Marshal(x)
271+ case nil:
272+ return []byte("null"), nil
273+ }
274+ return nil, fmt.Errorf("type %T not one of [Location []Location]", t)
275+}
276+
277+func (t *Or_Definition) UnmarshalJSON(x []byte) error {
278+ if string(x) == "null" {
279+ t.Value = nil
280+ return nil
281+ }
282+ decoder224 := json.NewDecoder(bytes.NewReader(x))
283+ decoder224.DisallowUnknownFields()
284+ var h224 Location
285+ if err := decoder224.Decode(&h224); err == nil {
286+ t.Value = h224
287+ return nil
288+ }
289+ decoder225 := json.NewDecoder(bytes.NewReader(x))
290+ decoder225.DisallowUnknownFields()
291+ var h225 []Location
292+ if err := decoder225.Decode(&h225); err == nil {
293+ t.Value = h225
294+ return nil
295+ }
296+ return &UnmarshalError{"unmarshal failed to match one of [Location []Location]"}
297+}
298+
299+func (t Or_Diagnostic_code) MarshalJSON() ([]byte, error) {
300+ switch x := t.Value.(type) {
301+ case int32:
302+ return json.Marshal(x)
303+ case string:
304+ return json.Marshal(x)
305+ case nil:
306+ return []byte("null"), nil
307+ }
308+ return nil, fmt.Errorf("type %T not one of [int32 string]", t)
309+}
310+
311+func (t *Or_Diagnostic_code) UnmarshalJSON(x []byte) error {
312+ if string(x) == "null" {
313+ t.Value = nil
314+ return nil
315+ }
316+ decoder179 := json.NewDecoder(bytes.NewReader(x))
317+ decoder179.DisallowUnknownFields()
318+ var int32Val int32
319+ if err := decoder179.Decode(&int32Val); err == nil {
320+ t.Value = int32Val
321+ return nil
322+ }
323+ decoder180 := json.NewDecoder(bytes.NewReader(x))
324+ decoder180.DisallowUnknownFields()
325+ var stringVal string
326+ if err := decoder180.Decode(&stringVal); err == nil {
327+ t.Value = stringVal
328+ return nil
329+ }
330+ return &UnmarshalError{"unmarshal failed to match one of [int32 string]"}
331+}
332+
333+func (t Or_DidChangeConfigurationRegistrationOptions_section) MarshalJSON() ([]byte, error) {
334+ switch x := t.Value.(type) {
335+ case []string:
336+ return json.Marshal(x)
337+ case string:
338+ return json.Marshal(x)
339+ case nil:
340+ return []byte("null"), nil
341+ }
342+ return nil, fmt.Errorf("type %T not one of [[]string string]", t)
343+}
344+
345+func (t *Or_DidChangeConfigurationRegistrationOptions_section) UnmarshalJSON(x []byte) error {
346+ if string(x) == "null" {
347+ t.Value = nil
348+ return nil
349+ }
350+ decoder22 := json.NewDecoder(bytes.NewReader(x))
351+ decoder22.DisallowUnknownFields()
352+ var stringVal string
353+ if err := decoder22.Decode(&stringVal); err == nil {
354+ t.Value = stringVal
355+ return nil
356+ }
357+ decoder23 := json.NewDecoder(bytes.NewReader(x))
358+ decoder23.DisallowUnknownFields()
359+ var h23 []string
360+ if err := decoder23.Decode(&h23); err == nil {
361+ t.Value = h23
362+ return nil
363+ }
364+ return &UnmarshalError{"unmarshal failed to match one of [[]string string]"}
365+}
366+
367+func (t Or_DocumentDiagnosticReport) MarshalJSON() ([]byte, error) {
368+ switch x := t.Value.(type) {
369+ case RelatedFullDocumentDiagnosticReport:
370+ return json.Marshal(x)
371+ case RelatedUnchangedDocumentDiagnosticReport:
372+ return json.Marshal(x)
373+ case nil:
374+ return []byte("null"), nil
375+ }
376+ return nil, fmt.Errorf("type %T not one of [RelatedFullDocumentDiagnosticReport RelatedUnchangedDocumentDiagnosticReport]", t)
377+}
378+
379+func (t *Or_DocumentDiagnosticReport) UnmarshalJSON(x []byte) error {
380+ if string(x) == "null" {
381+ t.Value = nil
382+ return nil
383+ }
384+ decoder247 := json.NewDecoder(bytes.NewReader(x))
385+ decoder247.DisallowUnknownFields()
386+ var h247 RelatedFullDocumentDiagnosticReport
387+ if err := decoder247.Decode(&h247); err == nil {
388+ t.Value = h247
389+ return nil
390+ }
391+ decoder248 := json.NewDecoder(bytes.NewReader(x))
392+ decoder248.DisallowUnknownFields()
393+ var h248 RelatedUnchangedDocumentDiagnosticReport
394+ if err := decoder248.Decode(&h248); err == nil {
395+ t.Value = h248
396+ return nil
397+ }
398+ return &UnmarshalError{"unmarshal failed to match one of [RelatedFullDocumentDiagnosticReport RelatedUnchangedDocumentDiagnosticReport]"}
399+}
400+
401+func (t Or_DocumentDiagnosticReportPartialResult_relatedDocuments_Value) MarshalJSON() ([]byte, error) {
402+ switch x := t.Value.(type) {
403+ case FullDocumentDiagnosticReport:
404+ return json.Marshal(x)
405+ case UnchangedDocumentDiagnosticReport:
406+ return json.Marshal(x)
407+ case nil:
408+ return []byte("null"), nil
409+ }
410+ return nil, fmt.Errorf("type %T not one of [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]", t)
411+}
412+
413+func (t *Or_DocumentDiagnosticReportPartialResult_relatedDocuments_Value) UnmarshalJSON(x []byte) error {
414+ if string(x) == "null" {
415+ t.Value = nil
416+ return nil
417+ }
418+ decoder16 := json.NewDecoder(bytes.NewReader(x))
419+ decoder16.DisallowUnknownFields()
420+ var h16 FullDocumentDiagnosticReport
421+ if err := decoder16.Decode(&h16); err == nil {
422+ t.Value = h16
423+ return nil
424+ }
425+ decoder17 := json.NewDecoder(bytes.NewReader(x))
426+ decoder17.DisallowUnknownFields()
427+ var h17 UnchangedDocumentDiagnosticReport
428+ if err := decoder17.Decode(&h17); err == nil {
429+ t.Value = h17
430+ return nil
431+ }
432+ return &UnmarshalError{"unmarshal failed to match one of [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]"}
433+}
434+
435+func (t Or_DocumentFilter) MarshalJSON() ([]byte, error) {
436+ switch x := t.Value.(type) {
437+ case NotebookCellTextDocumentFilter:
438+ return json.Marshal(x)
439+ case TextDocumentFilter:
440+ return json.Marshal(x)
441+ case nil:
442+ return []byte("null"), nil
443+ }
444+ return nil, fmt.Errorf("type %T not one of [NotebookCellTextDocumentFilter TextDocumentFilter]", t)
445+}
446+
447+func (t *Or_DocumentFilter) UnmarshalJSON(x []byte) error {
448+ if string(x) == "null" {
449+ t.Value = nil
450+ return nil
451+ }
452+ decoder270 := json.NewDecoder(bytes.NewReader(x))
453+ decoder270.DisallowUnknownFields()
454+ var h270 NotebookCellTextDocumentFilter
455+ if err := decoder270.Decode(&h270); err == nil {
456+ t.Value = h270
457+ return nil
458+ }
459+ decoder271 := json.NewDecoder(bytes.NewReader(x))
460+ decoder271.DisallowUnknownFields()
461+ var h271 TextDocumentFilter
462+ if err := decoder271.Decode(&h271); err == nil {
463+ t.Value = h271
464+ return nil
465+ }
466+ return &UnmarshalError{"unmarshal failed to match one of [NotebookCellTextDocumentFilter TextDocumentFilter]"}
467+}
468+
469+func (t Or_GlobPattern) MarshalJSON() ([]byte, error) {
470+ switch x := t.Value.(type) {
471+ case Pattern:
472+ return json.Marshal(x)
473+ case RelativePattern:
474+ return json.Marshal(x)
475+ case nil:
476+ return []byte("null"), nil
477+ }
478+ return nil, fmt.Errorf("type %T not one of [Pattern RelativePattern]", t)
479+}
480+
481+func (t *Or_GlobPattern) UnmarshalJSON(x []byte) error {
482+ if string(x) == "null" {
483+ t.Value = nil
484+ return nil
485+ }
486+ decoder274 := json.NewDecoder(bytes.NewReader(x))
487+ decoder274.DisallowUnknownFields()
488+ var h274 Pattern
489+ if err := decoder274.Decode(&h274); err == nil {
490+ t.Value = h274
491+ return nil
492+ }
493+ decoder275 := json.NewDecoder(bytes.NewReader(x))
494+ decoder275.DisallowUnknownFields()
495+ var h275 RelativePattern
496+ if err := decoder275.Decode(&h275); err == nil {
497+ t.Value = h275
498+ return nil
499+ }
500+ return &UnmarshalError{"unmarshal failed to match one of [Pattern RelativePattern]"}
501+}
502+
503+func (t Or_Hover_contents) MarshalJSON() ([]byte, error) {
504+ switch x := t.Value.(type) {
505+ case MarkedString:
506+ return json.Marshal(x)
507+ case MarkupContent:
508+ return json.Marshal(x)
509+ case []MarkedString:
510+ return json.Marshal(x)
511+ case nil:
512+ return []byte("null"), nil
513+ }
514+ return nil, fmt.Errorf("type %T not one of [MarkedString MarkupContent []MarkedString]", t)
515+}
516+
517+func (t *Or_Hover_contents) UnmarshalJSON(x []byte) error {
518+ if string(x) == "null" {
519+ t.Value = nil
520+ return nil
521+ }
522+ decoder34 := json.NewDecoder(bytes.NewReader(x))
523+ decoder34.DisallowUnknownFields()
524+ var h34 MarkedString
525+ if err := decoder34.Decode(&h34); err == nil {
526+ t.Value = h34
527+ return nil
528+ }
529+ decoder35 := json.NewDecoder(bytes.NewReader(x))
530+ decoder35.DisallowUnknownFields()
531+ var h35 MarkupContent
532+ if err := decoder35.Decode(&h35); err == nil {
533+ t.Value = h35
534+ return nil
535+ }
536+ decoder36 := json.NewDecoder(bytes.NewReader(x))
537+ decoder36.DisallowUnknownFields()
538+ var h36 []MarkedString
539+ if err := decoder36.Decode(&h36); err == nil {
540+ t.Value = h36
541+ return nil
542+ }
543+ return &UnmarshalError{"unmarshal failed to match one of [MarkedString MarkupContent []MarkedString]"}
544+}
545+
546+func (t Or_InlayHintLabelPart_tooltip) MarshalJSON() ([]byte, error) {
547+ switch x := t.Value.(type) {
548+ case MarkupContent:
549+ return json.Marshal(x)
550+ case string:
551+ return json.Marshal(x)
552+ case nil:
553+ return []byte("null"), nil
554+ }
555+ return nil, fmt.Errorf("type %T not one of [MarkupContent string]", t)
556+}
557+
558+func (t *Or_InlayHintLabelPart_tooltip) UnmarshalJSON(x []byte) error {
559+ if string(x) == "null" {
560+ t.Value = nil
561+ return nil
562+ }
563+ decoder56 := json.NewDecoder(bytes.NewReader(x))
564+ decoder56.DisallowUnknownFields()
565+ var stringVal string
566+ if err := decoder56.Decode(&stringVal); err == nil {
567+ t.Value = stringVal
568+ return nil
569+ }
570+ decoder57 := json.NewDecoder(bytes.NewReader(x))
571+ decoder57.DisallowUnknownFields()
572+ var h57 MarkupContent
573+ if err := decoder57.Decode(&h57); err == nil {
574+ t.Value = h57
575+ return nil
576+ }
577+ return &UnmarshalError{"unmarshal failed to match one of [MarkupContent string]"}
578+}
579+
580+func (t Or_InlayHint_label) MarshalJSON() ([]byte, error) {
581+ switch x := t.Value.(type) {
582+ case []InlayHintLabelPart:
583+ return json.Marshal(x)
584+ case string:
585+ return json.Marshal(x)
586+ case nil:
587+ return []byte("null"), nil
588+ }
589+ return nil, fmt.Errorf("type %T not one of [[]InlayHintLabelPart string]", t)
590+}
591+
592+func (t *Or_InlayHint_label) UnmarshalJSON(x []byte) error {
593+ if string(x) == "null" {
594+ t.Value = nil
595+ return nil
596+ }
597+ decoder9 := json.NewDecoder(bytes.NewReader(x))
598+ decoder9.DisallowUnknownFields()
599+ var stringVal string
600+ if err := decoder9.Decode(&stringVal); err == nil {
601+ t.Value = stringVal
602+ return nil
603+ }
604+ decoder10 := json.NewDecoder(bytes.NewReader(x))
605+ decoder10.DisallowUnknownFields()
606+ var h10 []InlayHintLabelPart
607+ if err := decoder10.Decode(&h10); err == nil {
608+ t.Value = h10
609+ return nil
610+ }
611+ return &UnmarshalError{"unmarshal failed to match one of [[]InlayHintLabelPart string]"}
612+}
613+
614+func (t Or_InlayHint_tooltip) MarshalJSON() ([]byte, error) {
615+ switch x := t.Value.(type) {
616+ case MarkupContent:
617+ return json.Marshal(x)
618+ case string:
619+ return json.Marshal(x)
620+ case nil:
621+ return []byte("null"), nil
622+ }
623+ return nil, fmt.Errorf("type %T not one of [MarkupContent string]", t)
624+}
625+
626+func (t *Or_InlayHint_tooltip) UnmarshalJSON(x []byte) error {
627+ if string(x) == "null" {
628+ t.Value = nil
629+ return nil
630+ }
631+ decoder12 := json.NewDecoder(bytes.NewReader(x))
632+ decoder12.DisallowUnknownFields()
633+ var stringVal string
634+ if err := decoder12.Decode(&stringVal); err == nil {
635+ t.Value = stringVal
636+ return nil
637+ }
638+ decoder13 := json.NewDecoder(bytes.NewReader(x))
639+ decoder13.DisallowUnknownFields()
640+ var h13 MarkupContent
641+ if err := decoder13.Decode(&h13); err == nil {
642+ t.Value = h13
643+ return nil
644+ }
645+ return &UnmarshalError{"unmarshal failed to match one of [MarkupContent string]"}
646+}
647+
648+func (t Or_InlineCompletionItem_insertText) MarshalJSON() ([]byte, error) {
649+ switch x := t.Value.(type) {
650+ case StringValue:
651+ return json.Marshal(x)
652+ case string:
653+ return json.Marshal(x)
654+ case nil:
655+ return []byte("null"), nil
656+ }
657+ return nil, fmt.Errorf("type %T not one of [StringValue string]", t)
658+}
659+
660+func (t *Or_InlineCompletionItem_insertText) UnmarshalJSON(x []byte) error {
661+ if string(x) == "null" {
662+ t.Value = nil
663+ return nil
664+ }
665+ decoder19 := json.NewDecoder(bytes.NewReader(x))
666+ decoder19.DisallowUnknownFields()
667+ var stringVal string
668+ if err := decoder19.Decode(&stringVal); err == nil {
669+ t.Value = stringVal
670+ return nil
671+ }
672+ decoder20 := json.NewDecoder(bytes.NewReader(x))
673+ decoder20.DisallowUnknownFields()
674+ var h20 StringValue
675+ if err := decoder20.Decode(&h20); err == nil {
676+ t.Value = h20
677+ return nil
678+ }
679+ return &UnmarshalError{"unmarshal failed to match one of [StringValue string]"}
680+}
681+
682+func (t Or_InlineValue) MarshalJSON() ([]byte, error) {
683+ switch x := t.Value.(type) {
684+ case InlineValueEvaluatableExpression:
685+ return json.Marshal(x)
686+ case InlineValueText:
687+ return json.Marshal(x)
688+ case InlineValueVariableLookup:
689+ return json.Marshal(x)
690+ case nil:
691+ return []byte("null"), nil
692+ }
693+ return nil, fmt.Errorf("type %T not one of [InlineValueEvaluatableExpression InlineValueText InlineValueVariableLookup]", t)
694+}
695+
696+func (t *Or_InlineValue) UnmarshalJSON(x []byte) error {
697+ if string(x) == "null" {
698+ t.Value = nil
699+ return nil
700+ }
701+ decoder242 := json.NewDecoder(bytes.NewReader(x))
702+ decoder242.DisallowUnknownFields()
703+ var h242 InlineValueEvaluatableExpression
704+ if err := decoder242.Decode(&h242); err == nil {
705+ t.Value = h242
706+ return nil
707+ }
708+ decoder243 := json.NewDecoder(bytes.NewReader(x))
709+ decoder243.DisallowUnknownFields()
710+ var h243 InlineValueText
711+ if err := decoder243.Decode(&h243); err == nil {
712+ t.Value = h243
713+ return nil
714+ }
715+ decoder244 := json.NewDecoder(bytes.NewReader(x))
716+ decoder244.DisallowUnknownFields()
717+ var h244 InlineValueVariableLookup
718+ if err := decoder244.Decode(&h244); err == nil {
719+ t.Value = h244
720+ return nil
721+ }
722+ return &UnmarshalError{"unmarshal failed to match one of [InlineValueEvaluatableExpression InlineValueText InlineValueVariableLookup]"}
723+}
724+
725+func (t Or_LSPAny) MarshalJSON() ([]byte, error) {
726+ switch x := t.Value.(type) {
727+ case LSPArray:
728+ return json.Marshal(x)
729+ case LSPObject:
730+ return json.Marshal(x)
731+ case bool:
732+ return json.Marshal(x)
733+ case float64:
734+ return json.Marshal(x)
735+ case int32:
736+ return json.Marshal(x)
737+ case string:
738+ return json.Marshal(x)
739+ case uint32:
740+ return json.Marshal(x)
741+ case nil:
742+ return []byte("null"), nil
743+ }
744+ return nil, fmt.Errorf("type %T not one of [LSPArray LSPObject bool float64 int32 string uint32]", t)
745+}
746+
747+func (t *Or_LSPAny) UnmarshalJSON(x []byte) error {
748+ if string(x) == "null" {
749+ t.Value = nil
750+ return nil
751+ }
752+ decoder228 := json.NewDecoder(bytes.NewReader(x))
753+ decoder228.DisallowUnknownFields()
754+ var boolVal bool
755+ if err := decoder228.Decode(&boolVal); err == nil {
756+ t.Value = boolVal
757+ return nil
758+ }
759+ decoder229 := json.NewDecoder(bytes.NewReader(x))
760+ decoder229.DisallowUnknownFields()
761+ var float64Val float64
762+ if err := decoder229.Decode(&float64Val); err == nil {
763+ t.Value = float64Val
764+ return nil
765+ }
766+ decoder230 := json.NewDecoder(bytes.NewReader(x))
767+ decoder230.DisallowUnknownFields()
768+ var int32Val int32
769+ if err := decoder230.Decode(&int32Val); err == nil {
770+ t.Value = int32Val
771+ return nil
772+ }
773+ decoder231 := json.NewDecoder(bytes.NewReader(x))
774+ decoder231.DisallowUnknownFields()
775+ var stringVal string
776+ if err := decoder231.Decode(&stringVal); err == nil {
777+ t.Value = stringVal
778+ return nil
779+ }
780+ decoder232 := json.NewDecoder(bytes.NewReader(x))
781+ decoder232.DisallowUnknownFields()
782+ var uint32Val uint32
783+ if err := decoder232.Decode(&uint32Val); err == nil {
784+ t.Value = uint32Val
785+ return nil
786+ }
787+ decoder233 := json.NewDecoder(bytes.NewReader(x))
788+ decoder233.DisallowUnknownFields()
789+ var h233 LSPArray
790+ if err := decoder233.Decode(&h233); err == nil {
791+ t.Value = h233
792+ return nil
793+ }
794+ decoder234 := json.NewDecoder(bytes.NewReader(x))
795+ decoder234.DisallowUnknownFields()
796+ var h234 LSPObject
797+ if err := decoder234.Decode(&h234); err == nil {
798+ t.Value = h234
799+ return nil
800+ }
801+ return &UnmarshalError{"unmarshal failed to match one of [LSPArray LSPObject bool float64 int32 string uint32]"}
802+}
803+
804+func (t Or_MarkedString) MarshalJSON() ([]byte, error) {
805+ switch x := t.Value.(type) {
806+ case MarkedStringWithLanguage:
807+ return json.Marshal(x)
808+ case string:
809+ return json.Marshal(x)
810+ case nil:
811+ return []byte("null"), nil
812+ }
813+ return nil, fmt.Errorf("type %T not one of [MarkedStringWithLanguage string]", t)
814+}
815+
816+func (t *Or_MarkedString) UnmarshalJSON(x []byte) error {
817+ if string(x) == "null" {
818+ t.Value = nil
819+ return nil
820+ }
821+ decoder266 := json.NewDecoder(bytes.NewReader(x))
822+ decoder266.DisallowUnknownFields()
823+ var stringVal string
824+ if err := decoder266.Decode(&stringVal); err == nil {
825+ t.Value = stringVal
826+ return nil
827+ }
828+ decoder267 := json.NewDecoder(bytes.NewReader(x))
829+ decoder267.DisallowUnknownFields()
830+ var h267 MarkedStringWithLanguage
831+ if err := decoder267.Decode(&h267); err == nil {
832+ t.Value = h267
833+ return nil
834+ }
835+ return &UnmarshalError{"unmarshal failed to match one of [MarkedStringWithLanguage string]"}
836+}
837+
838+func (t Or_NotebookCellTextDocumentFilter_notebook) MarshalJSON() ([]byte, error) {
839+ switch x := t.Value.(type) {
840+ case NotebookDocumentFilter:
841+ return json.Marshal(x)
842+ case string:
843+ return json.Marshal(x)
844+ case nil:
845+ return []byte("null"), nil
846+ }
847+ return nil, fmt.Errorf("type %T not one of [NotebookDocumentFilter string]", t)
848+}
849+
850+func (t *Or_NotebookCellTextDocumentFilter_notebook) UnmarshalJSON(x []byte) error {
851+ if string(x) == "null" {
852+ t.Value = nil
853+ return nil
854+ }
855+ decoder208 := json.NewDecoder(bytes.NewReader(x))
856+ decoder208.DisallowUnknownFields()
857+ var stringVal string
858+ if err := decoder208.Decode(&stringVal); err == nil {
859+ t.Value = stringVal
860+ return nil
861+ }
862+ decoder209 := json.NewDecoder(bytes.NewReader(x))
863+ decoder209.DisallowUnknownFields()
864+ var h209 NotebookDocumentFilter
865+ if err := decoder209.Decode(&h209); err == nil {
866+ t.Value = h209
867+ return nil
868+ }
869+ return &UnmarshalError{"unmarshal failed to match one of [NotebookDocumentFilter string]"}
870+}
871+
872+func (t Or_NotebookDocumentFilter) MarshalJSON() ([]byte, error) {
873+ switch x := t.Value.(type) {
874+ case NotebookDocumentFilterNotebookType:
875+ return json.Marshal(x)
876+ case NotebookDocumentFilterPattern:
877+ return json.Marshal(x)
878+ case NotebookDocumentFilterScheme:
879+ return json.Marshal(x)
880+ case nil:
881+ return []byte("null"), nil
882+ }
883+ return nil, fmt.Errorf("type %T not one of [NotebookDocumentFilterNotebookType NotebookDocumentFilterPattern NotebookDocumentFilterScheme]", t)
884+}
885+
886+func (t *Or_NotebookDocumentFilter) UnmarshalJSON(x []byte) error {
887+ if string(x) == "null" {
888+ t.Value = nil
889+ return nil
890+ }
891+ decoder285 := json.NewDecoder(bytes.NewReader(x))
892+ decoder285.DisallowUnknownFields()
893+ var h285 NotebookDocumentFilterNotebookType
894+ if err := decoder285.Decode(&h285); err == nil {
895+ t.Value = h285
896+ return nil
897+ }
898+ decoder286 := json.NewDecoder(bytes.NewReader(x))
899+ decoder286.DisallowUnknownFields()
900+ var h286 NotebookDocumentFilterPattern
901+ if err := decoder286.Decode(&h286); err == nil {
902+ t.Value = h286
903+ return nil
904+ }
905+ decoder287 := json.NewDecoder(bytes.NewReader(x))
906+ decoder287.DisallowUnknownFields()
907+ var h287 NotebookDocumentFilterScheme
908+ if err := decoder287.Decode(&h287); err == nil {
909+ t.Value = h287
910+ return nil
911+ }
912+ return &UnmarshalError{"unmarshal failed to match one of [NotebookDocumentFilterNotebookType NotebookDocumentFilterPattern NotebookDocumentFilterScheme]"}
913+}
914+
915+func (t Or_NotebookDocumentFilterWithCells_notebook) MarshalJSON() ([]byte, error) {
916+ switch x := t.Value.(type) {
917+ case NotebookDocumentFilter:
918+ return json.Marshal(x)
919+ case string:
920+ return json.Marshal(x)
921+ case nil:
922+ return []byte("null"), nil
923+ }
924+ return nil, fmt.Errorf("type %T not one of [NotebookDocumentFilter string]", t)
925+}
926+
927+func (t *Or_NotebookDocumentFilterWithCells_notebook) UnmarshalJSON(x []byte) error {
928+ if string(x) == "null" {
929+ t.Value = nil
930+ return nil
931+ }
932+ decoder192 := json.NewDecoder(bytes.NewReader(x))
933+ decoder192.DisallowUnknownFields()
934+ var stringVal string
935+ if err := decoder192.Decode(&stringVal); err == nil {
936+ t.Value = stringVal
937+ return nil
938+ }
939+ decoder193 := json.NewDecoder(bytes.NewReader(x))
940+ decoder193.DisallowUnknownFields()
941+ var h193 NotebookDocumentFilter
942+ if err := decoder193.Decode(&h193); err == nil {
943+ t.Value = h193
944+ return nil
945+ }
946+ return &UnmarshalError{"unmarshal failed to match one of [NotebookDocumentFilter string]"}
947+}
948+
949+func (t Or_NotebookDocumentFilterWithNotebook_notebook) MarshalJSON() ([]byte, error) {
950+ switch x := t.Value.(type) {
951+ case NotebookDocumentFilter:
952+ return json.Marshal(x)
953+ case string:
954+ return json.Marshal(x)
955+ case nil:
956+ return []byte("null"), nil
957+ }
958+ return nil, fmt.Errorf("type %T not one of [NotebookDocumentFilter string]", t)
959+}
960+
961+func (t *Or_NotebookDocumentFilterWithNotebook_notebook) UnmarshalJSON(x []byte) error {
962+ if string(x) == "null" {
963+ t.Value = nil
964+ return nil
965+ }
966+ decoder189 := json.NewDecoder(bytes.NewReader(x))
967+ decoder189.DisallowUnknownFields()
968+ var stringVal string
969+ if err := decoder189.Decode(&stringVal); err == nil {
970+ t.Value = stringVal
971+ return nil
972+ }
973+ decoder190 := json.NewDecoder(bytes.NewReader(x))
974+ decoder190.DisallowUnknownFields()
975+ var h190 NotebookDocumentFilter
976+ if err := decoder190.Decode(&h190); err == nil {
977+ t.Value = h190
978+ return nil
979+ }
980+ return &UnmarshalError{"unmarshal failed to match one of [NotebookDocumentFilter string]"}
981+}
982+
983+func (t Or_NotebookDocumentSyncOptions_notebookSelector_Elem) MarshalJSON() ([]byte, error) {
984+ switch x := t.Value.(type) {
985+ case NotebookDocumentFilterWithCells:
986+ return json.Marshal(x)
987+ case NotebookDocumentFilterWithNotebook:
988+ return json.Marshal(x)
989+ case nil:
990+ return []byte("null"), nil
991+ }
992+ return nil, fmt.Errorf("type %T not one of [NotebookDocumentFilterWithCells NotebookDocumentFilterWithNotebook]", t)
993+}
994+
995+func (t *Or_NotebookDocumentSyncOptions_notebookSelector_Elem) UnmarshalJSON(x []byte) error {
996+ if string(x) == "null" {
997+ t.Value = nil
998+ return nil
999+ }
1000+ decoder68 := json.NewDecoder(bytes.NewReader(x))
1001+ decoder68.DisallowUnknownFields()
1002+ var h68 NotebookDocumentFilterWithCells
1003+ if err := decoder68.Decode(&h68); err == nil {
1004+ t.Value = h68
1005+ return nil
1006+ }
1007+ decoder69 := json.NewDecoder(bytes.NewReader(x))
1008+ decoder69.DisallowUnknownFields()
1009+ var h69 NotebookDocumentFilterWithNotebook
1010+ if err := decoder69.Decode(&h69); err == nil {
1011+ t.Value = h69
1012+ return nil
1013+ }
1014+ return &UnmarshalError{"unmarshal failed to match one of [NotebookDocumentFilterWithCells NotebookDocumentFilterWithNotebook]"}
1015+}
1016+
1017+func (t Or_ParameterInformation_documentation) MarshalJSON() ([]byte, error) {
1018+ switch x := t.Value.(type) {
1019+ case MarkupContent:
1020+ return json.Marshal(x)
1021+ case string:
1022+ return json.Marshal(x)
1023+ case nil:
1024+ return []byte("null"), nil
1025+ }
1026+ return nil, fmt.Errorf("type %T not one of [MarkupContent string]", t)
1027+}
1028+
1029+func (t *Or_ParameterInformation_documentation) UnmarshalJSON(x []byte) error {
1030+ if string(x) == "null" {
1031+ t.Value = nil
1032+ return nil
1033+ }
1034+ decoder205 := json.NewDecoder(bytes.NewReader(x))
1035+ decoder205.DisallowUnknownFields()
1036+ var stringVal string
1037+ if err := decoder205.Decode(&stringVal); err == nil {
1038+ t.Value = stringVal
1039+ return nil
1040+ }
1041+ decoder206 := json.NewDecoder(bytes.NewReader(x))
1042+ decoder206.DisallowUnknownFields()
1043+ var h206 MarkupContent
1044+ if err := decoder206.Decode(&h206); err == nil {
1045+ t.Value = h206
1046+ return nil
1047+ }
1048+ return &UnmarshalError{"unmarshal failed to match one of [MarkupContent string]"}
1049+}
1050+
1051+func (t Or_ParameterInformation_label) MarshalJSON() ([]byte, error) {
1052+ switch x := t.Value.(type) {
1053+ case Tuple_ParameterInformation_label_Item1:
1054+ return json.Marshal(x)
1055+ case string:
1056+ return json.Marshal(x)
1057+ case nil:
1058+ return []byte("null"), nil
1059+ }
1060+ return nil, fmt.Errorf("type %T not one of [Tuple_ParameterInformation_label_Item1 string]", t)
1061+}
1062+
1063+func (t *Or_ParameterInformation_label) UnmarshalJSON(x []byte) error {
1064+ if string(x) == "null" {
1065+ t.Value = nil
1066+ return nil
1067+ }
1068+ decoder202 := json.NewDecoder(bytes.NewReader(x))
1069+ decoder202.DisallowUnknownFields()
1070+ var stringVal string
1071+ if err := decoder202.Decode(&stringVal); err == nil {
1072+ t.Value = stringVal
1073+ return nil
1074+ }
1075+ decoder203 := json.NewDecoder(bytes.NewReader(x))
1076+ decoder203.DisallowUnknownFields()
1077+ var h203 Tuple_ParameterInformation_label_Item1
1078+ if err := decoder203.Decode(&h203); err == nil {
1079+ t.Value = h203
1080+ return nil
1081+ }
1082+ return &UnmarshalError{"unmarshal failed to match one of [Tuple_ParameterInformation_label_Item1 string]"}
1083+}
1084+
1085+func (t Or_PrepareRenameResult) MarshalJSON() ([]byte, error) {
1086+ switch x := t.Value.(type) {
1087+ case PrepareRenameDefaultBehavior:
1088+ return json.Marshal(x)
1089+ case PrepareRenamePlaceholder:
1090+ return json.Marshal(x)
1091+ case Range:
1092+ return json.Marshal(x)
1093+ case nil:
1094+ return []byte("null"), nil
1095+ }
1096+ return nil, fmt.Errorf("type %T not one of [PrepareRenameDefaultBehavior PrepareRenamePlaceholder Range]", t)
1097+}
1098+
1099+func (t *Or_PrepareRenameResult) UnmarshalJSON(x []byte) error {
1100+ if string(x) == "null" {
1101+ t.Value = nil
1102+ return nil
1103+ }
1104+ decoder252 := json.NewDecoder(bytes.NewReader(x))
1105+ decoder252.DisallowUnknownFields()
1106+ var h252 PrepareRenameDefaultBehavior
1107+ if err := decoder252.Decode(&h252); err == nil {
1108+ t.Value = h252
1109+ return nil
1110+ }
1111+ decoder253 := json.NewDecoder(bytes.NewReader(x))
1112+ decoder253.DisallowUnknownFields()
1113+ var h253 PrepareRenamePlaceholder
1114+ if err := decoder253.Decode(&h253); err == nil {
1115+ t.Value = h253
1116+ return nil
1117+ }
1118+ decoder254 := json.NewDecoder(bytes.NewReader(x))
1119+ decoder254.DisallowUnknownFields()
1120+ var h254 Range
1121+ if err := decoder254.Decode(&h254); err == nil {
1122+ t.Value = h254
1123+ return nil
1124+ }
1125+ return &UnmarshalError{"unmarshal failed to match one of [PrepareRenameDefaultBehavior PrepareRenamePlaceholder Range]"}
1126+}
1127+
1128+func (t Or_ProgressToken) MarshalJSON() ([]byte, error) {
1129+ switch x := t.Value.(type) {
1130+ case int32:
1131+ return json.Marshal(x)
1132+ case string:
1133+ return json.Marshal(x)
1134+ case nil:
1135+ return []byte("null"), nil
1136+ }
1137+ return nil, fmt.Errorf("type %T not one of [int32 string]", t)
1138+}
1139+
1140+func (t *Or_ProgressToken) UnmarshalJSON(x []byte) error {
1141+ if string(x) == "null" {
1142+ t.Value = nil
1143+ return nil
1144+ }
1145+ decoder255 := json.NewDecoder(bytes.NewReader(x))
1146+ decoder255.DisallowUnknownFields()
1147+ var int32Val int32
1148+ if err := decoder255.Decode(&int32Val); err == nil {
1149+ t.Value = int32Val
1150+ return nil
1151+ }
1152+ decoder256 := json.NewDecoder(bytes.NewReader(x))
1153+ decoder256.DisallowUnknownFields()
1154+ var stringVal string
1155+ if err := decoder256.Decode(&stringVal); err == nil {
1156+ t.Value = stringVal
1157+ return nil
1158+ }
1159+ return &UnmarshalError{"unmarshal failed to match one of [int32 string]"}
1160+}
1161+
1162+func (t Or_RelatedFullDocumentDiagnosticReport_relatedDocuments_Value) MarshalJSON() ([]byte, error) {
1163+ switch x := t.Value.(type) {
1164+ case FullDocumentDiagnosticReport:
1165+ return json.Marshal(x)
1166+ case UnchangedDocumentDiagnosticReport:
1167+ return json.Marshal(x)
1168+ case nil:
1169+ return []byte("null"), nil
1170+ }
1171+ return nil, fmt.Errorf("type %T not one of [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]", t)
1172+}
1173+
1174+func (t *Or_RelatedFullDocumentDiagnosticReport_relatedDocuments_Value) UnmarshalJSON(x []byte) error {
1175+ if string(x) == "null" {
1176+ t.Value = nil
1177+ return nil
1178+ }
1179+ decoder60 := json.NewDecoder(bytes.NewReader(x))
1180+ decoder60.DisallowUnknownFields()
1181+ var h60 FullDocumentDiagnosticReport
1182+ if err := decoder60.Decode(&h60); err == nil {
1183+ t.Value = h60
1184+ return nil
1185+ }
1186+ decoder61 := json.NewDecoder(bytes.NewReader(x))
1187+ decoder61.DisallowUnknownFields()
1188+ var h61 UnchangedDocumentDiagnosticReport
1189+ if err := decoder61.Decode(&h61); err == nil {
1190+ t.Value = h61
1191+ return nil
1192+ }
1193+ return &UnmarshalError{"unmarshal failed to match one of [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]"}
1194+}
1195+
1196+func (t Or_RelatedUnchangedDocumentDiagnosticReport_relatedDocuments_Value) MarshalJSON() ([]byte, error) {
1197+ switch x := t.Value.(type) {
1198+ case FullDocumentDiagnosticReport:
1199+ return json.Marshal(x)
1200+ case UnchangedDocumentDiagnosticReport:
1201+ return json.Marshal(x)
1202+ case nil:
1203+ return []byte("null"), nil
1204+ }
1205+ return nil, fmt.Errorf("type %T not one of [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]", t)
1206+}
1207+
1208+func (t *Or_RelatedUnchangedDocumentDiagnosticReport_relatedDocuments_Value) UnmarshalJSON(x []byte) error {
1209+ if string(x) == "null" {
1210+ t.Value = nil
1211+ return nil
1212+ }
1213+ decoder64 := json.NewDecoder(bytes.NewReader(x))
1214+ decoder64.DisallowUnknownFields()
1215+ var h64 FullDocumentDiagnosticReport
1216+ if err := decoder64.Decode(&h64); err == nil {
1217+ t.Value = h64
1218+ return nil
1219+ }
1220+ decoder65 := json.NewDecoder(bytes.NewReader(x))
1221+ decoder65.DisallowUnknownFields()
1222+ var h65 UnchangedDocumentDiagnosticReport
1223+ if err := decoder65.Decode(&h65); err == nil {
1224+ t.Value = h65
1225+ return nil
1226+ }
1227+ return &UnmarshalError{"unmarshal failed to match one of [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]"}
1228+}
1229+
1230+func (t Or_RelativePattern_baseUri) MarshalJSON() ([]byte, error) {
1231+ switch x := t.Value.(type) {
1232+ case URI:
1233+ return json.Marshal(x)
1234+ case WorkspaceFolder:
1235+ return json.Marshal(x)
1236+ case nil:
1237+ return []byte("null"), nil
1238+ }
1239+ return nil, fmt.Errorf("type %T not one of [URI WorkspaceFolder]", t)
1240+}
1241+
1242+func (t *Or_RelativePattern_baseUri) UnmarshalJSON(x []byte) error {
1243+ if string(x) == "null" {
1244+ t.Value = nil
1245+ return nil
1246+ }
1247+ decoder214 := json.NewDecoder(bytes.NewReader(x))
1248+ decoder214.DisallowUnknownFields()
1249+ var h214 URI
1250+ if err := decoder214.Decode(&h214); err == nil {
1251+ t.Value = h214
1252+ return nil
1253+ }
1254+ decoder215 := json.NewDecoder(bytes.NewReader(x))
1255+ decoder215.DisallowUnknownFields()
1256+ var h215 WorkspaceFolder
1257+ if err := decoder215.Decode(&h215); err == nil {
1258+ t.Value = h215
1259+ return nil
1260+ }
1261+ return &UnmarshalError{"unmarshal failed to match one of [URI WorkspaceFolder]"}
1262+}
1263+
1264+func (t Or_Result_textDocument_codeAction_Item0_Elem) MarshalJSON() ([]byte, error) {
1265+ switch x := t.Value.(type) {
1266+ case CodeAction:
1267+ return json.Marshal(x)
1268+ case Command:
1269+ return json.Marshal(x)
1270+ case nil:
1271+ return []byte("null"), nil
1272+ }
1273+ return nil, fmt.Errorf("type %T not one of [CodeAction Command]", t)
1274+}
1275+
1276+func (t *Or_Result_textDocument_codeAction_Item0_Elem) UnmarshalJSON(x []byte) error {
1277+ if string(x) == "null" {
1278+ t.Value = nil
1279+ return nil
1280+ }
1281+ decoder322 := json.NewDecoder(bytes.NewReader(x))
1282+ decoder322.DisallowUnknownFields()
1283+ var h322 CodeAction
1284+ if err := decoder322.Decode(&h322); err == nil {
1285+ t.Value = h322
1286+ return nil
1287+ }
1288+ decoder323 := json.NewDecoder(bytes.NewReader(x))
1289+ decoder323.DisallowUnknownFields()
1290+ var h323 Command
1291+ if err := decoder323.Decode(&h323); err == nil {
1292+ t.Value = h323
1293+ return nil
1294+ }
1295+ return &UnmarshalError{"unmarshal failed to match one of [CodeAction Command]"}
1296+}
1297+
1298+func (t Or_Result_textDocument_completion) MarshalJSON() ([]byte, error) {
1299+ switch x := t.Value.(type) {
1300+ case CompletionList:
1301+ return json.Marshal(x)
1302+ case []CompletionItem:
1303+ return json.Marshal(x)
1304+ case nil:
1305+ return []byte("null"), nil
1306+ }
1307+ return nil, fmt.Errorf("type %T not one of [CompletionList []CompletionItem]", t)
1308+}
1309+
1310+func (t *Or_Result_textDocument_completion) UnmarshalJSON(x []byte) error {
1311+ if string(x) == "null" {
1312+ t.Value = nil
1313+ return nil
1314+ }
1315+ decoder310 := json.NewDecoder(bytes.NewReader(x))
1316+ decoder310.DisallowUnknownFields()
1317+ var h310 CompletionList
1318+ if err := decoder310.Decode(&h310); err == nil {
1319+ t.Value = h310
1320+ return nil
1321+ }
1322+ decoder311 := json.NewDecoder(bytes.NewReader(x))
1323+ decoder311.DisallowUnknownFields()
1324+ var h311 []CompletionItem
1325+ if err := decoder311.Decode(&h311); err == nil {
1326+ t.Value = h311
1327+ return nil
1328+ }
1329+ return &UnmarshalError{"unmarshal failed to match one of [CompletionList []CompletionItem]"}
1330+}
1331+
1332+func (t Or_Result_textDocument_declaration) MarshalJSON() ([]byte, error) {
1333+ switch x := t.Value.(type) {
1334+ case Declaration:
1335+ return json.Marshal(x)
1336+ case []DeclarationLink:
1337+ return json.Marshal(x)
1338+ case nil:
1339+ return []byte("null"), nil
1340+ }
1341+ return nil, fmt.Errorf("type %T not one of [Declaration []DeclarationLink]", t)
1342+}
1343+
1344+func (t *Or_Result_textDocument_declaration) UnmarshalJSON(x []byte) error {
1345+ if string(x) == "null" {
1346+ t.Value = nil
1347+ return nil
1348+ }
1349+ decoder298 := json.NewDecoder(bytes.NewReader(x))
1350+ decoder298.DisallowUnknownFields()
1351+ var h298 Declaration
1352+ if err := decoder298.Decode(&h298); err == nil {
1353+ t.Value = h298
1354+ return nil
1355+ }
1356+ decoder299 := json.NewDecoder(bytes.NewReader(x))
1357+ decoder299.DisallowUnknownFields()
1358+ var h299 []DeclarationLink
1359+ if err := decoder299.Decode(&h299); err == nil {
1360+ t.Value = h299
1361+ return nil
1362+ }
1363+ return &UnmarshalError{"unmarshal failed to match one of [Declaration []DeclarationLink]"}
1364+}
1365+
1366+func (t Or_Result_textDocument_definition) MarshalJSON() ([]byte, error) {
1367+ switch x := t.Value.(type) {
1368+ case Definition:
1369+ return json.Marshal(x)
1370+ case []DefinitionLink:
1371+ return json.Marshal(x)
1372+ case nil:
1373+ return []byte("null"), nil
1374+ }
1375+ return nil, fmt.Errorf("type %T not one of [Definition []DefinitionLink]", t)
1376+}
1377+
1378+func (t *Or_Result_textDocument_definition) UnmarshalJSON(x []byte) error {
1379+ if string(x) == "null" {
1380+ t.Value = nil
1381+ return nil
1382+ }
1383+ decoder314 := json.NewDecoder(bytes.NewReader(x))
1384+ decoder314.DisallowUnknownFields()
1385+ var h314 Definition
1386+ if err := decoder314.Decode(&h314); err == nil {
1387+ t.Value = h314
1388+ return nil
1389+ }
1390+ decoder315 := json.NewDecoder(bytes.NewReader(x))
1391+ decoder315.DisallowUnknownFields()
1392+ var h315 []DefinitionLink
1393+ if err := decoder315.Decode(&h315); err == nil {
1394+ t.Value = h315
1395+ return nil
1396+ }
1397+ return &UnmarshalError{"unmarshal failed to match one of [Definition []DefinitionLink]"}
1398+}
1399+
1400+func (t Or_Result_textDocument_documentSymbol) MarshalJSON() ([]byte, error) {
1401+ switch x := t.Value.(type) {
1402+ case []DocumentSymbol:
1403+ return json.Marshal(x)
1404+ case []SymbolInformation:
1405+ return json.Marshal(x)
1406+ case nil:
1407+ return []byte("null"), nil
1408+ }
1409+ return nil, fmt.Errorf("type %T not one of [[]DocumentSymbol []SymbolInformation]", t)
1410+}
1411+
1412+func (t *Or_Result_textDocument_documentSymbol) UnmarshalJSON(x []byte) error {
1413+ if string(x) == "null" {
1414+ t.Value = nil
1415+ return nil
1416+ }
1417+ decoder318 := json.NewDecoder(bytes.NewReader(x))
1418+ decoder318.DisallowUnknownFields()
1419+ var h318 []DocumentSymbol
1420+ if err := decoder318.Decode(&h318); err == nil {
1421+ t.Value = h318
1422+ return nil
1423+ }
1424+ decoder319 := json.NewDecoder(bytes.NewReader(x))
1425+ decoder319.DisallowUnknownFields()
1426+ var h319 []SymbolInformation
1427+ if err := decoder319.Decode(&h319); err == nil {
1428+ t.Value = h319
1429+ return nil
1430+ }
1431+ return &UnmarshalError{"unmarshal failed to match one of [[]DocumentSymbol []SymbolInformation]"}
1432+}
1433+
1434+func (t Or_Result_textDocument_implementation) MarshalJSON() ([]byte, error) {
1435+ switch x := t.Value.(type) {
1436+ case Definition:
1437+ return json.Marshal(x)
1438+ case []DefinitionLink:
1439+ return json.Marshal(x)
1440+ case nil:
1441+ return []byte("null"), nil
1442+ }
1443+ return nil, fmt.Errorf("type %T not one of [Definition []DefinitionLink]", t)
1444+}
1445+
1446+func (t *Or_Result_textDocument_implementation) UnmarshalJSON(x []byte) error {
1447+ if string(x) == "null" {
1448+ t.Value = nil
1449+ return nil
1450+ }
1451+ decoder290 := json.NewDecoder(bytes.NewReader(x))
1452+ decoder290.DisallowUnknownFields()
1453+ var h290 Definition
1454+ if err := decoder290.Decode(&h290); err == nil {
1455+ t.Value = h290
1456+ return nil
1457+ }
1458+ decoder291 := json.NewDecoder(bytes.NewReader(x))
1459+ decoder291.DisallowUnknownFields()
1460+ var h291 []DefinitionLink
1461+ if err := decoder291.Decode(&h291); err == nil {
1462+ t.Value = h291
1463+ return nil
1464+ }
1465+ return &UnmarshalError{"unmarshal failed to match one of [Definition []DefinitionLink]"}
1466+}
1467+
1468+func (t Or_Result_textDocument_inlineCompletion) MarshalJSON() ([]byte, error) {
1469+ switch x := t.Value.(type) {
1470+ case InlineCompletionList:
1471+ return json.Marshal(x)
1472+ case []InlineCompletionItem:
1473+ return json.Marshal(x)
1474+ case nil:
1475+ return []byte("null"), nil
1476+ }
1477+ return nil, fmt.Errorf("type %T not one of [InlineCompletionList []InlineCompletionItem]", t)
1478+}
1479+
1480+func (t *Or_Result_textDocument_inlineCompletion) UnmarshalJSON(x []byte) error {
1481+ if string(x) == "null" {
1482+ t.Value = nil
1483+ return nil
1484+ }
1485+ decoder306 := json.NewDecoder(bytes.NewReader(x))
1486+ decoder306.DisallowUnknownFields()
1487+ var h306 InlineCompletionList
1488+ if err := decoder306.Decode(&h306); err == nil {
1489+ t.Value = h306
1490+ return nil
1491+ }
1492+ decoder307 := json.NewDecoder(bytes.NewReader(x))
1493+ decoder307.DisallowUnknownFields()
1494+ var h307 []InlineCompletionItem
1495+ if err := decoder307.Decode(&h307); err == nil {
1496+ t.Value = h307
1497+ return nil
1498+ }
1499+ return &UnmarshalError{"unmarshal failed to match one of [InlineCompletionList []InlineCompletionItem]"}
1500+}
1501+
1502+func (t Or_Result_textDocument_semanticTokens_full_delta) MarshalJSON() ([]byte, error) {
1503+ switch x := t.Value.(type) {
1504+ case SemanticTokens:
1505+ return json.Marshal(x)
1506+ case SemanticTokensDelta:
1507+ return json.Marshal(x)
1508+ case nil:
1509+ return []byte("null"), nil
1510+ }
1511+ return nil, fmt.Errorf("type %T not one of [SemanticTokens SemanticTokensDelta]", t)
1512+}
1513+
1514+func (t *Or_Result_textDocument_semanticTokens_full_delta) UnmarshalJSON(x []byte) error {
1515+ if string(x) == "null" {
1516+ t.Value = nil
1517+ return nil
1518+ }
1519+ decoder302 := json.NewDecoder(bytes.NewReader(x))
1520+ decoder302.DisallowUnknownFields()
1521+ var h302 SemanticTokens
1522+ if err := decoder302.Decode(&h302); err == nil {
1523+ t.Value = h302
1524+ return nil
1525+ }
1526+ decoder303 := json.NewDecoder(bytes.NewReader(x))
1527+ decoder303.DisallowUnknownFields()
1528+ var h303 SemanticTokensDelta
1529+ if err := decoder303.Decode(&h303); err == nil {
1530+ t.Value = h303
1531+ return nil
1532+ }
1533+ return &UnmarshalError{"unmarshal failed to match one of [SemanticTokens SemanticTokensDelta]"}
1534+}
1535+
1536+func (t Or_Result_textDocument_typeDefinition) MarshalJSON() ([]byte, error) {
1537+ switch x := t.Value.(type) {
1538+ case Definition:
1539+ return json.Marshal(x)
1540+ case []DefinitionLink:
1541+ return json.Marshal(x)
1542+ case nil:
1543+ return []byte("null"), nil
1544+ }
1545+ return nil, fmt.Errorf("type %T not one of [Definition []DefinitionLink]", t)
1546+}
1547+
1548+func (t *Or_Result_textDocument_typeDefinition) UnmarshalJSON(x []byte) error {
1549+ if string(x) == "null" {
1550+ t.Value = nil
1551+ return nil
1552+ }
1553+ decoder294 := json.NewDecoder(bytes.NewReader(x))
1554+ decoder294.DisallowUnknownFields()
1555+ var h294 Definition
1556+ if err := decoder294.Decode(&h294); err == nil {
1557+ t.Value = h294
1558+ return nil
1559+ }
1560+ decoder295 := json.NewDecoder(bytes.NewReader(x))
1561+ decoder295.DisallowUnknownFields()
1562+ var h295 []DefinitionLink
1563+ if err := decoder295.Decode(&h295); err == nil {
1564+ t.Value = h295
1565+ return nil
1566+ }
1567+ return &UnmarshalError{"unmarshal failed to match one of [Definition []DefinitionLink]"}
1568+}
1569+
1570+func (t Or_Result_workspace_symbol) MarshalJSON() ([]byte, error) {
1571+ switch x := t.Value.(type) {
1572+ case []SymbolInformation:
1573+ return json.Marshal(x)
1574+ case []WorkspaceSymbol:
1575+ return json.Marshal(x)
1576+ case nil:
1577+ return []byte("null"), nil
1578+ }
1579+ return nil, fmt.Errorf("type %T not one of [[]SymbolInformation []WorkspaceSymbol]", t)
1580+}
1581+
1582+func (t *Or_Result_workspace_symbol) UnmarshalJSON(x []byte) error {
1583+ if string(x) == "null" {
1584+ t.Value = nil
1585+ return nil
1586+ }
1587+ decoder326 := json.NewDecoder(bytes.NewReader(x))
1588+ decoder326.DisallowUnknownFields()
1589+ var h326 []SymbolInformation
1590+ if err := decoder326.Decode(&h326); err == nil {
1591+ t.Value = h326
1592+ return nil
1593+ }
1594+ decoder327 := json.NewDecoder(bytes.NewReader(x))
1595+ decoder327.DisallowUnknownFields()
1596+ var h327 []WorkspaceSymbol
1597+ if err := decoder327.Decode(&h327); err == nil {
1598+ t.Value = h327
1599+ return nil
1600+ }
1601+ return &UnmarshalError{"unmarshal failed to match one of [[]SymbolInformation []WorkspaceSymbol]"}
1602+}
1603+
1604+func (t Or_SemanticTokensOptions_full) MarshalJSON() ([]byte, error) {
1605+ switch x := t.Value.(type) {
1606+ case SemanticTokensFullDelta:
1607+ return json.Marshal(x)
1608+ case bool:
1609+ return json.Marshal(x)
1610+ case nil:
1611+ return []byte("null"), nil
1612+ }
1613+ return nil, fmt.Errorf("type %T not one of [SemanticTokensFullDelta bool]", t)
1614+}
1615+
1616+func (t *Or_SemanticTokensOptions_full) UnmarshalJSON(x []byte) error {
1617+ if string(x) == "null" {
1618+ t.Value = nil
1619+ return nil
1620+ }
1621+ decoder47 := json.NewDecoder(bytes.NewReader(x))
1622+ decoder47.DisallowUnknownFields()
1623+ var boolVal bool
1624+ if err := decoder47.Decode(&boolVal); err == nil {
1625+ t.Value = boolVal
1626+ return nil
1627+ }
1628+ decoder48 := json.NewDecoder(bytes.NewReader(x))
1629+ decoder48.DisallowUnknownFields()
1630+ var h48 SemanticTokensFullDelta
1631+ if err := decoder48.Decode(&h48); err == nil {
1632+ t.Value = h48
1633+ return nil
1634+ }
1635+ return &UnmarshalError{"unmarshal failed to match one of [SemanticTokensFullDelta bool]"}
1636+}
1637+
1638+func (t Or_SemanticTokensOptions_range) MarshalJSON() ([]byte, error) {
1639+ switch x := t.Value.(type) {
1640+ case Lit_SemanticTokensOptions_range_Item1:
1641+ return json.Marshal(x)
1642+ case bool:
1643+ return json.Marshal(x)
1644+ case nil:
1645+ return []byte("null"), nil
1646+ }
1647+ return nil, fmt.Errorf("type %T not one of [Lit_SemanticTokensOptions_range_Item1 bool]", t)
1648+}
1649+
1650+func (t *Or_SemanticTokensOptions_range) UnmarshalJSON(x []byte) error {
1651+ if string(x) == "null" {
1652+ t.Value = nil
1653+ return nil
1654+ }
1655+ decoder44 := json.NewDecoder(bytes.NewReader(x))
1656+ decoder44.DisallowUnknownFields()
1657+ var boolVal bool
1658+ if err := decoder44.Decode(&boolVal); err == nil {
1659+ t.Value = boolVal
1660+ return nil
1661+ }
1662+ decoder45 := json.NewDecoder(bytes.NewReader(x))
1663+ decoder45.DisallowUnknownFields()
1664+ var h45 Lit_SemanticTokensOptions_range_Item1
1665+ if err := decoder45.Decode(&h45); err == nil {
1666+ t.Value = h45
1667+ return nil
1668+ }
1669+ return &UnmarshalError{"unmarshal failed to match one of [Lit_SemanticTokensOptions_range_Item1 bool]"}
1670+}
1671+
1672+func (t Or_ServerCapabilities_callHierarchyProvider) MarshalJSON() ([]byte, error) {
1673+ switch x := t.Value.(type) {
1674+ case CallHierarchyOptions:
1675+ return json.Marshal(x)
1676+ case CallHierarchyRegistrationOptions:
1677+ return json.Marshal(x)
1678+ case bool:
1679+ return json.Marshal(x)
1680+ case nil:
1681+ return []byte("null"), nil
1682+ }
1683+ return nil, fmt.Errorf("type %T not one of [CallHierarchyOptions CallHierarchyRegistrationOptions bool]", t)
1684+}
1685+
1686+func (t *Or_ServerCapabilities_callHierarchyProvider) UnmarshalJSON(x []byte) error {
1687+ if string(x) == "null" {
1688+ t.Value = nil
1689+ return nil
1690+ }
1691+ decoder140 := json.NewDecoder(bytes.NewReader(x))
1692+ decoder140.DisallowUnknownFields()
1693+ var boolVal bool
1694+ if err := decoder140.Decode(&boolVal); err == nil {
1695+ t.Value = boolVal
1696+ return nil
1697+ }
1698+ decoder141 := json.NewDecoder(bytes.NewReader(x))
1699+ decoder141.DisallowUnknownFields()
1700+ var h141 CallHierarchyOptions
1701+ if err := decoder141.Decode(&h141); err == nil {
1702+ t.Value = h141
1703+ return nil
1704+ }
1705+ decoder142 := json.NewDecoder(bytes.NewReader(x))
1706+ decoder142.DisallowUnknownFields()
1707+ var h142 CallHierarchyRegistrationOptions
1708+ if err := decoder142.Decode(&h142); err == nil {
1709+ t.Value = h142
1710+ return nil
1711+ }
1712+ return &UnmarshalError{"unmarshal failed to match one of [CallHierarchyOptions CallHierarchyRegistrationOptions bool]"}
1713+}
1714+
1715+func (t Or_ServerCapabilities_codeActionProvider) MarshalJSON() ([]byte, error) {
1716+ switch x := t.Value.(type) {
1717+ case CodeActionOptions:
1718+ return json.Marshal(x)
1719+ case bool:
1720+ return json.Marshal(x)
1721+ case nil:
1722+ return []byte("null"), nil
1723+ }
1724+ return nil, fmt.Errorf("type %T not one of [CodeActionOptions bool]", t)
1725+}
1726+
1727+func (t *Or_ServerCapabilities_codeActionProvider) UnmarshalJSON(x []byte) error {
1728+ if string(x) == "null" {
1729+ t.Value = nil
1730+ return nil
1731+ }
1732+ decoder109 := json.NewDecoder(bytes.NewReader(x))
1733+ decoder109.DisallowUnknownFields()
1734+ var boolVal bool
1735+ if err := decoder109.Decode(&boolVal); err == nil {
1736+ t.Value = boolVal
1737+ return nil
1738+ }
1739+ decoder110 := json.NewDecoder(bytes.NewReader(x))
1740+ decoder110.DisallowUnknownFields()
1741+ var h110 CodeActionOptions
1742+ if err := decoder110.Decode(&h110); err == nil {
1743+ t.Value = h110
1744+ return nil
1745+ }
1746+ return &UnmarshalError{"unmarshal failed to match one of [CodeActionOptions bool]"}
1747+}
1748+
1749+func (t Or_ServerCapabilities_colorProvider) MarshalJSON() ([]byte, error) {
1750+ switch x := t.Value.(type) {
1751+ case DocumentColorOptions:
1752+ return json.Marshal(x)
1753+ case DocumentColorRegistrationOptions:
1754+ return json.Marshal(x)
1755+ case bool:
1756+ return json.Marshal(x)
1757+ case nil:
1758+ return []byte("null"), nil
1759+ }
1760+ return nil, fmt.Errorf("type %T not one of [DocumentColorOptions DocumentColorRegistrationOptions bool]", t)
1761+}
1762+
1763+func (t *Or_ServerCapabilities_colorProvider) UnmarshalJSON(x []byte) error {
1764+ if string(x) == "null" {
1765+ t.Value = nil
1766+ return nil
1767+ }
1768+ decoder113 := json.NewDecoder(bytes.NewReader(x))
1769+ decoder113.DisallowUnknownFields()
1770+ var boolVal bool
1771+ if err := decoder113.Decode(&boolVal); err == nil {
1772+ t.Value = boolVal
1773+ return nil
1774+ }
1775+ decoder114 := json.NewDecoder(bytes.NewReader(x))
1776+ decoder114.DisallowUnknownFields()
1777+ var h114 DocumentColorOptions
1778+ if err := decoder114.Decode(&h114); err == nil {
1779+ t.Value = h114
1780+ return nil
1781+ }
1782+ decoder115 := json.NewDecoder(bytes.NewReader(x))
1783+ decoder115.DisallowUnknownFields()
1784+ var h115 DocumentColorRegistrationOptions
1785+ if err := decoder115.Decode(&h115); err == nil {
1786+ t.Value = h115
1787+ return nil
1788+ }
1789+ return &UnmarshalError{"unmarshal failed to match one of [DocumentColorOptions DocumentColorRegistrationOptions bool]"}
1790+}
1791+
1792+func (t Or_ServerCapabilities_declarationProvider) MarshalJSON() ([]byte, error) {
1793+ switch x := t.Value.(type) {
1794+ case DeclarationOptions:
1795+ return json.Marshal(x)
1796+ case DeclarationRegistrationOptions:
1797+ return json.Marshal(x)
1798+ case bool:
1799+ return json.Marshal(x)
1800+ case nil:
1801+ return []byte("null"), nil
1802+ }
1803+ return nil, fmt.Errorf("type %T not one of [DeclarationOptions DeclarationRegistrationOptions bool]", t)
1804+}
1805+
1806+func (t *Or_ServerCapabilities_declarationProvider) UnmarshalJSON(x []byte) error {
1807+ if string(x) == "null" {
1808+ t.Value = nil
1809+ return nil
1810+ }
1811+ decoder83 := json.NewDecoder(bytes.NewReader(x))
1812+ decoder83.DisallowUnknownFields()
1813+ var boolVal bool
1814+ if err := decoder83.Decode(&boolVal); err == nil {
1815+ t.Value = boolVal
1816+ return nil
1817+ }
1818+ decoder84 := json.NewDecoder(bytes.NewReader(x))
1819+ decoder84.DisallowUnknownFields()
1820+ var h84 DeclarationOptions
1821+ if err := decoder84.Decode(&h84); err == nil {
1822+ t.Value = h84
1823+ return nil
1824+ }
1825+ decoder85 := json.NewDecoder(bytes.NewReader(x))
1826+ decoder85.DisallowUnknownFields()
1827+ var h85 DeclarationRegistrationOptions
1828+ if err := decoder85.Decode(&h85); err == nil {
1829+ t.Value = h85
1830+ return nil
1831+ }
1832+ return &UnmarshalError{"unmarshal failed to match one of [DeclarationOptions DeclarationRegistrationOptions bool]"}
1833+}
1834+
1835+func (t Or_ServerCapabilities_definitionProvider) MarshalJSON() ([]byte, error) {
1836+ switch x := t.Value.(type) {
1837+ case DefinitionOptions:
1838+ return json.Marshal(x)
1839+ case bool:
1840+ return json.Marshal(x)
1841+ case nil:
1842+ return []byte("null"), nil
1843+ }
1844+ return nil, fmt.Errorf("type %T not one of [DefinitionOptions bool]", t)
1845+}
1846+
1847+func (t *Or_ServerCapabilities_definitionProvider) UnmarshalJSON(x []byte) error {
1848+ if string(x) == "null" {
1849+ t.Value = nil
1850+ return nil
1851+ }
1852+ decoder87 := json.NewDecoder(bytes.NewReader(x))
1853+ decoder87.DisallowUnknownFields()
1854+ var boolVal bool
1855+ if err := decoder87.Decode(&boolVal); err == nil {
1856+ t.Value = boolVal
1857+ return nil
1858+ }
1859+ decoder88 := json.NewDecoder(bytes.NewReader(x))
1860+ decoder88.DisallowUnknownFields()
1861+ var h88 DefinitionOptions
1862+ if err := decoder88.Decode(&h88); err == nil {
1863+ t.Value = h88
1864+ return nil
1865+ }
1866+ return &UnmarshalError{"unmarshal failed to match one of [DefinitionOptions bool]"}
1867+}
1868+
1869+func (t Or_ServerCapabilities_diagnosticProvider) MarshalJSON() ([]byte, error) {
1870+ switch x := t.Value.(type) {
1871+ case DiagnosticOptions:
1872+ return json.Marshal(x)
1873+ case DiagnosticRegistrationOptions:
1874+ return json.Marshal(x)
1875+ case nil:
1876+ return []byte("null"), nil
1877+ }
1878+ return nil, fmt.Errorf("type %T not one of [DiagnosticOptions DiagnosticRegistrationOptions]", t)
1879+}
1880+
1881+func (t *Or_ServerCapabilities_diagnosticProvider) UnmarshalJSON(x []byte) error {
1882+ if string(x) == "null" {
1883+ t.Value = nil
1884+ return nil
1885+ }
1886+ decoder174 := json.NewDecoder(bytes.NewReader(x))
1887+ decoder174.DisallowUnknownFields()
1888+ var h174 DiagnosticOptions
1889+ if err := decoder174.Decode(&h174); err == nil {
1890+ t.Value = h174
1891+ return nil
1892+ }
1893+ decoder175 := json.NewDecoder(bytes.NewReader(x))
1894+ decoder175.DisallowUnknownFields()
1895+ var h175 DiagnosticRegistrationOptions
1896+ if err := decoder175.Decode(&h175); err == nil {
1897+ t.Value = h175
1898+ return nil
1899+ }
1900+ return &UnmarshalError{"unmarshal failed to match one of [DiagnosticOptions DiagnosticRegistrationOptions]"}
1901+}
1902+
1903+func (t Or_ServerCapabilities_documentFormattingProvider) MarshalJSON() ([]byte, error) {
1904+ switch x := t.Value.(type) {
1905+ case DocumentFormattingOptions:
1906+ return json.Marshal(x)
1907+ case bool:
1908+ return json.Marshal(x)
1909+ case nil:
1910+ return []byte("null"), nil
1911+ }
1912+ return nil, fmt.Errorf("type %T not one of [DocumentFormattingOptions bool]", t)
1913+}
1914+
1915+func (t *Or_ServerCapabilities_documentFormattingProvider) UnmarshalJSON(x []byte) error {
1916+ if string(x) == "null" {
1917+ t.Value = nil
1918+ return nil
1919+ }
1920+ decoder120 := json.NewDecoder(bytes.NewReader(x))
1921+ decoder120.DisallowUnknownFields()
1922+ var boolVal bool
1923+ if err := decoder120.Decode(&boolVal); err == nil {
1924+ t.Value = boolVal
1925+ return nil
1926+ }
1927+ decoder121 := json.NewDecoder(bytes.NewReader(x))
1928+ decoder121.DisallowUnknownFields()
1929+ var h121 DocumentFormattingOptions
1930+ if err := decoder121.Decode(&h121); err == nil {
1931+ t.Value = h121
1932+ return nil
1933+ }
1934+ return &UnmarshalError{"unmarshal failed to match one of [DocumentFormattingOptions bool]"}
1935+}
1936+
1937+func (t Or_ServerCapabilities_documentHighlightProvider) MarshalJSON() ([]byte, error) {
1938+ switch x := t.Value.(type) {
1939+ case DocumentHighlightOptions:
1940+ return json.Marshal(x)
1941+ case bool:
1942+ return json.Marshal(x)
1943+ case nil:
1944+ return []byte("null"), nil
1945+ }
1946+ return nil, fmt.Errorf("type %T not one of [DocumentHighlightOptions bool]", t)
1947+}
1948+
1949+func (t *Or_ServerCapabilities_documentHighlightProvider) UnmarshalJSON(x []byte) error {
1950+ if string(x) == "null" {
1951+ t.Value = nil
1952+ return nil
1953+ }
1954+ decoder103 := json.NewDecoder(bytes.NewReader(x))
1955+ decoder103.DisallowUnknownFields()
1956+ var boolVal bool
1957+ if err := decoder103.Decode(&boolVal); err == nil {
1958+ t.Value = boolVal
1959+ return nil
1960+ }
1961+ decoder104 := json.NewDecoder(bytes.NewReader(x))
1962+ decoder104.DisallowUnknownFields()
1963+ var h104 DocumentHighlightOptions
1964+ if err := decoder104.Decode(&h104); err == nil {
1965+ t.Value = h104
1966+ return nil
1967+ }
1968+ return &UnmarshalError{"unmarshal failed to match one of [DocumentHighlightOptions bool]"}
1969+}
1970+
1971+func (t Or_ServerCapabilities_documentRangeFormattingProvider) MarshalJSON() ([]byte, error) {
1972+ switch x := t.Value.(type) {
1973+ case DocumentRangeFormattingOptions:
1974+ return json.Marshal(x)
1975+ case bool:
1976+ return json.Marshal(x)
1977+ case nil:
1978+ return []byte("null"), nil
1979+ }
1980+ return nil, fmt.Errorf("type %T not one of [DocumentRangeFormattingOptions bool]", t)
1981+}
1982+
1983+func (t *Or_ServerCapabilities_documentRangeFormattingProvider) UnmarshalJSON(x []byte) error {
1984+ if string(x) == "null" {
1985+ t.Value = nil
1986+ return nil
1987+ }
1988+ decoder123 := json.NewDecoder(bytes.NewReader(x))
1989+ decoder123.DisallowUnknownFields()
1990+ var boolVal bool
1991+ if err := decoder123.Decode(&boolVal); err == nil {
1992+ t.Value = boolVal
1993+ return nil
1994+ }
1995+ decoder124 := json.NewDecoder(bytes.NewReader(x))
1996+ decoder124.DisallowUnknownFields()
1997+ var h124 DocumentRangeFormattingOptions
1998+ if err := decoder124.Decode(&h124); err == nil {
1999+ t.Value = h124
2000+ return nil
2001+ }
2002+ return &UnmarshalError{"unmarshal failed to match one of [DocumentRangeFormattingOptions bool]"}
2003+}
2004+
2005+func (t Or_ServerCapabilities_documentSymbolProvider) MarshalJSON() ([]byte, error) {
2006+ switch x := t.Value.(type) {
2007+ case DocumentSymbolOptions:
2008+ return json.Marshal(x)
2009+ case bool:
2010+ return json.Marshal(x)
2011+ case nil:
2012+ return []byte("null"), nil
2013+ }
2014+ return nil, fmt.Errorf("type %T not one of [DocumentSymbolOptions bool]", t)
2015+}
2016+
2017+func (t *Or_ServerCapabilities_documentSymbolProvider) UnmarshalJSON(x []byte) error {
2018+ if string(x) == "null" {
2019+ t.Value = nil
2020+ return nil
2021+ }
2022+ decoder106 := json.NewDecoder(bytes.NewReader(x))
2023+ decoder106.DisallowUnknownFields()
2024+ var boolVal bool
2025+ if err := decoder106.Decode(&boolVal); err == nil {
2026+ t.Value = boolVal
2027+ return nil
2028+ }
2029+ decoder107 := json.NewDecoder(bytes.NewReader(x))
2030+ decoder107.DisallowUnknownFields()
2031+ var h107 DocumentSymbolOptions
2032+ if err := decoder107.Decode(&h107); err == nil {
2033+ t.Value = h107
2034+ return nil
2035+ }
2036+ return &UnmarshalError{"unmarshal failed to match one of [DocumentSymbolOptions bool]"}
2037+}
2038+
2039+func (t Or_ServerCapabilities_foldingRangeProvider) MarshalJSON() ([]byte, error) {
2040+ switch x := t.Value.(type) {
2041+ case FoldingRangeOptions:
2042+ return json.Marshal(x)
2043+ case FoldingRangeRegistrationOptions:
2044+ return json.Marshal(x)
2045+ case bool:
2046+ return json.Marshal(x)
2047+ case nil:
2048+ return []byte("null"), nil
2049+ }
2050+ return nil, fmt.Errorf("type %T not one of [FoldingRangeOptions FoldingRangeRegistrationOptions bool]", t)
2051+}
2052+
2053+func (t *Or_ServerCapabilities_foldingRangeProvider) UnmarshalJSON(x []byte) error {
2054+ if string(x) == "null" {
2055+ t.Value = nil
2056+ return nil
2057+ }
2058+ decoder130 := json.NewDecoder(bytes.NewReader(x))
2059+ decoder130.DisallowUnknownFields()
2060+ var boolVal bool
2061+ if err := decoder130.Decode(&boolVal); err == nil {
2062+ t.Value = boolVal
2063+ return nil
2064+ }
2065+ decoder131 := json.NewDecoder(bytes.NewReader(x))
2066+ decoder131.DisallowUnknownFields()
2067+ var h131 FoldingRangeOptions
2068+ if err := decoder131.Decode(&h131); err == nil {
2069+ t.Value = h131
2070+ return nil
2071+ }
2072+ decoder132 := json.NewDecoder(bytes.NewReader(x))
2073+ decoder132.DisallowUnknownFields()
2074+ var h132 FoldingRangeRegistrationOptions
2075+ if err := decoder132.Decode(&h132); err == nil {
2076+ t.Value = h132
2077+ return nil
2078+ }
2079+ return &UnmarshalError{"unmarshal failed to match one of [FoldingRangeOptions FoldingRangeRegistrationOptions bool]"}
2080+}
2081+
2082+func (t Or_ServerCapabilities_hoverProvider) MarshalJSON() ([]byte, error) {
2083+ switch x := t.Value.(type) {
2084+ case HoverOptions:
2085+ return json.Marshal(x)
2086+ case bool:
2087+ return json.Marshal(x)
2088+ case nil:
2089+ return []byte("null"), nil
2090+ }
2091+ return nil, fmt.Errorf("type %T not one of [HoverOptions bool]", t)
2092+}
2093+
2094+func (t *Or_ServerCapabilities_hoverProvider) UnmarshalJSON(x []byte) error {
2095+ if string(x) == "null" {
2096+ t.Value = nil
2097+ return nil
2098+ }
2099+ decoder79 := json.NewDecoder(bytes.NewReader(x))
2100+ decoder79.DisallowUnknownFields()
2101+ var boolVal bool
2102+ if err := decoder79.Decode(&boolVal); err == nil {
2103+ t.Value = boolVal
2104+ return nil
2105+ }
2106+ decoder80 := json.NewDecoder(bytes.NewReader(x))
2107+ decoder80.DisallowUnknownFields()
2108+ var h80 HoverOptions
2109+ if err := decoder80.Decode(&h80); err == nil {
2110+ t.Value = h80
2111+ return nil
2112+ }
2113+ return &UnmarshalError{"unmarshal failed to match one of [HoverOptions bool]"}
2114+}
2115+
2116+func (t Or_ServerCapabilities_implementationProvider) MarshalJSON() ([]byte, error) {
2117+ switch x := t.Value.(type) {
2118+ case ImplementationOptions:
2119+ return json.Marshal(x)
2120+ case ImplementationRegistrationOptions:
2121+ return json.Marshal(x)
2122+ case bool:
2123+ return json.Marshal(x)
2124+ case nil:
2125+ return []byte("null"), nil
2126+ }
2127+ return nil, fmt.Errorf("type %T not one of [ImplementationOptions ImplementationRegistrationOptions bool]", t)
2128+}
2129+
2130+func (t *Or_ServerCapabilities_implementationProvider) UnmarshalJSON(x []byte) error {
2131+ if string(x) == "null" {
2132+ t.Value = nil
2133+ return nil
2134+ }
2135+ decoder96 := json.NewDecoder(bytes.NewReader(x))
2136+ decoder96.DisallowUnknownFields()
2137+ var boolVal bool
2138+ if err := decoder96.Decode(&boolVal); err == nil {
2139+ t.Value = boolVal
2140+ return nil
2141+ }
2142+ decoder97 := json.NewDecoder(bytes.NewReader(x))
2143+ decoder97.DisallowUnknownFields()
2144+ var h97 ImplementationOptions
2145+ if err := decoder97.Decode(&h97); err == nil {
2146+ t.Value = h97
2147+ return nil
2148+ }
2149+ decoder98 := json.NewDecoder(bytes.NewReader(x))
2150+ decoder98.DisallowUnknownFields()
2151+ var h98 ImplementationRegistrationOptions
2152+ if err := decoder98.Decode(&h98); err == nil {
2153+ t.Value = h98
2154+ return nil
2155+ }
2156+ return &UnmarshalError{"unmarshal failed to match one of [ImplementationOptions ImplementationRegistrationOptions bool]"}
2157+}
2158+
2159+func (t Or_ServerCapabilities_inlayHintProvider) MarshalJSON() ([]byte, error) {
2160+ switch x := t.Value.(type) {
2161+ case InlayHintOptions:
2162+ return json.Marshal(x)
2163+ case InlayHintRegistrationOptions:
2164+ return json.Marshal(x)
2165+ case bool:
2166+ return json.Marshal(x)
2167+ case nil:
2168+ return []byte("null"), nil
2169+ }
2170+ return nil, fmt.Errorf("type %T not one of [InlayHintOptions InlayHintRegistrationOptions bool]", t)
2171+}
2172+
2173+func (t *Or_ServerCapabilities_inlayHintProvider) UnmarshalJSON(x []byte) error {
2174+ if string(x) == "null" {
2175+ t.Value = nil
2176+ return nil
2177+ }
2178+ decoder169 := json.NewDecoder(bytes.NewReader(x))
2179+ decoder169.DisallowUnknownFields()
2180+ var boolVal bool
2181+ if err := decoder169.Decode(&boolVal); err == nil {
2182+ t.Value = boolVal
2183+ return nil
2184+ }
2185+ decoder170 := json.NewDecoder(bytes.NewReader(x))
2186+ decoder170.DisallowUnknownFields()
2187+ var h170 InlayHintOptions
2188+ if err := decoder170.Decode(&h170); err == nil {
2189+ t.Value = h170
2190+ return nil
2191+ }
2192+ decoder171 := json.NewDecoder(bytes.NewReader(x))
2193+ decoder171.DisallowUnknownFields()
2194+ var h171 InlayHintRegistrationOptions
2195+ if err := decoder171.Decode(&h171); err == nil {
2196+ t.Value = h171
2197+ return nil
2198+ }
2199+ return &UnmarshalError{"unmarshal failed to match one of [InlayHintOptions InlayHintRegistrationOptions bool]"}
2200+}
2201+
2202+func (t Or_ServerCapabilities_inlineCompletionProvider) MarshalJSON() ([]byte, error) {
2203+ switch x := t.Value.(type) {
2204+ case InlineCompletionOptions:
2205+ return json.Marshal(x)
2206+ case bool:
2207+ return json.Marshal(x)
2208+ case nil:
2209+ return []byte("null"), nil
2210+ }
2211+ return nil, fmt.Errorf("type %T not one of [InlineCompletionOptions bool]", t)
2212+}
2213+
2214+func (t *Or_ServerCapabilities_inlineCompletionProvider) UnmarshalJSON(x []byte) error {
2215+ if string(x) == "null" {
2216+ t.Value = nil
2217+ return nil
2218+ }
2219+ decoder177 := json.NewDecoder(bytes.NewReader(x))
2220+ decoder177.DisallowUnknownFields()
2221+ var boolVal bool
2222+ if err := decoder177.Decode(&boolVal); err == nil {
2223+ t.Value = boolVal
2224+ return nil
2225+ }
2226+ decoder178 := json.NewDecoder(bytes.NewReader(x))
2227+ decoder178.DisallowUnknownFields()
2228+ var h178 InlineCompletionOptions
2229+ if err := decoder178.Decode(&h178); err == nil {
2230+ t.Value = h178
2231+ return nil
2232+ }
2233+ return &UnmarshalError{"unmarshal failed to match one of [InlineCompletionOptions bool]"}
2234+}
2235+
2236+func (t Or_ServerCapabilities_inlineValueProvider) MarshalJSON() ([]byte, error) {
2237+ switch x := t.Value.(type) {
2238+ case InlineValueOptions:
2239+ return json.Marshal(x)
2240+ case InlineValueRegistrationOptions:
2241+ return json.Marshal(x)
2242+ case bool:
2243+ return json.Marshal(x)
2244+ case nil:
2245+ return []byte("null"), nil
2246+ }
2247+ return nil, fmt.Errorf("type %T not one of [InlineValueOptions InlineValueRegistrationOptions bool]", t)
2248+}
2249+
2250+func (t *Or_ServerCapabilities_inlineValueProvider) UnmarshalJSON(x []byte) error {
2251+ if string(x) == "null" {
2252+ t.Value = nil
2253+ return nil
2254+ }
2255+ decoder164 := json.NewDecoder(bytes.NewReader(x))
2256+ decoder164.DisallowUnknownFields()
2257+ var boolVal bool
2258+ if err := decoder164.Decode(&boolVal); err == nil {
2259+ t.Value = boolVal
2260+ return nil
2261+ }
2262+ decoder165 := json.NewDecoder(bytes.NewReader(x))
2263+ decoder165.DisallowUnknownFields()
2264+ var h165 InlineValueOptions
2265+ if err := decoder165.Decode(&h165); err == nil {
2266+ t.Value = h165
2267+ return nil
2268+ }
2269+ decoder166 := json.NewDecoder(bytes.NewReader(x))
2270+ decoder166.DisallowUnknownFields()
2271+ var h166 InlineValueRegistrationOptions
2272+ if err := decoder166.Decode(&h166); err == nil {
2273+ t.Value = h166
2274+ return nil
2275+ }
2276+ return &UnmarshalError{"unmarshal failed to match one of [InlineValueOptions InlineValueRegistrationOptions bool]"}
2277+}
2278+
2279+func (t Or_ServerCapabilities_linkedEditingRangeProvider) MarshalJSON() ([]byte, error) {
2280+ switch x := t.Value.(type) {
2281+ case LinkedEditingRangeOptions:
2282+ return json.Marshal(x)
2283+ case LinkedEditingRangeRegistrationOptions:
2284+ return json.Marshal(x)
2285+ case bool:
2286+ return json.Marshal(x)
2287+ case nil:
2288+ return []byte("null"), nil
2289+ }
2290+ return nil, fmt.Errorf("type %T not one of [LinkedEditingRangeOptions LinkedEditingRangeRegistrationOptions bool]", t)
2291+}
2292+
2293+func (t *Or_ServerCapabilities_linkedEditingRangeProvider) UnmarshalJSON(x []byte) error {
2294+ if string(x) == "null" {
2295+ t.Value = nil
2296+ return nil
2297+ }
2298+ decoder145 := json.NewDecoder(bytes.NewReader(x))
2299+ decoder145.DisallowUnknownFields()
2300+ var boolVal bool
2301+ if err := decoder145.Decode(&boolVal); err == nil {
2302+ t.Value = boolVal
2303+ return nil
2304+ }
2305+ decoder146 := json.NewDecoder(bytes.NewReader(x))
2306+ decoder146.DisallowUnknownFields()
2307+ var h146 LinkedEditingRangeOptions
2308+ if err := decoder146.Decode(&h146); err == nil {
2309+ t.Value = h146
2310+ return nil
2311+ }
2312+ decoder147 := json.NewDecoder(bytes.NewReader(x))
2313+ decoder147.DisallowUnknownFields()
2314+ var h147 LinkedEditingRangeRegistrationOptions
2315+ if err := decoder147.Decode(&h147); err == nil {
2316+ t.Value = h147
2317+ return nil
2318+ }
2319+ return &UnmarshalError{"unmarshal failed to match one of [LinkedEditingRangeOptions LinkedEditingRangeRegistrationOptions bool]"}
2320+}
2321+
2322+func (t Or_ServerCapabilities_monikerProvider) MarshalJSON() ([]byte, error) {
2323+ switch x := t.Value.(type) {
2324+ case MonikerOptions:
2325+ return json.Marshal(x)
2326+ case MonikerRegistrationOptions:
2327+ return json.Marshal(x)
2328+ case bool:
2329+ return json.Marshal(x)
2330+ case nil:
2331+ return []byte("null"), nil
2332+ }
2333+ return nil, fmt.Errorf("type %T not one of [MonikerOptions MonikerRegistrationOptions bool]", t)
2334+}
2335+
2336+func (t *Or_ServerCapabilities_monikerProvider) UnmarshalJSON(x []byte) error {
2337+ if string(x) == "null" {
2338+ t.Value = nil
2339+ return nil
2340+ }
2341+ decoder154 := json.NewDecoder(bytes.NewReader(x))
2342+ decoder154.DisallowUnknownFields()
2343+ var boolVal bool
2344+ if err := decoder154.Decode(&boolVal); err == nil {
2345+ t.Value = boolVal
2346+ return nil
2347+ }
2348+ decoder155 := json.NewDecoder(bytes.NewReader(x))
2349+ decoder155.DisallowUnknownFields()
2350+ var h155 MonikerOptions
2351+ if err := decoder155.Decode(&h155); err == nil {
2352+ t.Value = h155
2353+ return nil
2354+ }
2355+ decoder156 := json.NewDecoder(bytes.NewReader(x))
2356+ decoder156.DisallowUnknownFields()
2357+ var h156 MonikerRegistrationOptions
2358+ if err := decoder156.Decode(&h156); err == nil {
2359+ t.Value = h156
2360+ return nil
2361+ }
2362+ return &UnmarshalError{"unmarshal failed to match one of [MonikerOptions MonikerRegistrationOptions bool]"}
2363+}
2364+
2365+func (t Or_ServerCapabilities_notebookDocumentSync) MarshalJSON() ([]byte, error) {
2366+ switch x := t.Value.(type) {
2367+ case NotebookDocumentSyncOptions:
2368+ return json.Marshal(x)
2369+ case NotebookDocumentSyncRegistrationOptions:
2370+ return json.Marshal(x)
2371+ case nil:
2372+ return []byte("null"), nil
2373+ }
2374+ return nil, fmt.Errorf("type %T not one of [NotebookDocumentSyncOptions NotebookDocumentSyncRegistrationOptions]", t)
2375+}
2376+
2377+func (t *Or_ServerCapabilities_notebookDocumentSync) UnmarshalJSON(x []byte) error {
2378+ if string(x) == "null" {
2379+ t.Value = nil
2380+ return nil
2381+ }
2382+ decoder76 := json.NewDecoder(bytes.NewReader(x))
2383+ decoder76.DisallowUnknownFields()
2384+ var h76 NotebookDocumentSyncOptions
2385+ if err := decoder76.Decode(&h76); err == nil {
2386+ t.Value = h76
2387+ return nil
2388+ }
2389+ decoder77 := json.NewDecoder(bytes.NewReader(x))
2390+ decoder77.DisallowUnknownFields()
2391+ var h77 NotebookDocumentSyncRegistrationOptions
2392+ if err := decoder77.Decode(&h77); err == nil {
2393+ t.Value = h77
2394+ return nil
2395+ }
2396+ return &UnmarshalError{"unmarshal failed to match one of [NotebookDocumentSyncOptions NotebookDocumentSyncRegistrationOptions]"}
2397+}
2398+
2399+func (t Or_ServerCapabilities_referencesProvider) MarshalJSON() ([]byte, error) {
2400+ switch x := t.Value.(type) {
2401+ case ReferenceOptions:
2402+ return json.Marshal(x)
2403+ case bool:
2404+ return json.Marshal(x)
2405+ case nil:
2406+ return []byte("null"), nil
2407+ }
2408+ return nil, fmt.Errorf("type %T not one of [ReferenceOptions bool]", t)
2409+}
2410+
2411+func (t *Or_ServerCapabilities_referencesProvider) UnmarshalJSON(x []byte) error {
2412+ if string(x) == "null" {
2413+ t.Value = nil
2414+ return nil
2415+ }
2416+ decoder100 := json.NewDecoder(bytes.NewReader(x))
2417+ decoder100.DisallowUnknownFields()
2418+ var boolVal bool
2419+ if err := decoder100.Decode(&boolVal); err == nil {
2420+ t.Value = boolVal
2421+ return nil
2422+ }
2423+ decoder101 := json.NewDecoder(bytes.NewReader(x))
2424+ decoder101.DisallowUnknownFields()
2425+ var h101 ReferenceOptions
2426+ if err := decoder101.Decode(&h101); err == nil {
2427+ t.Value = h101
2428+ return nil
2429+ }
2430+ return &UnmarshalError{"unmarshal failed to match one of [ReferenceOptions bool]"}
2431+}
2432+
2433+func (t Or_ServerCapabilities_renameProvider) MarshalJSON() ([]byte, error) {
2434+ switch x := t.Value.(type) {
2435+ case RenameOptions:
2436+ return json.Marshal(x)
2437+ case bool:
2438+ return json.Marshal(x)
2439+ case nil:
2440+ return []byte("null"), nil
2441+ }
2442+ return nil, fmt.Errorf("type %T not one of [RenameOptions bool]", t)
2443+}
2444+
2445+func (t *Or_ServerCapabilities_renameProvider) UnmarshalJSON(x []byte) error {
2446+ if string(x) == "null" {
2447+ t.Value = nil
2448+ return nil
2449+ }
2450+ decoder126 := json.NewDecoder(bytes.NewReader(x))
2451+ decoder126.DisallowUnknownFields()
2452+ var boolVal bool
2453+ if err := decoder126.Decode(&boolVal); err == nil {
2454+ t.Value = boolVal
2455+ return nil
2456+ }
2457+ decoder127 := json.NewDecoder(bytes.NewReader(x))
2458+ decoder127.DisallowUnknownFields()
2459+ var h127 RenameOptions
2460+ if err := decoder127.Decode(&h127); err == nil {
2461+ t.Value = h127
2462+ return nil
2463+ }
2464+ return &UnmarshalError{"unmarshal failed to match one of [RenameOptions bool]"}
2465+}
2466+
2467+func (t Or_ServerCapabilities_selectionRangeProvider) MarshalJSON() ([]byte, error) {
2468+ switch x := t.Value.(type) {
2469+ case SelectionRangeOptions:
2470+ return json.Marshal(x)
2471+ case SelectionRangeRegistrationOptions:
2472+ return json.Marshal(x)
2473+ case bool:
2474+ return json.Marshal(x)
2475+ case nil:
2476+ return []byte("null"), nil
2477+ }
2478+ return nil, fmt.Errorf("type %T not one of [SelectionRangeOptions SelectionRangeRegistrationOptions bool]", t)
2479+}
2480+
2481+func (t *Or_ServerCapabilities_selectionRangeProvider) UnmarshalJSON(x []byte) error {
2482+ if string(x) == "null" {
2483+ t.Value = nil
2484+ return nil
2485+ }
2486+ decoder135 := json.NewDecoder(bytes.NewReader(x))
2487+ decoder135.DisallowUnknownFields()
2488+ var boolVal bool
2489+ if err := decoder135.Decode(&boolVal); err == nil {
2490+ t.Value = boolVal
2491+ return nil
2492+ }
2493+ decoder136 := json.NewDecoder(bytes.NewReader(x))
2494+ decoder136.DisallowUnknownFields()
2495+ var h136 SelectionRangeOptions
2496+ if err := decoder136.Decode(&h136); err == nil {
2497+ t.Value = h136
2498+ return nil
2499+ }
2500+ decoder137 := json.NewDecoder(bytes.NewReader(x))
2501+ decoder137.DisallowUnknownFields()
2502+ var h137 SelectionRangeRegistrationOptions
2503+ if err := decoder137.Decode(&h137); err == nil {
2504+ t.Value = h137
2505+ return nil
2506+ }
2507+ return &UnmarshalError{"unmarshal failed to match one of [SelectionRangeOptions SelectionRangeRegistrationOptions bool]"}
2508+}
2509+
2510+func (t Or_ServerCapabilities_semanticTokensProvider) MarshalJSON() ([]byte, error) {
2511+ switch x := t.Value.(type) {
2512+ case SemanticTokensOptions:
2513+ return json.Marshal(x)
2514+ case SemanticTokensRegistrationOptions:
2515+ return json.Marshal(x)
2516+ case nil:
2517+ return []byte("null"), nil
2518+ }
2519+ return nil, fmt.Errorf("type %T not one of [SemanticTokensOptions SemanticTokensRegistrationOptions]", t)
2520+}
2521+
2522+func (t *Or_ServerCapabilities_semanticTokensProvider) UnmarshalJSON(x []byte) error {
2523+ if string(x) == "null" {
2524+ t.Value = nil
2525+ return nil
2526+ }
2527+ decoder150 := json.NewDecoder(bytes.NewReader(x))
2528+ decoder150.DisallowUnknownFields()
2529+ var h150 SemanticTokensOptions
2530+ if err := decoder150.Decode(&h150); err == nil {
2531+ t.Value = h150
2532+ return nil
2533+ }
2534+ decoder151 := json.NewDecoder(bytes.NewReader(x))
2535+ decoder151.DisallowUnknownFields()
2536+ var h151 SemanticTokensRegistrationOptions
2537+ if err := decoder151.Decode(&h151); err == nil {
2538+ t.Value = h151
2539+ return nil
2540+ }
2541+ return &UnmarshalError{"unmarshal failed to match one of [SemanticTokensOptions SemanticTokensRegistrationOptions]"}
2542+}
2543+
2544+func (t Or_ServerCapabilities_textDocumentSync) MarshalJSON() ([]byte, error) {
2545+ switch x := t.Value.(type) {
2546+ case TextDocumentSyncKind:
2547+ return json.Marshal(x)
2548+ case TextDocumentSyncOptions:
2549+ return json.Marshal(x)
2550+ case nil:
2551+ return []byte("null"), nil
2552+ }
2553+ return nil, fmt.Errorf("type %T not one of [TextDocumentSyncKind TextDocumentSyncOptions]", t)
2554+}
2555+
2556+func (t *Or_ServerCapabilities_textDocumentSync) UnmarshalJSON(x []byte) error {
2557+ if string(x) == "null" {
2558+ t.Value = nil
2559+ return nil
2560+ }
2561+ decoder72 := json.NewDecoder(bytes.NewReader(x))
2562+ decoder72.DisallowUnknownFields()
2563+ var h72 TextDocumentSyncKind
2564+ if err := decoder72.Decode(&h72); err == nil {
2565+ t.Value = h72
2566+ return nil
2567+ }
2568+ decoder73 := json.NewDecoder(bytes.NewReader(x))
2569+ decoder73.DisallowUnknownFields()
2570+ var h73 TextDocumentSyncOptions
2571+ if err := decoder73.Decode(&h73); err == nil {
2572+ t.Value = h73
2573+ return nil
2574+ }
2575+ return &UnmarshalError{"unmarshal failed to match one of [TextDocumentSyncKind TextDocumentSyncOptions]"}
2576+}
2577+
2578+func (t Or_ServerCapabilities_typeDefinitionProvider) MarshalJSON() ([]byte, error) {
2579+ switch x := t.Value.(type) {
2580+ case TypeDefinitionOptions:
2581+ return json.Marshal(x)
2582+ case TypeDefinitionRegistrationOptions:
2583+ return json.Marshal(x)
2584+ case bool:
2585+ return json.Marshal(x)
2586+ case nil:
2587+ return []byte("null"), nil
2588+ }
2589+ return nil, fmt.Errorf("type %T not one of [TypeDefinitionOptions TypeDefinitionRegistrationOptions bool]", t)
2590+}
2591+
2592+func (t *Or_ServerCapabilities_typeDefinitionProvider) UnmarshalJSON(x []byte) error {
2593+ if string(x) == "null" {
2594+ t.Value = nil
2595+ return nil
2596+ }
2597+ decoder91 := json.NewDecoder(bytes.NewReader(x))
2598+ decoder91.DisallowUnknownFields()
2599+ var boolVal bool
2600+ if err := decoder91.Decode(&boolVal); err == nil {
2601+ t.Value = boolVal
2602+ return nil
2603+ }
2604+ decoder92 := json.NewDecoder(bytes.NewReader(x))
2605+ decoder92.DisallowUnknownFields()
2606+ var h92 TypeDefinitionOptions
2607+ if err := decoder92.Decode(&h92); err == nil {
2608+ t.Value = h92
2609+ return nil
2610+ }
2611+ decoder93 := json.NewDecoder(bytes.NewReader(x))
2612+ decoder93.DisallowUnknownFields()
2613+ var h93 TypeDefinitionRegistrationOptions
2614+ if err := decoder93.Decode(&h93); err == nil {
2615+ t.Value = h93
2616+ return nil
2617+ }
2618+ return &UnmarshalError{"unmarshal failed to match one of [TypeDefinitionOptions TypeDefinitionRegistrationOptions bool]"}
2619+}
2620+
2621+func (t Or_ServerCapabilities_typeHierarchyProvider) MarshalJSON() ([]byte, error) {
2622+ switch x := t.Value.(type) {
2623+ case TypeHierarchyOptions:
2624+ return json.Marshal(x)
2625+ case TypeHierarchyRegistrationOptions:
2626+ return json.Marshal(x)
2627+ case bool:
2628+ return json.Marshal(x)
2629+ case nil:
2630+ return []byte("null"), nil
2631+ }
2632+ return nil, fmt.Errorf("type %T not one of [TypeHierarchyOptions TypeHierarchyRegistrationOptions bool]", t)
2633+}
2634+
2635+func (t *Or_ServerCapabilities_typeHierarchyProvider) UnmarshalJSON(x []byte) error {
2636+ if string(x) == "null" {
2637+ t.Value = nil
2638+ return nil
2639+ }
2640+ decoder159 := json.NewDecoder(bytes.NewReader(x))
2641+ decoder159.DisallowUnknownFields()
2642+ var boolVal bool
2643+ if err := decoder159.Decode(&boolVal); err == nil {
2644+ t.Value = boolVal
2645+ return nil
2646+ }
2647+ decoder160 := json.NewDecoder(bytes.NewReader(x))
2648+ decoder160.DisallowUnknownFields()
2649+ var h160 TypeHierarchyOptions
2650+ if err := decoder160.Decode(&h160); err == nil {
2651+ t.Value = h160
2652+ return nil
2653+ }
2654+ decoder161 := json.NewDecoder(bytes.NewReader(x))
2655+ decoder161.DisallowUnknownFields()
2656+ var h161 TypeHierarchyRegistrationOptions
2657+ if err := decoder161.Decode(&h161); err == nil {
2658+ t.Value = h161
2659+ return nil
2660+ }
2661+ return &UnmarshalError{"unmarshal failed to match one of [TypeHierarchyOptions TypeHierarchyRegistrationOptions bool]"}
2662+}
2663+
2664+func (t Or_ServerCapabilities_workspaceSymbolProvider) MarshalJSON() ([]byte, error) {
2665+ switch x := t.Value.(type) {
2666+ case WorkspaceSymbolOptions:
2667+ return json.Marshal(x)
2668+ case bool:
2669+ return json.Marshal(x)
2670+ case nil:
2671+ return []byte("null"), nil
2672+ }
2673+ return nil, fmt.Errorf("type %T not one of [WorkspaceSymbolOptions bool]", t)
2674+}
2675+
2676+func (t *Or_ServerCapabilities_workspaceSymbolProvider) UnmarshalJSON(x []byte) error {
2677+ if string(x) == "null" {
2678+ t.Value = nil
2679+ return nil
2680+ }
2681+ decoder117 := json.NewDecoder(bytes.NewReader(x))
2682+ decoder117.DisallowUnknownFields()
2683+ var boolVal bool
2684+ if err := decoder117.Decode(&boolVal); err == nil {
2685+ t.Value = boolVal
2686+ return nil
2687+ }
2688+ decoder118 := json.NewDecoder(bytes.NewReader(x))
2689+ decoder118.DisallowUnknownFields()
2690+ var h118 WorkspaceSymbolOptions
2691+ if err := decoder118.Decode(&h118); err == nil {
2692+ t.Value = h118
2693+ return nil
2694+ }
2695+ return &UnmarshalError{"unmarshal failed to match one of [WorkspaceSymbolOptions bool]"}
2696+}
2697+
2698+func (t Or_SignatureInformation_documentation) MarshalJSON() ([]byte, error) {
2699+ switch x := t.Value.(type) {
2700+ case MarkupContent:
2701+ return json.Marshal(x)
2702+ case string:
2703+ return json.Marshal(x)
2704+ case nil:
2705+ return []byte("null"), nil
2706+ }
2707+ return nil, fmt.Errorf("type %T not one of [MarkupContent string]", t)
2708+}
2709+
2710+func (t *Or_SignatureInformation_documentation) UnmarshalJSON(x []byte) error {
2711+ if string(x) == "null" {
2712+ t.Value = nil
2713+ return nil
2714+ }
2715+ decoder186 := json.NewDecoder(bytes.NewReader(x))
2716+ decoder186.DisallowUnknownFields()
2717+ var stringVal string
2718+ if err := decoder186.Decode(&stringVal); err == nil {
2719+ t.Value = stringVal
2720+ return nil
2721+ }
2722+ decoder187 := json.NewDecoder(bytes.NewReader(x))
2723+ decoder187.DisallowUnknownFields()
2724+ var h187 MarkupContent
2725+ if err := decoder187.Decode(&h187); err == nil {
2726+ t.Value = h187
2727+ return nil
2728+ }
2729+ return &UnmarshalError{"unmarshal failed to match one of [MarkupContent string]"}
2730+}
2731+
2732+func (t Or_TextDocumentContentChangeEvent) MarshalJSON() ([]byte, error) {
2733+ switch x := t.Value.(type) {
2734+ case TextDocumentContentChangePartial:
2735+ return json.Marshal(x)
2736+ case TextDocumentContentChangeWholeDocument:
2737+ return json.Marshal(x)
2738+ case nil:
2739+ return []byte("null"), nil
2740+ }
2741+ return nil, fmt.Errorf("type %T not one of [TextDocumentContentChangePartial TextDocumentContentChangeWholeDocument]", t)
2742+}
2743+
2744+func (t *Or_TextDocumentContentChangeEvent) UnmarshalJSON(x []byte) error {
2745+ if string(x) == "null" {
2746+ t.Value = nil
2747+ return nil
2748+ }
2749+ decoder263 := json.NewDecoder(bytes.NewReader(x))
2750+ decoder263.DisallowUnknownFields()
2751+ var h263 TextDocumentContentChangePartial
2752+ if err := decoder263.Decode(&h263); err == nil {
2753+ t.Value = h263
2754+ return nil
2755+ }
2756+ decoder264 := json.NewDecoder(bytes.NewReader(x))
2757+ decoder264.DisallowUnknownFields()
2758+ var h264 TextDocumentContentChangeWholeDocument
2759+ if err := decoder264.Decode(&h264); err == nil {
2760+ t.Value = h264
2761+ return nil
2762+ }
2763+ return &UnmarshalError{"unmarshal failed to match one of [TextDocumentContentChangePartial TextDocumentContentChangeWholeDocument]"}
2764+}
2765+
2766+func (t Or_TextDocumentEdit_edits_Elem) MarshalJSON() ([]byte, error) {
2767+ switch x := t.Value.(type) {
2768+ case AnnotatedTextEdit:
2769+ return json.Marshal(x)
2770+ case SnippetTextEdit:
2771+ return json.Marshal(x)
2772+ case TextEdit:
2773+ return json.Marshal(x)
2774+ case nil:
2775+ return []byte("null"), nil
2776+ }
2777+ return nil, fmt.Errorf("type %T not one of [AnnotatedTextEdit SnippetTextEdit TextEdit]", t)
2778+}
2779+
2780+func (t *Or_TextDocumentEdit_edits_Elem) UnmarshalJSON(x []byte) error {
2781+ if string(x) == "null" {
2782+ t.Value = nil
2783+ return nil
2784+ }
2785+ decoder52 := json.NewDecoder(bytes.NewReader(x))
2786+ decoder52.DisallowUnknownFields()
2787+ var h52 AnnotatedTextEdit
2788+ if err := decoder52.Decode(&h52); err == nil {
2789+ t.Value = h52
2790+ return nil
2791+ }
2792+ decoder53 := json.NewDecoder(bytes.NewReader(x))
2793+ decoder53.DisallowUnknownFields()
2794+ var h53 SnippetTextEdit
2795+ if err := decoder53.Decode(&h53); err == nil {
2796+ t.Value = h53
2797+ return nil
2798+ }
2799+ decoder54 := json.NewDecoder(bytes.NewReader(x))
2800+ decoder54.DisallowUnknownFields()
2801+ var h54 TextEdit
2802+ if err := decoder54.Decode(&h54); err == nil {
2803+ t.Value = h54
2804+ return nil
2805+ }
2806+ return &UnmarshalError{"unmarshal failed to match one of [AnnotatedTextEdit SnippetTextEdit TextEdit]"}
2807+}
2808+
2809+func (t Or_TextDocumentFilter) MarshalJSON() ([]byte, error) {
2810+ switch x := t.Value.(type) {
2811+ case TextDocumentFilterLanguage:
2812+ return json.Marshal(x)
2813+ case TextDocumentFilterPattern:
2814+ return json.Marshal(x)
2815+ case TextDocumentFilterScheme:
2816+ return json.Marshal(x)
2817+ case nil:
2818+ return []byte("null"), nil
2819+ }
2820+ return nil, fmt.Errorf("type %T not one of [TextDocumentFilterLanguage TextDocumentFilterPattern TextDocumentFilterScheme]", t)
2821+}
2822+
2823+func (t *Or_TextDocumentFilter) UnmarshalJSON(x []byte) error {
2824+ if string(x) == "null" {
2825+ t.Value = nil
2826+ return nil
2827+ }
2828+ decoder279 := json.NewDecoder(bytes.NewReader(x))
2829+ decoder279.DisallowUnknownFields()
2830+ var h279 TextDocumentFilterLanguage
2831+ if err := decoder279.Decode(&h279); err == nil {
2832+ t.Value = h279
2833+ return nil
2834+ }
2835+ decoder280 := json.NewDecoder(bytes.NewReader(x))
2836+ decoder280.DisallowUnknownFields()
2837+ var h280 TextDocumentFilterPattern
2838+ if err := decoder280.Decode(&h280); err == nil {
2839+ t.Value = h280
2840+ return nil
2841+ }
2842+ decoder281 := json.NewDecoder(bytes.NewReader(x))
2843+ decoder281.DisallowUnknownFields()
2844+ var h281 TextDocumentFilterScheme
2845+ if err := decoder281.Decode(&h281); err == nil {
2846+ t.Value = h281
2847+ return nil
2848+ }
2849+ return &UnmarshalError{"unmarshal failed to match one of [TextDocumentFilterLanguage TextDocumentFilterPattern TextDocumentFilterScheme]"}
2850+}
2851+
2852+func (t Or_TextDocumentSyncOptions_save) MarshalJSON() ([]byte, error) {
2853+ switch x := t.Value.(type) {
2854+ case SaveOptions:
2855+ return json.Marshal(x)
2856+ case bool:
2857+ return json.Marshal(x)
2858+ case nil:
2859+ return []byte("null"), nil
2860+ }
2861+ return nil, fmt.Errorf("type %T not one of [SaveOptions bool]", t)
2862+}
2863+
2864+func (t *Or_TextDocumentSyncOptions_save) UnmarshalJSON(x []byte) error {
2865+ if string(x) == "null" {
2866+ t.Value = nil
2867+ return nil
2868+ }
2869+ decoder195 := json.NewDecoder(bytes.NewReader(x))
2870+ decoder195.DisallowUnknownFields()
2871+ var boolVal bool
2872+ if err := decoder195.Decode(&boolVal); err == nil {
2873+ t.Value = boolVal
2874+ return nil
2875+ }
2876+ decoder196 := json.NewDecoder(bytes.NewReader(x))
2877+ decoder196.DisallowUnknownFields()
2878+ var h196 SaveOptions
2879+ if err := decoder196.Decode(&h196); err == nil {
2880+ t.Value = h196
2881+ return nil
2882+ }
2883+ return &UnmarshalError{"unmarshal failed to match one of [SaveOptions bool]"}
2884+}
2885+
2886+func (t Or_WorkspaceDocumentDiagnosticReport) MarshalJSON() ([]byte, error) {
2887+ switch x := t.Value.(type) {
2888+ case WorkspaceFullDocumentDiagnosticReport:
2889+ return json.Marshal(x)
2890+ case WorkspaceUnchangedDocumentDiagnosticReport:
2891+ return json.Marshal(x)
2892+ case nil:
2893+ return []byte("null"), nil
2894+ }
2895+ return nil, fmt.Errorf("type %T not one of [WorkspaceFullDocumentDiagnosticReport WorkspaceUnchangedDocumentDiagnosticReport]", t)
2896+}
2897+
2898+func (t *Or_WorkspaceDocumentDiagnosticReport) UnmarshalJSON(x []byte) error {
2899+ if string(x) == "null" {
2900+ t.Value = nil
2901+ return nil
2902+ }
2903+ decoder259 := json.NewDecoder(bytes.NewReader(x))
2904+ decoder259.DisallowUnknownFields()
2905+ var h259 WorkspaceFullDocumentDiagnosticReport
2906+ if err := decoder259.Decode(&h259); err == nil {
2907+ t.Value = h259
2908+ return nil
2909+ }
2910+ decoder260 := json.NewDecoder(bytes.NewReader(x))
2911+ decoder260.DisallowUnknownFields()
2912+ var h260 WorkspaceUnchangedDocumentDiagnosticReport
2913+ if err := decoder260.Decode(&h260); err == nil {
2914+ t.Value = h260
2915+ return nil
2916+ }
2917+ return &UnmarshalError{"unmarshal failed to match one of [WorkspaceFullDocumentDiagnosticReport WorkspaceUnchangedDocumentDiagnosticReport]"}
2918+}
2919+
2920+func (t Or_WorkspaceEdit_documentChanges_Elem) MarshalJSON() ([]byte, error) {
2921+ switch x := t.Value.(type) {
2922+ case CreateFile:
2923+ return json.Marshal(x)
2924+ case DeleteFile:
2925+ return json.Marshal(x)
2926+ case RenameFile:
2927+ return json.Marshal(x)
2928+ case TextDocumentEdit:
2929+ return json.Marshal(x)
2930+ case nil:
2931+ return []byte("null"), nil
2932+ }
2933+ return nil, fmt.Errorf("type %T not one of [CreateFile DeleteFile RenameFile TextDocumentEdit]", t)
2934+}
2935+
2936+func (t *Or_WorkspaceEdit_documentChanges_Elem) UnmarshalJSON(x []byte) error {
2937+ if string(x) == "null" {
2938+ t.Value = nil
2939+ return nil
2940+ }
2941+ decoder4 := json.NewDecoder(bytes.NewReader(x))
2942+ decoder4.DisallowUnknownFields()
2943+ var h4 CreateFile
2944+ if err := decoder4.Decode(&h4); err == nil {
2945+ t.Value = h4
2946+ return nil
2947+ }
2948+ decoder5 := json.NewDecoder(bytes.NewReader(x))
2949+ decoder5.DisallowUnknownFields()
2950+ var h5 DeleteFile
2951+ if err := decoder5.Decode(&h5); err == nil {
2952+ t.Value = h5
2953+ return nil
2954+ }
2955+ decoder6 := json.NewDecoder(bytes.NewReader(x))
2956+ decoder6.DisallowUnknownFields()
2957+ var h6 RenameFile
2958+ if err := decoder6.Decode(&h6); err == nil {
2959+ t.Value = h6
2960+ return nil
2961+ }
2962+ decoder7 := json.NewDecoder(bytes.NewReader(x))
2963+ decoder7.DisallowUnknownFields()
2964+ var h7 TextDocumentEdit
2965+ if err := decoder7.Decode(&h7); err == nil {
2966+ t.Value = h7
2967+ return nil
2968+ }
2969+ return &UnmarshalError{"unmarshal failed to match one of [CreateFile DeleteFile RenameFile TextDocumentEdit]"}
2970+}
2971+
2972+func (t Or_WorkspaceFoldersServerCapabilities_changeNotifications) MarshalJSON() ([]byte, error) {
2973+ switch x := t.Value.(type) {
2974+ case bool:
2975+ return json.Marshal(x)
2976+ case string:
2977+ return json.Marshal(x)
2978+ case nil:
2979+ return []byte("null"), nil
2980+ }
2981+ return nil, fmt.Errorf("type %T not one of [bool string]", t)
2982+}
2983+
2984+func (t *Or_WorkspaceFoldersServerCapabilities_changeNotifications) UnmarshalJSON(x []byte) error {
2985+ if string(x) == "null" {
2986+ t.Value = nil
2987+ return nil
2988+ }
2989+ decoder210 := json.NewDecoder(bytes.NewReader(x))
2990+ decoder210.DisallowUnknownFields()
2991+ var boolVal bool
2992+ if err := decoder210.Decode(&boolVal); err == nil {
2993+ t.Value = boolVal
2994+ return nil
2995+ }
2996+ decoder211 := json.NewDecoder(bytes.NewReader(x))
2997+ decoder211.DisallowUnknownFields()
2998+ var stringVal string
2999+ if err := decoder211.Decode(&stringVal); err == nil {
3000+ t.Value = stringVal
3001+ return nil
3002+ }
3003+ return &UnmarshalError{"unmarshal failed to match one of [bool string]"}
3004+}
3005+
3006+func (t Or_WorkspaceOptions_textDocumentContent) MarshalJSON() ([]byte, error) {
3007+ switch x := t.Value.(type) {
3008+ case TextDocumentContentOptions:
3009+ return json.Marshal(x)
3010+ case TextDocumentContentRegistrationOptions:
3011+ return json.Marshal(x)
3012+ case nil:
3013+ return []byte("null"), nil
3014+ }
3015+ return nil, fmt.Errorf("type %T not one of [TextDocumentContentOptions TextDocumentContentRegistrationOptions]", t)
3016+}
3017+
3018+func (t *Or_WorkspaceOptions_textDocumentContent) UnmarshalJSON(x []byte) error {
3019+ if string(x) == "null" {
3020+ t.Value = nil
3021+ return nil
3022+ }
3023+ decoder199 := json.NewDecoder(bytes.NewReader(x))
3024+ decoder199.DisallowUnknownFields()
3025+ var h199 TextDocumentContentOptions
3026+ if err := decoder199.Decode(&h199); err == nil {
3027+ t.Value = h199
3028+ return nil
3029+ }
3030+ decoder200 := json.NewDecoder(bytes.NewReader(x))
3031+ decoder200.DisallowUnknownFields()
3032+ var h200 TextDocumentContentRegistrationOptions
3033+ if err := decoder200.Decode(&h200); err == nil {
3034+ t.Value = h200
3035+ return nil
3036+ }
3037+ return &UnmarshalError{"unmarshal failed to match one of [TextDocumentContentOptions TextDocumentContentRegistrationOptions]"}
3038+}
3039+
3040+func (t Or_WorkspaceSymbol_location) MarshalJSON() ([]byte, error) {
3041+ switch x := t.Value.(type) {
3042+ case Location:
3043+ return json.Marshal(x)
3044+ case LocationUriOnly:
3045+ return json.Marshal(x)
3046+ case nil:
3047+ return []byte("null"), nil
3048+ }
3049+ return nil, fmt.Errorf("type %T not one of [Location LocationUriOnly]", t)
3050+}
3051+
3052+func (t *Or_WorkspaceSymbol_location) UnmarshalJSON(x []byte) error {
3053+ if string(x) == "null" {
3054+ t.Value = nil
3055+ return nil
3056+ }
3057+ decoder39 := json.NewDecoder(bytes.NewReader(x))
3058+ decoder39.DisallowUnknownFields()
3059+ var h39 Location
3060+ if err := decoder39.Decode(&h39); err == nil {
3061+ t.Value = h39
3062+ return nil
3063+ }
3064+ decoder40 := json.NewDecoder(bytes.NewReader(x))
3065+ decoder40.DisallowUnknownFields()
3066+ var h40 LocationUriOnly
3067+ if err := decoder40.Decode(&h40); err == nil {
3068+ t.Value = h40
3069+ return nil
3070+ }
3071+ return &UnmarshalError{"unmarshal failed to match one of [Location LocationUriOnly]"}
3072+}
internal/lsp/protocol/tsprotocol.gonew file+6907
@@ -0,0 +1,6907 @@
1+// Copyright 2023 The Go Authors. All rights reserved.
2+// Use of this source code is governed by a BSD-style
3+// license that can be found in the LICENSE file.
4+
5+// Code generated for LSP. DO NOT EDIT.
6+
7+package protocol
8+
9+// Code generated from protocol/metaModel.json at ref release/protocol/3.17.6-next.9 (hash c94395b5da53729e6dff931293b051009ccaaaa4).
10+// https://github.com/microsoft/vscode-languageserver-node/blob/release/protocol/3.17.6-next.9/protocol/metaModel.json
11+// LSP metaData.version = 3.17.0.
12+
13+import "encoding/json"
14+
15+// created for And
16+type And_RegOpt_textDocument_colorPresentation struct {
17+ WorkDoneProgressOptions
18+ TextDocumentRegistrationOptions
19+}
20+
21+// A special text edit with an additional change annotation.
22+//
23+// @since 3.16.0.
24+//
25+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#annotatedTextEdit
26+type AnnotatedTextEdit struct {
27+ // The actual identifier of the change annotation
28+ AnnotationID *ChangeAnnotationIdentifier `json:"annotationId,omitempty"`
29+ TextEdit
30+}
31+
32+// The parameters passed via an apply workspace edit request.
33+//
34+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#applyWorkspaceEditParams
35+type ApplyWorkspaceEditParams struct {
36+ // An optional label of the workspace edit. This label is
37+ // presented in the user interface for example on an undo
38+ // stack to undo the workspace edit.
39+ Label string `json:"label,omitempty"`
40+ // The edits to apply.
41+ Edit WorkspaceEdit `json:"edit"`
42+ // Additional data about the edit.
43+ //
44+ // @since 3.18.0
45+ // @proposed
46+ Metadata *WorkspaceEditMetadata `json:"metadata,omitempty"`
47+}
48+
49+// The result returned from the apply workspace edit request.
50+//
51+// @since 3.17 renamed from ApplyWorkspaceEditResponse
52+//
53+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#applyWorkspaceEditResult
54+type ApplyWorkspaceEditResult struct {
55+ // Indicates whether the edit was applied or not.
56+ Applied bool `json:"applied"`
57+ // An optional textual description for why the edit was not applied.
58+ // This may be used by the server for diagnostic logging or to provide
59+ // a suitable error for a request that triggered the edit.
60+ FailureReason string `json:"failureReason,omitempty"`
61+ // Depending on the client's failure handling strategy `failedChange` might
62+ // contain the index of the change that failed. This property is only available
63+ // if the client signals a `failureHandlingStrategy` in its client capabilities.
64+ FailedChange uint32 `json:"failedChange,omitempty"`
65+}
66+
67+// A base for all symbol information.
68+//
69+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#baseSymbolInformation
70+type BaseSymbolInformation struct {
71+ // The name of this symbol.
72+ Name string `json:"name"`
73+ // The kind of this symbol.
74+ Kind SymbolKind `json:"kind"`
75+ // Tags for this symbol.
76+ //
77+ // @since 3.16.0
78+ Tags []SymbolTag `json:"tags,omitempty"`
79+ // The name of the symbol containing this symbol. This information is for
80+ // user interface purposes (e.g. to render a qualifier in the user interface
81+ // if necessary). It can't be used to re-infer a hierarchy for the document
82+ // symbols.
83+ ContainerName string `json:"containerName,omitempty"`
84+}
85+
86+// @since 3.16.0
87+//
88+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#callHierarchyClientCapabilities
89+type CallHierarchyClientCapabilities struct {
90+ // Whether implementation supports dynamic registration. If this is set to `true`
91+ // the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
92+ // return value for the corresponding server capability as well.
93+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
94+}
95+
96+// Represents an incoming call, e.g. a caller of a method or constructor.
97+//
98+// @since 3.16.0
99+//
100+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#callHierarchyIncomingCall
101+type CallHierarchyIncomingCall struct {
102+ // The item that makes the call.
103+ From CallHierarchyItem `json:"from"`
104+ // The ranges at which the calls appear. This is relative to the caller
105+ // denoted by {@link CallHierarchyIncomingCall.from `this.from`}.
106+ FromRanges []Range `json:"fromRanges"`
107+}
108+
109+// The parameter of a `callHierarchy/incomingCalls` request.
110+//
111+// @since 3.16.0
112+//
113+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#callHierarchyIncomingCallsParams
114+type CallHierarchyIncomingCallsParams struct {
115+ Item CallHierarchyItem `json:"item"`
116+ WorkDoneProgressParams
117+ PartialResultParams
118+}
119+
120+// Represents programming constructs like functions or constructors in the context
121+// of call hierarchy.
122+//
123+// @since 3.16.0
124+//
125+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#callHierarchyItem
126+type CallHierarchyItem struct {
127+ // The name of this item.
128+ Name string `json:"name"`
129+ // The kind of this item.
130+ Kind SymbolKind `json:"kind"`
131+ // Tags for this item.
132+ Tags []SymbolTag `json:"tags,omitempty"`
133+ // More detail for this item, e.g. the signature of a function.
134+ Detail string `json:"detail,omitempty"`
135+ // The resource identifier of this item.
136+ URI DocumentUri `json:"uri"`
137+ // The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code.
138+ Range Range `json:"range"`
139+ // The range that should be selected and revealed when this symbol is being picked, e.g. the name of a function.
140+ // Must be contained by the {@link CallHierarchyItem.range `range`}.
141+ SelectionRange Range `json:"selectionRange"`
142+ // A data entry field that is preserved between a call hierarchy prepare and
143+ // incoming calls or outgoing calls requests.
144+ Data interface{} `json:"data,omitempty"`
145+}
146+
147+// Call hierarchy options used during static registration.
148+//
149+// @since 3.16.0
150+//
151+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#callHierarchyOptions
152+type CallHierarchyOptions struct {
153+ WorkDoneProgressOptions
154+}
155+
156+// Represents an outgoing call, e.g. calling a getter from a method or a method from a constructor etc.
157+//
158+// @since 3.16.0
159+//
160+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#callHierarchyOutgoingCall
161+type CallHierarchyOutgoingCall struct {
162+ // The item that is called.
163+ To CallHierarchyItem `json:"to"`
164+ // The range at which this item is called. This is the range relative to the caller, e.g the item
165+ // passed to {@link CallHierarchyItemProvider.provideCallHierarchyOutgoingCalls `provideCallHierarchyOutgoingCalls`}
166+ // and not {@link CallHierarchyOutgoingCall.to `this.to`}.
167+ FromRanges []Range `json:"fromRanges"`
168+}
169+
170+// The parameter of a `callHierarchy/outgoingCalls` request.
171+//
172+// @since 3.16.0
173+//
174+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#callHierarchyOutgoingCallsParams
175+type CallHierarchyOutgoingCallsParams struct {
176+ Item CallHierarchyItem `json:"item"`
177+ WorkDoneProgressParams
178+ PartialResultParams
179+}
180+
181+// The parameter of a `textDocument/prepareCallHierarchy` request.
182+//
183+// @since 3.16.0
184+//
185+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#callHierarchyPrepareParams
186+type CallHierarchyPrepareParams struct {
187+ TextDocumentPositionParams
188+ WorkDoneProgressParams
189+}
190+
191+// Call hierarchy options used during static or dynamic registration.
192+//
193+// @since 3.16.0
194+//
195+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#callHierarchyRegistrationOptions
196+type CallHierarchyRegistrationOptions struct {
197+ TextDocumentRegistrationOptions
198+ CallHierarchyOptions
199+ StaticRegistrationOptions
200+}
201+
202+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#cancelParams
203+type CancelParams struct {
204+ // The request id to cancel.
205+ ID interface{} `json:"id"`
206+}
207+
208+// Additional information that describes document changes.
209+//
210+// @since 3.16.0
211+//
212+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#changeAnnotation
213+type ChangeAnnotation struct {
214+ // A human-readable string describing the actual change. The string
215+ // is rendered prominent in the user interface.
216+ Label string `json:"label"`
217+ // A flag which indicates that user confirmation is needed
218+ // before applying the change.
219+ NeedsConfirmation bool `json:"needsConfirmation,omitempty"`
220+ // A human-readable string which is rendered less prominent in
221+ // the user interface.
222+ Description string `json:"description,omitempty"`
223+}
224+
225+// An identifier to refer to a change annotation stored with a workspace edit.
226+//
227+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#changeAnnotationIdentifier
228+type ChangeAnnotationIdentifier = string // (alias)
229+// @since 3.18.0
230+//
231+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#changeAnnotationsSupportOptions
232+type ChangeAnnotationsSupportOptions struct {
233+ // Whether the client groups edits with equal labels into tree nodes,
234+ // for instance all edits labelled with "Changes in Strings" would
235+ // be a tree node.
236+ GroupsOnLabel bool `json:"groupsOnLabel,omitempty"`
237+}
238+
239+// Defines the capabilities provided by the client.
240+//
241+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientCapabilities
242+type ClientCapabilities struct {
243+ // Workspace specific client capabilities.
244+ Workspace WorkspaceClientCapabilities `json:"workspace,omitempty"`
245+ // Text document specific client capabilities.
246+ TextDocument TextDocumentClientCapabilities `json:"textDocument,omitempty"`
247+ // Capabilities specific to the notebook document support.
248+ //
249+ // @since 3.17.0
250+ NotebookDocument *NotebookDocumentClientCapabilities `json:"notebookDocument,omitempty"`
251+ // Window specific client capabilities.
252+ Window WindowClientCapabilities `json:"window,omitempty"`
253+ // General client capabilities.
254+ //
255+ // @since 3.16.0
256+ General *GeneralClientCapabilities `json:"general,omitempty"`
257+ // Experimental client capabilities.
258+ Experimental interface{} `json:"experimental,omitempty"`
259+}
260+
261+// @since 3.18.0
262+//
263+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientCodeActionKindOptions
264+type ClientCodeActionKindOptions struct {
265+ // The code action kind values the client supports. When this
266+ // property exists the client also guarantees that it will
267+ // handle values outside its set gracefully and falls back
268+ // to a default value when unknown.
269+ ValueSet []CodeActionKind `json:"valueSet"`
270+}
271+
272+// @since 3.18.0
273+//
274+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientCodeActionLiteralOptions
275+type ClientCodeActionLiteralOptions struct {
276+ // The code action kind is support with the following value
277+ // set.
278+ CodeActionKind ClientCodeActionKindOptions `json:"codeActionKind"`
279+}
280+
281+// @since 3.18.0
282+//
283+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientCodeActionResolveOptions
284+type ClientCodeActionResolveOptions struct {
285+ // The properties that a client can resolve lazily.
286+ Properties []string `json:"properties"`
287+}
288+
289+// @since 3.18.0
290+//
291+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientCodeLensResolveOptions
292+type ClientCodeLensResolveOptions struct {
293+ // The properties that a client can resolve lazily.
294+ Properties []string `json:"properties"`
295+}
296+
297+// @since 3.18.0
298+//
299+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientCompletionItemInsertTextModeOptions
300+type ClientCompletionItemInsertTextModeOptions struct {
301+ ValueSet []InsertTextMode `json:"valueSet"`
302+}
303+
304+// @since 3.18.0
305+//
306+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientCompletionItemOptions
307+type ClientCompletionItemOptions struct {
308+ // Client supports snippets as insert text.
309+ //
310+ // A snippet can define tab stops and placeholders with `$1`, `$2`
311+ // and `${3:foo}`. `$0` defines the final tab stop, it defaults to
312+ // the end of the snippet. Placeholders with equal identifiers are linked,
313+ // that is typing in one will update others too.
314+ SnippetSupport bool `json:"snippetSupport,omitempty"`
315+ // Client supports commit characters on a completion item.
316+ CommitCharactersSupport bool `json:"commitCharactersSupport,omitempty"`
317+ // Client supports the following content formats for the documentation
318+ // property. The order describes the preferred format of the client.
319+ DocumentationFormat []MarkupKind `json:"documentationFormat,omitempty"`
320+ // Client supports the deprecated property on a completion item.
321+ DeprecatedSupport bool `json:"deprecatedSupport,omitempty"`
322+ // Client supports the preselect property on a completion item.
323+ PreselectSupport bool `json:"preselectSupport,omitempty"`
324+ // Client supports the tag property on a completion item. Clients supporting
325+ // tags have to handle unknown tags gracefully. Clients especially need to
326+ // preserve unknown tags when sending a completion item back to the server in
327+ // a resolve call.
328+ //
329+ // @since 3.15.0
330+ TagSupport *CompletionItemTagOptions `json:"tagSupport,omitempty"`
331+ // Client support insert replace edit to control different behavior if a
332+ // completion item is inserted in the text or should replace text.
333+ //
334+ // @since 3.16.0
335+ InsertReplaceSupport bool `json:"insertReplaceSupport,omitempty"`
336+ // Indicates which properties a client can resolve lazily on a completion
337+ // item. Before version 3.16.0 only the predefined properties `documentation`
338+ // and `details` could be resolved lazily.
339+ //
340+ // @since 3.16.0
341+ ResolveSupport *ClientCompletionItemResolveOptions `json:"resolveSupport,omitempty"`
342+ // The client supports the `insertTextMode` property on
343+ // a completion item to override the whitespace handling mode
344+ // as defined by the client (see `insertTextMode`).
345+ //
346+ // @since 3.16.0
347+ InsertTextModeSupport *ClientCompletionItemInsertTextModeOptions `json:"insertTextModeSupport,omitempty"`
348+ // The client has support for completion item label
349+ // details (see also `CompletionItemLabelDetails`).
350+ //
351+ // @since 3.17.0
352+ LabelDetailsSupport bool `json:"labelDetailsSupport,omitempty"`
353+}
354+
355+// @since 3.18.0
356+//
357+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientCompletionItemOptionsKind
358+type ClientCompletionItemOptionsKind struct {
359+ // The completion item kind values the client supports. When this
360+ // property exists the client also guarantees that it will
361+ // handle values outside its set gracefully and falls back
362+ // to a default value when unknown.
363+ //
364+ // If this property is not present the client only supports
365+ // the completion items kinds from `Text` to `Reference` as defined in
366+ // the initial version of the protocol.
367+ ValueSet []CompletionItemKind `json:"valueSet,omitempty"`
368+}
369+
370+// @since 3.18.0
371+//
372+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientCompletionItemResolveOptions
373+type ClientCompletionItemResolveOptions struct {
374+ // The properties that a client can resolve lazily.
375+ Properties []string `json:"properties"`
376+}
377+
378+// @since 3.18.0
379+//
380+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientDiagnosticsTagOptions
381+type ClientDiagnosticsTagOptions struct {
382+ // The tags supported by the client.
383+ ValueSet []DiagnosticTag `json:"valueSet"`
384+}
385+
386+// @since 3.18.0
387+//
388+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientFoldingRangeKindOptions
389+type ClientFoldingRangeKindOptions struct {
390+ // The folding range kind values the client supports. When this
391+ // property exists the client also guarantees that it will
392+ // handle values outside its set gracefully and falls back
393+ // to a default value when unknown.
394+ ValueSet []FoldingRangeKind `json:"valueSet,omitempty"`
395+}
396+
397+// @since 3.18.0
398+//
399+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientFoldingRangeOptions
400+type ClientFoldingRangeOptions struct {
401+ // If set, the client signals that it supports setting collapsedText on
402+ // folding ranges to display custom labels instead of the default text.
403+ //
404+ // @since 3.17.0
405+ CollapsedText bool `json:"collapsedText,omitempty"`
406+}
407+
408+// Information about the client
409+//
410+// @since 3.15.0
411+// @since 3.18.0 ClientInfo type name added.
412+//
413+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientInfo
414+type ClientInfo struct {
415+ // The name of the client as defined by the client.
416+ Name string `json:"name"`
417+ // The client's version as defined by the client.
418+ Version string `json:"version,omitempty"`
419+}
420+
421+// @since 3.18.0
422+//
423+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientInlayHintResolveOptions
424+type ClientInlayHintResolveOptions struct {
425+ // The properties that a client can resolve lazily.
426+ Properties []string `json:"properties"`
427+}
428+
429+// @since 3.18.0
430+//
431+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientSemanticTokensRequestFullDelta
432+type ClientSemanticTokensRequestFullDelta struct {
433+ // The client will send the `textDocument/semanticTokens/full/delta` request if
434+ // the server provides a corresponding handler.
435+ Delta bool `json:"delta,omitempty"`
436+}
437+
438+// @since 3.18.0
439+//
440+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientSemanticTokensRequestOptions
441+type ClientSemanticTokensRequestOptions struct {
442+ // The client will send the `textDocument/semanticTokens/range` request if
443+ // the server provides a corresponding handler.
444+ Range *Or_ClientSemanticTokensRequestOptions_range `json:"range,omitempty"`
445+ // The client will send the `textDocument/semanticTokens/full` request if
446+ // the server provides a corresponding handler.
447+ Full *Or_ClientSemanticTokensRequestOptions_full `json:"full,omitempty"`
448+}
449+
450+// @since 3.18.0
451+//
452+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientShowMessageActionItemOptions
453+type ClientShowMessageActionItemOptions struct {
454+ // Whether the client supports additional attributes which
455+ // are preserved and send back to the server in the
456+ // request's response.
457+ AdditionalPropertiesSupport bool `json:"additionalPropertiesSupport,omitempty"`
458+}
459+
460+// @since 3.18.0
461+//
462+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientSignatureInformationOptions
463+type ClientSignatureInformationOptions struct {
464+ // Client supports the following content formats for the documentation
465+ // property. The order describes the preferred format of the client.
466+ DocumentationFormat []MarkupKind `json:"documentationFormat,omitempty"`
467+ // Client capabilities specific to parameter information.
468+ ParameterInformation *ClientSignatureParameterInformationOptions `json:"parameterInformation,omitempty"`
469+ // The client supports the `activeParameter` property on `SignatureInformation`
470+ // literal.
471+ //
472+ // @since 3.16.0
473+ ActiveParameterSupport bool `json:"activeParameterSupport,omitempty"`
474+ // The client supports the `activeParameter` property on
475+ // `SignatureHelp`/`SignatureInformation` being set to `null` to
476+ // indicate that no parameter should be active.
477+ //
478+ // @since 3.18.0
479+ // @proposed
480+ NoActiveParameterSupport bool `json:"noActiveParameterSupport,omitempty"`
481+}
482+
483+// @since 3.18.0
484+//
485+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientSignatureParameterInformationOptions
486+type ClientSignatureParameterInformationOptions struct {
487+ // The client supports processing label offsets instead of a
488+ // simple label string.
489+ //
490+ // @since 3.14.0
491+ LabelOffsetSupport bool `json:"labelOffsetSupport,omitempty"`
492+}
493+
494+// @since 3.18.0
495+//
496+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientSymbolKindOptions
497+type ClientSymbolKindOptions struct {
498+ // The symbol kind values the client supports. When this
499+ // property exists the client also guarantees that it will
500+ // handle values outside its set gracefully and falls back
501+ // to a default value when unknown.
502+ //
503+ // If this property is not present the client only supports
504+ // the symbol kinds from `File` to `Array` as defined in
505+ // the initial version of the protocol.
506+ ValueSet []SymbolKind `json:"valueSet,omitempty"`
507+}
508+
509+// @since 3.18.0
510+//
511+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientSymbolResolveOptions
512+type ClientSymbolResolveOptions struct {
513+ // The properties that a client can resolve lazily. Usually
514+ // `location.range`
515+ Properties []string `json:"properties"`
516+}
517+
518+// @since 3.18.0
519+//
520+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientSymbolTagOptions
521+type ClientSymbolTagOptions struct {
522+ // The tags supported by the client.
523+ ValueSet []SymbolTag `json:"valueSet"`
524+}
525+
526+// A code action represents a change that can be performed in code, e.g. to fix a problem or
527+// to refactor code.
528+//
529+// A CodeAction must set either `edit` and/or a `command`. If both are supplied, the `edit` is applied first, then the `command` is executed.
530+//
531+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeAction
532+type CodeAction struct {
533+ // A short, human-readable, title for this code action.
534+ Title string `json:"title"`
535+ // The kind of the code action.
536+ //
537+ // Used to filter code actions.
538+ Kind CodeActionKind `json:"kind,omitempty"`
539+ // The diagnostics that this code action resolves.
540+ Diagnostics []Diagnostic `json:"diagnostics,omitempty"`
541+ // Marks this as a preferred action. Preferred actions are used by the `auto fix` command and can be targeted
542+ // by keybindings.
543+ //
544+ // A quick fix should be marked preferred if it properly addresses the underlying error.
545+ // A refactoring should be marked preferred if it is the most reasonable choice of actions to take.
546+ //
547+ // @since 3.15.0
548+ IsPreferred bool `json:"isPreferred,omitempty"`
549+ // Marks that the code action cannot currently be applied.
550+ //
551+ // Clients should follow the following guidelines regarding disabled code actions:
552+ //
553+ // - Disabled code actions are not shown in automatic [lightbulbs](https://code.visualstudio.com/docs/editor/editingevolved#_code-action)
554+ // code action menus.
555+ //
556+ // - Disabled actions are shown as faded out in the code action menu when the user requests a more specific type
557+ // of code action, such as refactorings.
558+ //
559+ // - If the user has a [keybinding](https://code.visualstudio.com/docs/editor/refactoring#_keybindings-for-code-actions)
560+ // that auto applies a code action and only disabled code actions are returned, the client should show the user an
561+ // error message with `reason` in the editor.
562+ //
563+ // @since 3.16.0
564+ Disabled *CodeActionDisabled `json:"disabled,omitempty"`
565+ // The workspace edit this code action performs.
566+ Edit *WorkspaceEdit `json:"edit,omitempty"`
567+ // A command this code action executes. If a code action
568+ // provides an edit and a command, first the edit is
569+ // executed and then the command.
570+ Command *Command `json:"command,omitempty"`
571+ // A data entry field that is preserved on a code action between
572+ // a `textDocument/codeAction` and a `codeAction/resolve` request.
573+ //
574+ // @since 3.16.0
575+ Data *json.RawMessage `json:"data,omitempty"`
576+}
577+
578+// The Client Capabilities of a {@link CodeActionRequest}.
579+//
580+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeActionClientCapabilities
581+type CodeActionClientCapabilities struct {
582+ // Whether code action supports dynamic registration.
583+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
584+ // The client support code action literals of type `CodeAction` as a valid
585+ // response of the `textDocument/codeAction` request. If the property is not
586+ // set the request can only return `Command` literals.
587+ //
588+ // @since 3.8.0
589+ CodeActionLiteralSupport ClientCodeActionLiteralOptions `json:"codeActionLiteralSupport,omitempty"`
590+ // Whether code action supports the `isPreferred` property.
591+ //
592+ // @since 3.15.0
593+ IsPreferredSupport bool `json:"isPreferredSupport,omitempty"`
594+ // Whether code action supports the `disabled` property.
595+ //
596+ // @since 3.16.0
597+ DisabledSupport bool `json:"disabledSupport,omitempty"`
598+ // Whether code action supports the `data` property which is
599+ // preserved between a `textDocument/codeAction` and a
600+ // `codeAction/resolve` request.
601+ //
602+ // @since 3.16.0
603+ DataSupport bool `json:"dataSupport,omitempty"`
604+ // Whether the client supports resolving additional code action
605+ // properties via a separate `codeAction/resolve` request.
606+ //
607+ // @since 3.16.0
608+ ResolveSupport *ClientCodeActionResolveOptions `json:"resolveSupport,omitempty"`
609+ // Whether the client honors the change annotations in
610+ // text edits and resource operations returned via the
611+ // `CodeAction#edit` property by for example presenting
612+ // the workspace edit in the user interface and asking
613+ // for confirmation.
614+ //
615+ // @since 3.16.0
616+ HonorsChangeAnnotations bool `json:"honorsChangeAnnotations,omitempty"`
617+ // Whether the client supports documentation for a class of
618+ // code actions.
619+ //
620+ // @since 3.18.0
621+ // @proposed
622+ DocumentationSupport bool `json:"documentationSupport,omitempty"`
623+}
624+
625+// Contains additional diagnostic information about the context in which
626+// a {@link CodeActionProvider.provideCodeActions code action} is run.
627+//
628+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeActionContext
629+type CodeActionContext struct {
630+ // An array of diagnostics known on the client side overlapping the range provided to the
631+ // `textDocument/codeAction` request. They are provided so that the server knows which
632+ // errors are currently presented to the user for the given range. There is no guarantee
633+ // that these accurately reflect the error state of the resource. The primary parameter
634+ // to compute code actions is the provided range.
635+ Diagnostics []Diagnostic `json:"diagnostics"`
636+ // Requested kind of actions to return.
637+ //
638+ // Actions not of this kind are filtered out by the client before being shown. So servers
639+ // can omit computing them.
640+ Only []CodeActionKind `json:"only,omitempty"`
641+ // The reason why code actions were requested.
642+ //
643+ // @since 3.17.0
644+ TriggerKind *CodeActionTriggerKind `json:"triggerKind,omitempty"`
645+}
646+
647+// Captures why the code action is currently disabled.
648+//
649+// @since 3.18.0
650+//
651+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeActionDisabled
652+type CodeActionDisabled struct {
653+ // Human readable description of why the code action is currently disabled.
654+ //
655+ // This is displayed in the code actions UI.
656+ Reason string `json:"reason"`
657+}
658+
659+// A set of predefined code action kinds
660+type CodeActionKind string
661+
662+// Documentation for a class of code actions.
663+//
664+// @since 3.18.0
665+// @proposed
666+//
667+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeActionKindDocumentation
668+type CodeActionKindDocumentation struct {
669+ // The kind of the code action being documented.
670+ //
671+ // If the kind is generic, such as `CodeActionKind.Refactor`, the documentation will be shown whenever any
672+ // refactorings are returned. If the kind if more specific, such as `CodeActionKind.RefactorExtract`, the
673+ // documentation will only be shown when extract refactoring code actions are returned.
674+ Kind CodeActionKind `json:"kind"`
675+ // Command that is ued to display the documentation to the user.
676+ //
677+ // The title of this documentation code action is taken from {@linkcode Command.title}
678+ Command Command `json:"command"`
679+}
680+
681+// Provider options for a {@link CodeActionRequest}.
682+//
683+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeActionOptions
684+type CodeActionOptions struct {
685+ // CodeActionKinds that this server may return.
686+ //
687+ // The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server
688+ // may list out every specific kind they provide.
689+ CodeActionKinds []CodeActionKind `json:"codeActionKinds,omitempty"`
690+ // Static documentation for a class of code actions.
691+ //
692+ // Documentation from the provider should be shown in the code actions menu if either:
693+ //
694+ //
695+ // - Code actions of `kind` are requested by the editor. In this case, the editor will show the documentation that
696+ // most closely matches the requested code action kind. For example, if a provider has documentation for
697+ // both `Refactor` and `RefactorExtract`, when the user requests code actions for `RefactorExtract`,
698+ // the editor will use the documentation for `RefactorExtract` instead of the documentation for `Refactor`.
699+ //
700+ //
701+ // - Any code actions of `kind` are returned by the provider.
702+ //
703+ // At most one documentation entry should be shown per provider.
704+ //
705+ // @since 3.18.0
706+ // @proposed
707+ Documentation []CodeActionKindDocumentation `json:"documentation,omitempty"`
708+ // The server provides support to resolve additional
709+ // information for a code action.
710+ //
711+ // @since 3.16.0
712+ ResolveProvider bool `json:"resolveProvider,omitempty"`
713+ WorkDoneProgressOptions
714+}
715+
716+// The parameters of a {@link CodeActionRequest}.
717+//
718+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeActionParams
719+type CodeActionParams struct {
720+ // The document in which the command was invoked.
721+ TextDocument TextDocumentIdentifier `json:"textDocument"`
722+ // The range for which the command was invoked.
723+ Range Range `json:"range"`
724+ // Context carrying additional information.
725+ Context CodeActionContext `json:"context"`
726+ WorkDoneProgressParams
727+ PartialResultParams
728+}
729+
730+// Registration options for a {@link CodeActionRequest}.
731+//
732+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeActionRegistrationOptions
733+type CodeActionRegistrationOptions struct {
734+ TextDocumentRegistrationOptions
735+ CodeActionOptions
736+}
737+
738+// The reason why code actions were requested.
739+//
740+// @since 3.17.0
741+type CodeActionTriggerKind uint32
742+
743+// Structure to capture a description for an error code.
744+//
745+// @since 3.16.0
746+//
747+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeDescription
748+type CodeDescription struct {
749+ // An URI to open with more information about the diagnostic error.
750+ Href URI `json:"href"`
751+}
752+
753+// A code lens represents a {@link Command command} that should be shown along with
754+// source text, like the number of references, a way to run tests, etc.
755+//
756+// A code lens is _unresolved_ when no command is associated to it. For performance
757+// reasons the creation of a code lens and resolving should be done in two stages.
758+//
759+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeLens
760+type CodeLens struct {
761+ // The range in which this code lens is valid. Should only span a single line.
762+ Range Range `json:"range"`
763+ // The command this code lens represents.
764+ Command *Command `json:"command,omitempty"`
765+ // A data entry field that is preserved on a code lens item between
766+ // a {@link CodeLensRequest} and a {@link CodeLensResolveRequest}
767+ Data interface{} `json:"data,omitempty"`
768+}
769+
770+// The client capabilities of a {@link CodeLensRequest}.
771+//
772+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeLensClientCapabilities
773+type CodeLensClientCapabilities struct {
774+ // Whether code lens supports dynamic registration.
775+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
776+ // Whether the client supports resolving additional code lens
777+ // properties via a separate `codeLens/resolve` request.
778+ //
779+ // @since 3.18.0
780+ ResolveSupport *ClientCodeLensResolveOptions `json:"resolveSupport,omitempty"`
781+}
782+
783+// Code Lens provider options of a {@link CodeLensRequest}.
784+//
785+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeLensOptions
786+type CodeLensOptions struct {
787+ // Code lens has a resolve provider as well.
788+ ResolveProvider bool `json:"resolveProvider,omitempty"`
789+ WorkDoneProgressOptions
790+}
791+
792+// The parameters of a {@link CodeLensRequest}.
793+//
794+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeLensParams
795+type CodeLensParams struct {
796+ // The document to request code lens for.
797+ TextDocument TextDocumentIdentifier `json:"textDocument"`
798+ WorkDoneProgressParams
799+ PartialResultParams
800+}
801+
802+// Registration options for a {@link CodeLensRequest}.
803+//
804+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeLensRegistrationOptions
805+type CodeLensRegistrationOptions struct {
806+ TextDocumentRegistrationOptions
807+ CodeLensOptions
808+}
809+
810+// @since 3.16.0
811+//
812+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeLensWorkspaceClientCapabilities
813+type CodeLensWorkspaceClientCapabilities struct {
814+ // Whether the client implementation supports a refresh request sent from the
815+ // server to the client.
816+ //
817+ // Note that this event is global and will force the client to refresh all
818+ // code lenses currently shown. It should be used with absolute care and is
819+ // useful for situation where a server for example detect a project wide
820+ // change that requires such a calculation.
821+ RefreshSupport bool `json:"refreshSupport,omitempty"`
822+}
823+
824+// Represents a color in RGBA space.
825+//
826+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#color
827+type Color struct {
828+ // The red component of this color in the range [0-1].
829+ Red float64 `json:"red"`
830+ // The green component of this color in the range [0-1].
831+ Green float64 `json:"green"`
832+ // The blue component of this color in the range [0-1].
833+ Blue float64 `json:"blue"`
834+ // The alpha component of this color in the range [0-1].
835+ Alpha float64 `json:"alpha"`
836+}
837+
838+// Represents a color range from a document.
839+//
840+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#colorInformation
841+type ColorInformation struct {
842+ // The range in the document where this color appears.
843+ Range Range `json:"range"`
844+ // The actual color value for this color range.
845+ Color Color `json:"color"`
846+}
847+
848+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#colorPresentation
849+type ColorPresentation struct {
850+ // The label of this color presentation. It will be shown on the color
851+ // picker header. By default this is also the text that is inserted when selecting
852+ // this color presentation.
853+ Label string `json:"label"`
854+ // An {@link TextEdit edit} which is applied to a document when selecting
855+ // this presentation for the color. When `falsy` the {@link ColorPresentation.label label}
856+ // is used.
857+ TextEdit *TextEdit `json:"textEdit,omitempty"`
858+ // An optional array of additional {@link TextEdit text edits} that are applied when
859+ // selecting this color presentation. Edits must not overlap with the main {@link ColorPresentation.textEdit edit} nor with themselves.
860+ AdditionalTextEdits []TextEdit `json:"additionalTextEdits,omitempty"`
861+}
862+
863+// Parameters for a {@link ColorPresentationRequest}.
864+//
865+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#colorPresentationParams
866+type ColorPresentationParams struct {
867+ // The text document.
868+ TextDocument TextDocumentIdentifier `json:"textDocument"`
869+ // The color to request presentations for.
870+ Color Color `json:"color"`
871+ // The range where the color would be inserted. Serves as a context.
872+ Range Range `json:"range"`
873+ WorkDoneProgressParams
874+ PartialResultParams
875+}
876+
877+// Represents a reference to a command. Provides a title which
878+// will be used to represent a command in the UI and, optionally,
879+// an array of arguments which will be passed to the command handler
880+// function when invoked.
881+//
882+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#command
883+type Command struct {
884+ // Title of the command, like `save`.
885+ Title string `json:"title"`
886+ // An optional tooltip.
887+ //
888+ // @since 3.18.0
889+ // @proposed
890+ Tooltip string `json:"tooltip,omitempty"`
891+ // The identifier of the actual command handler.
892+ Command string `json:"command"`
893+ // Arguments that the command handler should be
894+ // invoked with.
895+ Arguments []json.RawMessage `json:"arguments,omitempty"`
896+}
897+
898+// Completion client capabilities
899+//
900+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionClientCapabilities
901+type CompletionClientCapabilities struct {
902+ // Whether completion supports dynamic registration.
903+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
904+ // The client supports the following `CompletionItem` specific
905+ // capabilities.
906+ CompletionItem ClientCompletionItemOptions `json:"completionItem,omitempty"`
907+ CompletionItemKind *ClientCompletionItemOptionsKind `json:"completionItemKind,omitempty"`
908+ // Defines how the client handles whitespace and indentation
909+ // when accepting a completion item that uses multi line
910+ // text in either `insertText` or `textEdit`.
911+ //
912+ // @since 3.17.0
913+ InsertTextMode InsertTextMode `json:"insertTextMode,omitempty"`
914+ // The client supports to send additional context information for a
915+ // `textDocument/completion` request.
916+ ContextSupport bool `json:"contextSupport,omitempty"`
917+ // The client supports the following `CompletionList` specific
918+ // capabilities.
919+ //
920+ // @since 3.17.0
921+ CompletionList *CompletionListCapabilities `json:"completionList,omitempty"`
922+}
923+
924+// Contains additional information about the context in which a completion request is triggered.
925+//
926+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionContext
927+type CompletionContext struct {
928+ // How the completion was triggered.
929+ TriggerKind CompletionTriggerKind `json:"triggerKind"`
930+ // The trigger character (a single character) that has trigger code complete.
931+ // Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter`
932+ TriggerCharacter string `json:"triggerCharacter,omitempty"`
933+}
934+
935+// A completion item represents a text snippet that is
936+// proposed to complete text that is being typed.
937+//
938+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionItem
939+type CompletionItem struct {
940+ // The label of this completion item.
941+ //
942+ // The label property is also by default the text that
943+ // is inserted when selecting this completion.
944+ //
945+ // If label details are provided the label itself should
946+ // be an unqualified name of the completion item.
947+ Label string `json:"label"`
948+ // Additional details for the label
949+ //
950+ // @since 3.17.0
951+ LabelDetails *CompletionItemLabelDetails `json:"labelDetails,omitempty"`
952+ // The kind of this completion item. Based of the kind
953+ // an icon is chosen by the editor.
954+ Kind CompletionItemKind `json:"kind,omitempty"`
955+ // Tags for this completion item.
956+ //
957+ // @since 3.15.0
958+ Tags []CompletionItemTag `json:"tags,omitempty"`
959+ // A human-readable string with additional information
960+ // about this item, like type or symbol information.
961+ Detail string `json:"detail,omitempty"`
962+ // A human-readable string that represents a doc-comment.
963+ Documentation *Or_CompletionItem_documentation `json:"documentation,omitempty"`
964+ // Indicates if this item is deprecated.
965+ // @deprecated Use `tags` instead.
966+ Deprecated bool `json:"deprecated,omitempty"`
967+ // Select this item when showing.
968+ //
969+ // *Note* that only one completion item can be selected and that the
970+ // tool / client decides which item that is. The rule is that the *first*
971+ // item of those that match best is selected.
972+ Preselect bool `json:"preselect,omitempty"`
973+ // A string that should be used when comparing this item
974+ // with other items. When `falsy` the {@link CompletionItem.label label}
975+ // is used.
976+ SortText string `json:"sortText,omitempty"`
977+ // A string that should be used when filtering a set of
978+ // completion items. When `falsy` the {@link CompletionItem.label label}
979+ // is used.
980+ FilterText string `json:"filterText,omitempty"`
981+ // A string that should be inserted into a document when selecting
982+ // this completion. When `falsy` the {@link CompletionItem.label label}
983+ // is used.
984+ //
985+ // The `insertText` is subject to interpretation by the client side.
986+ // Some tools might not take the string literally. For example
987+ // VS Code when code complete is requested in this example
988+ // `con<cursor position>` and a completion item with an `insertText` of
989+ // `console` is provided it will only insert `sole`. Therefore it is
990+ // recommended to use `textEdit` instead since it avoids additional client
991+ // side interpretation.
992+ InsertText string `json:"insertText,omitempty"`
993+ // The format of the insert text. The format applies to both the
994+ // `insertText` property and the `newText` property of a provided
995+ // `textEdit`. If omitted defaults to `InsertTextFormat.PlainText`.
996+ //
997+ // Please note that the insertTextFormat doesn't apply to
998+ // `additionalTextEdits`.
999+ InsertTextFormat *InsertTextFormat `json:"insertTextFormat,omitempty"`
1000+ // How whitespace and indentation is handled during completion
1001+ // item insertion. If not provided the clients default value depends on
1002+ // the `textDocument.completion.insertTextMode` client capability.
1003+ //
1004+ // @since 3.16.0
1005+ InsertTextMode *InsertTextMode `json:"insertTextMode,omitempty"`
1006+ // An {@link TextEdit edit} which is applied to a document when selecting
1007+ // this completion. When an edit is provided the value of
1008+ // {@link CompletionItem.insertText insertText} is ignored.
1009+ //
1010+ // Most editors support two different operations when accepting a completion
1011+ // item. One is to insert a completion text and the other is to replace an
1012+ // existing text with a completion text. Since this can usually not be
1013+ // predetermined by a server it can report both ranges. Clients need to
1014+ // signal support for `InsertReplaceEdits` via the
1015+ // `textDocument.completion.insertReplaceSupport` client capability
1016+ // property.
1017+ //
1018+ // *Note 1:* The text edit's range as well as both ranges from an insert
1019+ // replace edit must be a [single line] and they must contain the position
1020+ // at which completion has been requested.
1021+ // *Note 2:* If an `InsertReplaceEdit` is returned the edit's insert range
1022+ // must be a prefix of the edit's replace range, that means it must be
1023+ // contained and starting at the same position.
1024+ //
1025+ // @since 3.16.0 additional type `InsertReplaceEdit`
1026+ TextEdit *Or_CompletionItem_textEdit `json:"textEdit,omitempty"`
1027+ // The edit text used if the completion item is part of a CompletionList and
1028+ // CompletionList defines an item default for the text edit range.
1029+ //
1030+ // Clients will only honor this property if they opt into completion list
1031+ // item defaults using the capability `completionList.itemDefaults`.
1032+ //
1033+ // If not provided and a list's default range is provided the label
1034+ // property is used as a text.
1035+ //
1036+ // @since 3.17.0
1037+ TextEditText string `json:"textEditText,omitempty"`
1038+ // An optional array of additional {@link TextEdit text edits} that are applied when
1039+ // selecting this completion. Edits must not overlap (including the same insert position)
1040+ // with the main {@link CompletionItem.textEdit edit} nor with themselves.
1041+ //
1042+ // Additional text edits should be used to change text unrelated to the current cursor position
1043+ // (for example adding an import statement at the top of the file if the completion item will
1044+ // insert an unqualified type).
1045+ AdditionalTextEdits []TextEdit `json:"additionalTextEdits,omitempty"`
1046+ // An optional set of characters that when pressed while this completion is active will accept it first and
1047+ // then type that character. *Note* that all commit characters should have `length=1` and that superfluous
1048+ // characters will be ignored.
1049+ CommitCharacters []string `json:"commitCharacters,omitempty"`
1050+ // An optional {@link Command command} that is executed *after* inserting this completion. *Note* that
1051+ // additional modifications to the current document should be described with the
1052+ // {@link CompletionItem.additionalTextEdits additionalTextEdits}-property.
1053+ Command *Command `json:"command,omitempty"`
1054+ // A data entry field that is preserved on a completion item between a
1055+ // {@link CompletionRequest} and a {@link CompletionResolveRequest}.
1056+ Data interface{} `json:"data,omitempty"`
1057+}
1058+
1059+// In many cases the items of an actual completion result share the same
1060+// value for properties like `commitCharacters` or the range of a text
1061+// edit. A completion list can therefore define item defaults which will
1062+// be used if a completion item itself doesn't specify the value.
1063+//
1064+// If a completion list specifies a default value and a completion item
1065+// also specifies a corresponding value the one from the item is used.
1066+//
1067+// Servers are only allowed to return default values if the client
1068+// signals support for this via the `completionList.itemDefaults`
1069+// capability.
1070+//
1071+// @since 3.17.0
1072+//
1073+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionItemDefaults
1074+type CompletionItemDefaults struct {
1075+ // A default commit character set.
1076+ //
1077+ // @since 3.17.0
1078+ CommitCharacters []string `json:"commitCharacters,omitempty"`
1079+ // A default edit range.
1080+ //
1081+ // @since 3.17.0
1082+ EditRange *Or_CompletionItemDefaults_editRange `json:"editRange,omitempty"`
1083+ // A default insert text format.
1084+ //
1085+ // @since 3.17.0
1086+ InsertTextFormat *InsertTextFormat `json:"insertTextFormat,omitempty"`
1087+ // A default insert text mode.
1088+ //
1089+ // @since 3.17.0
1090+ InsertTextMode *InsertTextMode `json:"insertTextMode,omitempty"`
1091+ // A default data value.
1092+ //
1093+ // @since 3.17.0
1094+ Data interface{} `json:"data,omitempty"`
1095+}
1096+
1097+// The kind of a completion entry.
1098+type CompletionItemKind uint32
1099+
1100+// Additional details for a completion item label.
1101+//
1102+// @since 3.17.0
1103+//
1104+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionItemLabelDetails
1105+type CompletionItemLabelDetails struct {
1106+ // An optional string which is rendered less prominently directly after {@link CompletionItem.label label},
1107+ // without any spacing. Should be used for function signatures and type annotations.
1108+ Detail string `json:"detail,omitempty"`
1109+ // An optional string which is rendered less prominently after {@link CompletionItem.detail}. Should be used
1110+ // for fully qualified names and file paths.
1111+ Description string `json:"description,omitempty"`
1112+}
1113+
1114+// Completion item tags are extra annotations that tweak the rendering of a completion
1115+// item.
1116+//
1117+// @since 3.15.0
1118+type CompletionItemTag uint32
1119+
1120+// @since 3.18.0
1121+//
1122+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionItemTagOptions
1123+type CompletionItemTagOptions struct {
1124+ // The tags supported by the client.
1125+ ValueSet []CompletionItemTag `json:"valueSet"`
1126+}
1127+
1128+// Represents a collection of {@link CompletionItem completion items} to be presented
1129+// in the editor.
1130+//
1131+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionList
1132+type CompletionList struct {
1133+ // This list it not complete. Further typing results in recomputing this list.
1134+ //
1135+ // Recomputed lists have all their items replaced (not appended) in the
1136+ // incomplete completion sessions.
1137+ IsIncomplete bool `json:"isIncomplete"`
1138+ // In many cases the items of an actual completion result share the same
1139+ // value for properties like `commitCharacters` or the range of a text
1140+ // edit. A completion list can therefore define item defaults which will
1141+ // be used if a completion item itself doesn't specify the value.
1142+ //
1143+ // If a completion list specifies a default value and a completion item
1144+ // also specifies a corresponding value the one from the item is used.
1145+ //
1146+ // Servers are only allowed to return default values if the client
1147+ // signals support for this via the `completionList.itemDefaults`
1148+ // capability.
1149+ //
1150+ // @since 3.17.0
1151+ ItemDefaults *CompletionItemDefaults `json:"itemDefaults,omitempty"`
1152+ // The completion items.
1153+ Items []CompletionItem `json:"items"`
1154+}
1155+
1156+// The client supports the following `CompletionList` specific
1157+// capabilities.
1158+//
1159+// @since 3.17.0
1160+//
1161+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionListCapabilities
1162+type CompletionListCapabilities struct {
1163+ // The client supports the following itemDefaults on
1164+ // a completion list.
1165+ //
1166+ // The value lists the supported property names of the
1167+ // `CompletionList.itemDefaults` object. If omitted
1168+ // no properties are supported.
1169+ //
1170+ // @since 3.17.0
1171+ ItemDefaults []string `json:"itemDefaults,omitempty"`
1172+}
1173+
1174+// Completion options.
1175+//
1176+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionOptions
1177+type CompletionOptions struct {
1178+ // Most tools trigger completion request automatically without explicitly requesting
1179+ // it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user
1180+ // starts to type an identifier. For example if the user types `c` in a JavaScript file
1181+ // code complete will automatically pop up present `console` besides others as a
1182+ // completion item. Characters that make up identifiers don't need to be listed here.
1183+ //
1184+ // If code complete should automatically be trigger on characters not being valid inside
1185+ // an identifier (for example `.` in JavaScript) list them in `triggerCharacters`.
1186+ TriggerCharacters []string `json:"triggerCharacters,omitempty"`
1187+ // The list of all possible characters that commit a completion. This field can be used
1188+ // if clients don't support individual commit characters per completion item. See
1189+ // `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport`
1190+ //
1191+ // If a server provides both `allCommitCharacters` and commit characters on an individual
1192+ // completion item the ones on the completion item win.
1193+ //
1194+ // @since 3.2.0
1195+ AllCommitCharacters []string `json:"allCommitCharacters,omitempty"`
1196+ // The server provides support to resolve additional
1197+ // information for a completion item.
1198+ ResolveProvider bool `json:"resolveProvider,omitempty"`
1199+ // The server supports the following `CompletionItem` specific
1200+ // capabilities.
1201+ //
1202+ // @since 3.17.0
1203+ CompletionItem *ServerCompletionItemOptions `json:"completionItem,omitempty"`
1204+ WorkDoneProgressOptions
1205+}
1206+
1207+// Completion parameters
1208+//
1209+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionParams
1210+type CompletionParams struct {
1211+ // The completion context. This is only available it the client specifies
1212+ // to send this using the client capability `textDocument.completion.contextSupport === true`
1213+ Context CompletionContext `json:"context,omitempty"`
1214+ TextDocumentPositionParams
1215+ WorkDoneProgressParams
1216+ PartialResultParams
1217+}
1218+
1219+// Registration options for a {@link CompletionRequest}.
1220+//
1221+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionRegistrationOptions
1222+type CompletionRegistrationOptions struct {
1223+ TextDocumentRegistrationOptions
1224+ CompletionOptions
1225+}
1226+
1227+// How a completion was triggered
1228+type CompletionTriggerKind uint32
1229+
1230+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#configurationItem
1231+type ConfigurationItem struct {
1232+ // The scope to get the configuration section for.
1233+ ScopeURI *URI `json:"scopeUri,omitempty"`
1234+ // The configuration section asked for.
1235+ Section string `json:"section,omitempty"`
1236+}
1237+
1238+// The parameters of a configuration request.
1239+//
1240+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#configurationParams
1241+type ConfigurationParams struct {
1242+ Items []ConfigurationItem `json:"items"`
1243+}
1244+
1245+// Create file operation.
1246+//
1247+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#createFile
1248+type CreateFile struct {
1249+ // A create
1250+ Kind string `json:"kind"`
1251+ // The resource to create.
1252+ URI DocumentUri `json:"uri"`
1253+ // Additional options
1254+ Options *CreateFileOptions `json:"options,omitempty"`
1255+ ResourceOperation
1256+}
1257+
1258+// Options to create a file.
1259+//
1260+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#createFileOptions
1261+type CreateFileOptions struct {
1262+ // Overwrite existing file. Overwrite wins over `ignoreIfExists`
1263+ Overwrite bool `json:"overwrite,omitempty"`
1264+ // Ignore if exists.
1265+ IgnoreIfExists bool `json:"ignoreIfExists,omitempty"`
1266+}
1267+
1268+// The parameters sent in notifications/requests for user-initiated creation of
1269+// files.
1270+//
1271+// @since 3.16.0
1272+//
1273+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#createFilesParams
1274+type CreateFilesParams struct {
1275+ // An array of all files/folders created in this operation.
1276+ Files []FileCreate `json:"files"`
1277+}
1278+
1279+// The declaration of a symbol representation as one or many {@link Location locations}.
1280+//
1281+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#declaration
1282+type Declaration = Or_Declaration // (alias)
1283+// @since 3.14.0
1284+//
1285+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#declarationClientCapabilities
1286+type DeclarationClientCapabilities struct {
1287+ // Whether declaration supports dynamic registration. If this is set to `true`
1288+ // the client supports the new `DeclarationRegistrationOptions` return value
1289+ // for the corresponding server capability as well.
1290+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
1291+ // The client supports additional metadata in the form of declaration links.
1292+ LinkSupport bool `json:"linkSupport,omitempty"`
1293+}
1294+
1295+// Information about where a symbol is declared.
1296+//
1297+// Provides additional metadata over normal {@link Location location} declarations, including the range of
1298+// the declaring symbol.
1299+//
1300+// Servers should prefer returning `DeclarationLink` over `Declaration` if supported
1301+// by the client.
1302+//
1303+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#declarationLink
1304+type DeclarationLink = LocationLink // (alias)
1305+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#declarationOptions
1306+type DeclarationOptions struct {
1307+ WorkDoneProgressOptions
1308+}
1309+
1310+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#declarationParams
1311+type DeclarationParams struct {
1312+ TextDocumentPositionParams
1313+ WorkDoneProgressParams
1314+ PartialResultParams
1315+}
1316+
1317+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#declarationRegistrationOptions
1318+type DeclarationRegistrationOptions struct {
1319+ DeclarationOptions
1320+ TextDocumentRegistrationOptions
1321+ StaticRegistrationOptions
1322+}
1323+
1324+// The definition of a symbol represented as one or many {@link Location locations}.
1325+// For most programming languages there is only one location at which a symbol is
1326+// defined.
1327+//
1328+// Servers should prefer returning `DefinitionLink` over `Definition` if supported
1329+// by the client.
1330+//
1331+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#definition
1332+type Definition = Or_Definition // (alias)
1333+// Client Capabilities for a {@link DefinitionRequest}.
1334+//
1335+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#definitionClientCapabilities
1336+type DefinitionClientCapabilities struct {
1337+ // Whether definition supports dynamic registration.
1338+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
1339+ // The client supports additional metadata in the form of definition links.
1340+ //
1341+ // @since 3.14.0
1342+ LinkSupport bool `json:"linkSupport,omitempty"`
1343+}
1344+
1345+// Information about where a symbol is defined.
1346+//
1347+// Provides additional metadata over normal {@link Location location} definitions, including the range of
1348+// the defining symbol
1349+//
1350+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#definitionLink
1351+type DefinitionLink = LocationLink // (alias)
1352+// Server Capabilities for a {@link DefinitionRequest}.
1353+//
1354+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#definitionOptions
1355+type DefinitionOptions struct {
1356+ WorkDoneProgressOptions
1357+}
1358+
1359+// Parameters for a {@link DefinitionRequest}.
1360+//
1361+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#definitionParams
1362+type DefinitionParams struct {
1363+ TextDocumentPositionParams
1364+ WorkDoneProgressParams
1365+ PartialResultParams
1366+}
1367+
1368+// Registration options for a {@link DefinitionRequest}.
1369+//
1370+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#definitionRegistrationOptions
1371+type DefinitionRegistrationOptions struct {
1372+ TextDocumentRegistrationOptions
1373+ DefinitionOptions
1374+}
1375+
1376+// Delete file operation
1377+//
1378+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#deleteFile
1379+type DeleteFile struct {
1380+ // A delete
1381+ Kind string `json:"kind"`
1382+ // The file to delete.
1383+ URI DocumentUri `json:"uri"`
1384+ // Delete options.
1385+ Options *DeleteFileOptions `json:"options,omitempty"`
1386+ ResourceOperation
1387+}
1388+
1389+// Delete file options
1390+//
1391+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#deleteFileOptions
1392+type DeleteFileOptions struct {
1393+ // Delete the content recursively if a folder is denoted.
1394+ Recursive bool `json:"recursive,omitempty"`
1395+ // Ignore the operation if the file doesn't exist.
1396+ IgnoreIfNotExists bool `json:"ignoreIfNotExists,omitempty"`
1397+}
1398+
1399+// The parameters sent in notifications/requests for user-initiated deletes of
1400+// files.
1401+//
1402+// @since 3.16.0
1403+//
1404+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#deleteFilesParams
1405+type DeleteFilesParams struct {
1406+ // An array of all files/folders deleted in this operation.
1407+ Files []FileDelete `json:"files"`
1408+}
1409+
1410+// Represents a diagnostic, such as a compiler error or warning. Diagnostic objects
1411+// are only valid in the scope of a resource.
1412+//
1413+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#diagnostic
1414+type Diagnostic struct {
1415+ // The range at which the message applies
1416+ Range Range `json:"range"`
1417+ // The diagnostic's severity. To avoid interpretation mismatches when a
1418+ // server is used with different clients it is highly recommended that servers
1419+ // always provide a severity value.
1420+ Severity DiagnosticSeverity `json:"severity,omitempty"`
1421+ // The diagnostic's code, which usually appear in the user interface.
1422+ Code interface{} `json:"code,omitempty"`
1423+ // An optional property to describe the error code.
1424+ // Requires the code field (above) to be present/not null.
1425+ //
1426+ // @since 3.16.0
1427+ CodeDescription *CodeDescription `json:"codeDescription,omitempty"`
1428+ // A human-readable string describing the source of this
1429+ // diagnostic, e.g. 'typescript' or 'super lint'. It usually
1430+ // appears in the user interface.
1431+ Source string `json:"source,omitempty"`
1432+ // The diagnostic's message. It usually appears in the user interface
1433+ Message string `json:"message"`
1434+ // Additional metadata about the diagnostic.
1435+ //
1436+ // @since 3.15.0
1437+ Tags []DiagnosticTag `json:"tags,omitempty"`
1438+ // An array of related diagnostic information, e.g. when symbol-names within
1439+ // a scope collide all definitions can be marked via this property.
1440+ RelatedInformation []DiagnosticRelatedInformation `json:"relatedInformation,omitempty"`
1441+ // A data entry field that is preserved between a `textDocument/publishDiagnostics`
1442+ // notification and `textDocument/codeAction` request.
1443+ //
1444+ // @since 3.16.0
1445+ Data *json.RawMessage `json:"data,omitempty"`
1446+}
1447+
1448+// Client capabilities specific to diagnostic pull requests.
1449+//
1450+// @since 3.17.0
1451+//
1452+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#diagnosticClientCapabilities
1453+type DiagnosticClientCapabilities struct {
1454+ // Whether implementation supports dynamic registration. If this is set to `true`
1455+ // the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
1456+ // return value for the corresponding server capability as well.
1457+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
1458+ // Whether the clients supports related documents for document diagnostic pulls.
1459+ RelatedDocumentSupport bool `json:"relatedDocumentSupport,omitempty"`
1460+ DiagnosticsCapabilities
1461+}
1462+
1463+// Diagnostic options.
1464+//
1465+// @since 3.17.0
1466+//
1467+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#diagnosticOptions
1468+type DiagnosticOptions struct {
1469+ // An optional identifier under which the diagnostics are
1470+ // managed by the client.
1471+ Identifier string `json:"identifier,omitempty"`
1472+ // Whether the language has inter file dependencies meaning that
1473+ // editing code in one file can result in a different diagnostic
1474+ // set in another file. Inter file dependencies are common for
1475+ // most programming languages and typically uncommon for linters.
1476+ InterFileDependencies bool `json:"interFileDependencies"`
1477+ // The server provides support for workspace diagnostics as well.
1478+ WorkspaceDiagnostics bool `json:"workspaceDiagnostics"`
1479+ WorkDoneProgressOptions
1480+}
1481+
1482+// Diagnostic registration options.
1483+//
1484+// @since 3.17.0
1485+//
1486+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#diagnosticRegistrationOptions
1487+type DiagnosticRegistrationOptions struct {
1488+ TextDocumentRegistrationOptions
1489+ DiagnosticOptions
1490+ StaticRegistrationOptions
1491+}
1492+
1493+// Represents a related message and source code location for a diagnostic. This should be
1494+// used to point to code locations that cause or related to a diagnostics, e.g when duplicating
1495+// a symbol in a scope.
1496+//
1497+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#diagnosticRelatedInformation
1498+type DiagnosticRelatedInformation struct {
1499+ // The location of this related diagnostic information.
1500+ Location Location `json:"location"`
1501+ // The message of this related diagnostic information.
1502+ Message string `json:"message"`
1503+}
1504+
1505+// Cancellation data returned from a diagnostic request.
1506+//
1507+// @since 3.17.0
1508+//
1509+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#diagnosticServerCancellationData
1510+type DiagnosticServerCancellationData struct {
1511+ RetriggerRequest bool `json:"retriggerRequest"`
1512+}
1513+
1514+// The diagnostic's severity.
1515+type DiagnosticSeverity uint32
1516+
1517+// The diagnostic tags.
1518+//
1519+// @since 3.15.0
1520+type DiagnosticTag uint32
1521+
1522+// Workspace client capabilities specific to diagnostic pull requests.
1523+//
1524+// @since 3.17.0
1525+//
1526+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#diagnosticWorkspaceClientCapabilities
1527+type DiagnosticWorkspaceClientCapabilities struct {
1528+ // Whether the client implementation supports a refresh request sent from
1529+ // the server to the client.
1530+ //
1531+ // Note that this event is global and will force the client to refresh all
1532+ // pulled diagnostics currently shown. It should be used with absolute care and
1533+ // is useful for situation where a server for example detects a project wide
1534+ // change that requires such a calculation.
1535+ RefreshSupport bool `json:"refreshSupport,omitempty"`
1536+}
1537+
1538+// General diagnostics capabilities for pull and push model.
1539+//
1540+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#diagnosticsCapabilities
1541+type DiagnosticsCapabilities struct {
1542+ // Whether the clients accepts diagnostics with related information.
1543+ RelatedInformation bool `json:"relatedInformation,omitempty"`
1544+ // Client supports the tag property to provide meta data about a diagnostic.
1545+ // Clients supporting tags have to handle unknown tags gracefully.
1546+ //
1547+ // @since 3.15.0
1548+ TagSupport *ClientDiagnosticsTagOptions `json:"tagSupport,omitempty"`
1549+ // Client supports a codeDescription property
1550+ //
1551+ // @since 3.16.0
1552+ CodeDescriptionSupport bool `json:"codeDescriptionSupport,omitempty"`
1553+ // Whether code action supports the `data` property which is
1554+ // preserved between a `textDocument/publishDiagnostics` and
1555+ // `textDocument/codeAction` request.
1556+ //
1557+ // @since 3.16.0
1558+ DataSupport bool `json:"dataSupport,omitempty"`
1559+}
1560+
1561+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didChangeConfigurationClientCapabilities
1562+type DidChangeConfigurationClientCapabilities struct {
1563+ // Did change configuration notification supports dynamic registration.
1564+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
1565+}
1566+
1567+// The parameters of a change configuration notification.
1568+//
1569+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didChangeConfigurationParams
1570+type DidChangeConfigurationParams struct {
1571+ // The actual changed settings
1572+ Settings interface{} `json:"settings"`
1573+}
1574+
1575+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didChangeConfigurationRegistrationOptions
1576+type DidChangeConfigurationRegistrationOptions struct {
1577+ Section *Or_DidChangeConfigurationRegistrationOptions_section `json:"section,omitempty"`
1578+}
1579+
1580+// The params sent in a change notebook document notification.
1581+//
1582+// @since 3.17.0
1583+//
1584+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didChangeNotebookDocumentParams
1585+type DidChangeNotebookDocumentParams struct {
1586+ // The notebook document that did change. The version number points
1587+ // to the version after all provided changes have been applied. If
1588+ // only the text document content of a cell changes the notebook version
1589+ // doesn't necessarily have to change.
1590+ NotebookDocument VersionedNotebookDocumentIdentifier `json:"notebookDocument"`
1591+ // The actual changes to the notebook document.
1592+ //
1593+ // The changes describe single state changes to the notebook document.
1594+ // So if there are two changes c1 (at array index 0) and c2 (at array
1595+ // index 1) for a notebook in state S then c1 moves the notebook from
1596+ // S to S' and c2 from S' to S''. So c1 is computed on the state S and
1597+ // c2 is computed on the state S'.
1598+ //
1599+ // To mirror the content of a notebook using change events use the following approach:
1600+ //
1601+ // - start with the same initial content
1602+ // - apply the 'notebookDocument/didChange' notifications in the order you receive them.
1603+ // - apply the `NotebookChangeEvent`s in a single notification in the order
1604+ // you receive them.
1605+ Change NotebookDocumentChangeEvent `json:"change"`
1606+}
1607+
1608+// The change text document notification's parameters.
1609+//
1610+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didChangeTextDocumentParams
1611+type DidChangeTextDocumentParams struct {
1612+ // The document that did change. The version number points
1613+ // to the version after all provided content changes have
1614+ // been applied.
1615+ TextDocument VersionedTextDocumentIdentifier `json:"textDocument"`
1616+ // The actual content changes. The content changes describe single state changes
1617+ // to the document. So if there are two content changes c1 (at array index 0) and
1618+ // c2 (at array index 1) for a document in state S then c1 moves the document from
1619+ // S to S' and c2 from S' to S''. So c1 is computed on the state S and c2 is computed
1620+ // on the state S'.
1621+ //
1622+ // To mirror the content of a document using change events use the following approach:
1623+ //
1624+ // - start with the same initial content
1625+ // - apply the 'textDocument/didChange' notifications in the order you receive them.
1626+ // - apply the `TextDocumentContentChangeEvent`s in a single notification in the order
1627+ // you receive them.
1628+ ContentChanges []TextDocumentContentChangeEvent `json:"contentChanges"`
1629+}
1630+
1631+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didChangeWatchedFilesClientCapabilities
1632+type DidChangeWatchedFilesClientCapabilities struct {
1633+ // Did change watched files notification supports dynamic registration. Please note
1634+ // that the current protocol doesn't support static configuration for file changes
1635+ // from the server side.
1636+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
1637+ // Whether the client has support for {@link RelativePattern relative pattern}
1638+ // or not.
1639+ //
1640+ // @since 3.17.0
1641+ RelativePatternSupport bool `json:"relativePatternSupport,omitempty"`
1642+}
1643+
1644+// The watched files change notification's parameters.
1645+//
1646+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didChangeWatchedFilesParams
1647+type DidChangeWatchedFilesParams struct {
1648+ // The actual file events.
1649+ Changes []FileEvent `json:"changes"`
1650+}
1651+
1652+// Describe options to be used when registered for text document change events.
1653+//
1654+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didChangeWatchedFilesRegistrationOptions
1655+type DidChangeWatchedFilesRegistrationOptions struct {
1656+ // The watchers to register.
1657+ Watchers []FileSystemWatcher `json:"watchers"`
1658+}
1659+
1660+// The parameters of a `workspace/didChangeWorkspaceFolders` notification.
1661+//
1662+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didChangeWorkspaceFoldersParams
1663+type DidChangeWorkspaceFoldersParams struct {
1664+ // The actual workspace folder change event.
1665+ Event WorkspaceFoldersChangeEvent `json:"event"`
1666+}
1667+
1668+// The params sent in a close notebook document notification.
1669+//
1670+// @since 3.17.0
1671+//
1672+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didCloseNotebookDocumentParams
1673+type DidCloseNotebookDocumentParams struct {
1674+ // The notebook document that got closed.
1675+ NotebookDocument NotebookDocumentIdentifier `json:"notebookDocument"`
1676+ // The text documents that represent the content
1677+ // of a notebook cell that got closed.
1678+ CellTextDocuments []TextDocumentIdentifier `json:"cellTextDocuments"`
1679+}
1680+
1681+// The parameters sent in a close text document notification
1682+//
1683+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didCloseTextDocumentParams
1684+type DidCloseTextDocumentParams struct {
1685+ // The document that was closed.
1686+ TextDocument TextDocumentIdentifier `json:"textDocument"`
1687+}
1688+
1689+// The params sent in an open notebook document notification.
1690+//
1691+// @since 3.17.0
1692+//
1693+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didOpenNotebookDocumentParams
1694+type DidOpenNotebookDocumentParams struct {
1695+ // The notebook document that got opened.
1696+ NotebookDocument NotebookDocument `json:"notebookDocument"`
1697+ // The text documents that represent the content
1698+ // of a notebook cell.
1699+ CellTextDocuments []TextDocumentItem `json:"cellTextDocuments"`
1700+}
1701+
1702+// The parameters sent in an open text document notification
1703+//
1704+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didOpenTextDocumentParams
1705+type DidOpenTextDocumentParams struct {
1706+ // The document that was opened.
1707+ TextDocument TextDocumentItem `json:"textDocument"`
1708+}
1709+
1710+// The params sent in a save notebook document notification.
1711+//
1712+// @since 3.17.0
1713+//
1714+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didSaveNotebookDocumentParams
1715+type DidSaveNotebookDocumentParams struct {
1716+ // The notebook document that got saved.
1717+ NotebookDocument NotebookDocumentIdentifier `json:"notebookDocument"`
1718+}
1719+
1720+// The parameters sent in a save text document notification
1721+//
1722+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didSaveTextDocumentParams
1723+type DidSaveTextDocumentParams struct {
1724+ // The document that was saved.
1725+ TextDocument TextDocumentIdentifier `json:"textDocument"`
1726+ // Optional the content when saved. Depends on the includeText value
1727+ // when the save notification was requested.
1728+ Text *string `json:"text,omitempty"`
1729+}
1730+
1731+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentColorClientCapabilities
1732+type DocumentColorClientCapabilities struct {
1733+ // Whether implementation supports dynamic registration. If this is set to `true`
1734+ // the client supports the new `DocumentColorRegistrationOptions` return value
1735+ // for the corresponding server capability as well.
1736+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
1737+}
1738+
1739+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentColorOptions
1740+type DocumentColorOptions struct {
1741+ WorkDoneProgressOptions
1742+}
1743+
1744+// Parameters for a {@link DocumentColorRequest}.
1745+//
1746+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentColorParams
1747+type DocumentColorParams struct {
1748+ // The text document.
1749+ TextDocument TextDocumentIdentifier `json:"textDocument"`
1750+ WorkDoneProgressParams
1751+ PartialResultParams
1752+}
1753+
1754+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentColorRegistrationOptions
1755+type DocumentColorRegistrationOptions struct {
1756+ TextDocumentRegistrationOptions
1757+ DocumentColorOptions
1758+ StaticRegistrationOptions
1759+}
1760+
1761+// Parameters of the document diagnostic request.
1762+//
1763+// @since 3.17.0
1764+//
1765+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentDiagnosticParams
1766+type DocumentDiagnosticParams struct {
1767+ // The text document.
1768+ TextDocument TextDocumentIdentifier `json:"textDocument"`
1769+ // The additional identifier provided during registration.
1770+ Identifier string `json:"identifier,omitempty"`
1771+ // The result id of a previous response if provided.
1772+ PreviousResultID string `json:"previousResultId,omitempty"`
1773+ WorkDoneProgressParams
1774+ PartialResultParams
1775+}
1776+
1777+// The result of a document diagnostic pull request. A report can
1778+// either be a full report containing all diagnostics for the
1779+// requested document or an unchanged report indicating that nothing
1780+// has changed in terms of diagnostics in comparison to the last
1781+// pull request.
1782+//
1783+// @since 3.17.0
1784+//
1785+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentDiagnosticReport
1786+type DocumentDiagnosticReport = Or_DocumentDiagnosticReport // (alias)
1787+// The document diagnostic report kinds.
1788+//
1789+// @since 3.17.0
1790+type DocumentDiagnosticReportKind string
1791+
1792+// A partial result for a document diagnostic report.
1793+//
1794+// @since 3.17.0
1795+//
1796+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentDiagnosticReportPartialResult
1797+type DocumentDiagnosticReportPartialResult struct {
1798+ RelatedDocuments map[DocumentUri]interface{} `json:"relatedDocuments"`
1799+}
1800+
1801+// A document filter describes a top level text document or
1802+// a notebook cell document.
1803+//
1804+// @since 3.17.0 - proposed support for NotebookCellTextDocumentFilter.
1805+//
1806+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentFilter
1807+type DocumentFilter = Or_DocumentFilter // (alias)
1808+// Client capabilities of a {@link DocumentFormattingRequest}.
1809+//
1810+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentFormattingClientCapabilities
1811+type DocumentFormattingClientCapabilities struct {
1812+ // Whether formatting supports dynamic registration.
1813+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
1814+}
1815+
1816+// Provider options for a {@link DocumentFormattingRequest}.
1817+//
1818+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentFormattingOptions
1819+type DocumentFormattingOptions struct {
1820+ WorkDoneProgressOptions
1821+}
1822+
1823+// The parameters of a {@link DocumentFormattingRequest}.
1824+//
1825+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentFormattingParams
1826+type DocumentFormattingParams struct {
1827+ // The document to format.
1828+ TextDocument TextDocumentIdentifier `json:"textDocument"`
1829+ // The format options.
1830+ Options FormattingOptions `json:"options"`
1831+ WorkDoneProgressParams
1832+}
1833+
1834+// Registration options for a {@link DocumentFormattingRequest}.
1835+//
1836+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentFormattingRegistrationOptions
1837+type DocumentFormattingRegistrationOptions struct {
1838+ TextDocumentRegistrationOptions
1839+ DocumentFormattingOptions
1840+}
1841+
1842+// A document highlight is a range inside a text document which deserves
1843+// special attention. Usually a document highlight is visualized by changing
1844+// the background color of its range.
1845+//
1846+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentHighlight
1847+type DocumentHighlight struct {
1848+ // The range this highlight applies to.
1849+ Range Range `json:"range"`
1850+ // The highlight kind, default is {@link DocumentHighlightKind.Text text}.
1851+ Kind DocumentHighlightKind `json:"kind,omitempty"`
1852+}
1853+
1854+// Client Capabilities for a {@link DocumentHighlightRequest}.
1855+//
1856+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentHighlightClientCapabilities
1857+type DocumentHighlightClientCapabilities struct {
1858+ // Whether document highlight supports dynamic registration.
1859+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
1860+}
1861+
1862+// A document highlight kind.
1863+type DocumentHighlightKind uint32
1864+
1865+// Provider options for a {@link DocumentHighlightRequest}.
1866+//
1867+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentHighlightOptions
1868+type DocumentHighlightOptions struct {
1869+ WorkDoneProgressOptions
1870+}
1871+
1872+// Parameters for a {@link DocumentHighlightRequest}.
1873+//
1874+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentHighlightParams
1875+type DocumentHighlightParams struct {
1876+ TextDocumentPositionParams
1877+ WorkDoneProgressParams
1878+ PartialResultParams
1879+}
1880+
1881+// Registration options for a {@link DocumentHighlightRequest}.
1882+//
1883+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentHighlightRegistrationOptions
1884+type DocumentHighlightRegistrationOptions struct {
1885+ TextDocumentRegistrationOptions
1886+ DocumentHighlightOptions
1887+}
1888+
1889+// A document link is a range in a text document that links to an internal or external resource, like another
1890+// text document or a web site.
1891+//
1892+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentLink
1893+type DocumentLink struct {
1894+ // The range this link applies to.
1895+ Range Range `json:"range"`
1896+ // The uri this link points to. If missing a resolve request is sent later.
1897+ Target *URI `json:"target,omitempty"`
1898+ // The tooltip text when you hover over this link.
1899+ //
1900+ // If a tooltip is provided, is will be displayed in a string that includes instructions on how to
1901+ // trigger the link, such as `{0} (ctrl + click)`. The specific instructions vary depending on OS,
1902+ // user settings, and localization.
1903+ //
1904+ // @since 3.15.0
1905+ Tooltip string `json:"tooltip,omitempty"`
1906+ // A data entry field that is preserved on a document link between a
1907+ // DocumentLinkRequest and a DocumentLinkResolveRequest.
1908+ Data interface{} `json:"data,omitempty"`
1909+}
1910+
1911+// The client capabilities of a {@link DocumentLinkRequest}.
1912+//
1913+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentLinkClientCapabilities
1914+type DocumentLinkClientCapabilities struct {
1915+ // Whether document link supports dynamic registration.
1916+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
1917+ // Whether the client supports the `tooltip` property on `DocumentLink`.
1918+ //
1919+ // @since 3.15.0
1920+ TooltipSupport bool `json:"tooltipSupport,omitempty"`
1921+}
1922+
1923+// Provider options for a {@link DocumentLinkRequest}.
1924+//
1925+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentLinkOptions
1926+type DocumentLinkOptions struct {
1927+ // Document links have a resolve provider as well.
1928+ ResolveProvider bool `json:"resolveProvider,omitempty"`
1929+ WorkDoneProgressOptions
1930+}
1931+
1932+// The parameters of a {@link DocumentLinkRequest}.
1933+//
1934+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentLinkParams
1935+type DocumentLinkParams struct {
1936+ // The document to provide document links for.
1937+ TextDocument TextDocumentIdentifier `json:"textDocument"`
1938+ WorkDoneProgressParams
1939+ PartialResultParams
1940+}
1941+
1942+// Registration options for a {@link DocumentLinkRequest}.
1943+//
1944+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentLinkRegistrationOptions
1945+type DocumentLinkRegistrationOptions struct {
1946+ TextDocumentRegistrationOptions
1947+ DocumentLinkOptions
1948+}
1949+
1950+// Client capabilities of a {@link DocumentOnTypeFormattingRequest}.
1951+//
1952+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentOnTypeFormattingClientCapabilities
1953+type DocumentOnTypeFormattingClientCapabilities struct {
1954+ // Whether on type formatting supports dynamic registration.
1955+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
1956+}
1957+
1958+// Provider options for a {@link DocumentOnTypeFormattingRequest}.
1959+//
1960+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentOnTypeFormattingOptions
1961+type DocumentOnTypeFormattingOptions struct {
1962+ // A character on which formatting should be triggered, like `{`.
1963+ FirstTriggerCharacter string `json:"firstTriggerCharacter"`
1964+ // More trigger characters.
1965+ MoreTriggerCharacter []string `json:"moreTriggerCharacter,omitempty"`
1966+}
1967+
1968+// The parameters of a {@link DocumentOnTypeFormattingRequest}.
1969+//
1970+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentOnTypeFormattingParams
1971+type DocumentOnTypeFormattingParams struct {
1972+ // The document to format.
1973+ TextDocument TextDocumentIdentifier `json:"textDocument"`
1974+ // The position around which the on type formatting should happen.
1975+ // This is not necessarily the exact position where the character denoted
1976+ // by the property `ch` got typed.
1977+ Position Position `json:"position"`
1978+ // The character that has been typed that triggered the formatting
1979+ // on type request. That is not necessarily the last character that
1980+ // got inserted into the document since the client could auto insert
1981+ // characters as well (e.g. like automatic brace completion).
1982+ Ch string `json:"ch"`
1983+ // The formatting options.
1984+ Options FormattingOptions `json:"options"`
1985+}
1986+
1987+// Registration options for a {@link DocumentOnTypeFormattingRequest}.
1988+//
1989+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentOnTypeFormattingRegistrationOptions
1990+type DocumentOnTypeFormattingRegistrationOptions struct {
1991+ TextDocumentRegistrationOptions
1992+ DocumentOnTypeFormattingOptions
1993+}
1994+
1995+// Client capabilities of a {@link DocumentRangeFormattingRequest}.
1996+//
1997+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentRangeFormattingClientCapabilities
1998+type DocumentRangeFormattingClientCapabilities struct {
1999+ // Whether range formatting supports dynamic registration.
2000+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
2001+ // Whether the client supports formatting multiple ranges at once.
2002+ //
2003+ // @since 3.18.0
2004+ // @proposed
2005+ RangesSupport bool `json:"rangesSupport,omitempty"`
2006+}
2007+
2008+// Provider options for a {@link DocumentRangeFormattingRequest}.
2009+//
2010+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentRangeFormattingOptions
2011+type DocumentRangeFormattingOptions struct {
2012+ // Whether the server supports formatting multiple ranges at once.
2013+ //
2014+ // @since 3.18.0
2015+ // @proposed
2016+ RangesSupport bool `json:"rangesSupport,omitempty"`
2017+ WorkDoneProgressOptions
2018+}
2019+
2020+// The parameters of a {@link DocumentRangeFormattingRequest}.
2021+//
2022+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentRangeFormattingParams
2023+type DocumentRangeFormattingParams struct {
2024+ // The document to format.
2025+ TextDocument TextDocumentIdentifier `json:"textDocument"`
2026+ // The range to format
2027+ Range Range `json:"range"`
2028+ // The format options
2029+ Options FormattingOptions `json:"options"`
2030+ WorkDoneProgressParams
2031+}
2032+
2033+// Registration options for a {@link DocumentRangeFormattingRequest}.
2034+//
2035+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentRangeFormattingRegistrationOptions
2036+type DocumentRangeFormattingRegistrationOptions struct {
2037+ TextDocumentRegistrationOptions
2038+ DocumentRangeFormattingOptions
2039+}
2040+
2041+// The parameters of a {@link DocumentRangesFormattingRequest}.
2042+//
2043+// @since 3.18.0
2044+// @proposed
2045+//
2046+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentRangesFormattingParams
2047+type DocumentRangesFormattingParams struct {
2048+ // The document to format.
2049+ TextDocument TextDocumentIdentifier `json:"textDocument"`
2050+ // The ranges to format
2051+ Ranges []Range `json:"ranges"`
2052+ // The format options
2053+ Options FormattingOptions `json:"options"`
2054+ WorkDoneProgressParams
2055+}
2056+
2057+// A document selector is the combination of one or many document filters.
2058+//
2059+// @sample `let sel:DocumentSelector = [{ language: 'typescript' }, { language: 'json', pattern: '**∕tsconfig.json' }]`;
2060+//
2061+// The use of a string as a document filter is deprecated @since 3.16.0.
2062+//
2063+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentSelector
2064+type DocumentSelector = []DocumentFilter // (alias)
2065+// Represents programming constructs like variables, classes, interfaces etc.
2066+// that appear in a document. Document symbols can be hierarchical and they
2067+// have two ranges: one that encloses its definition and one that points to
2068+// its most interesting range, e.g. the range of an identifier.
2069+//
2070+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentSymbol
2071+type DocumentSymbol struct {
2072+ // The name of this symbol. Will be displayed in the user interface and therefore must not be
2073+ // an empty string or a string only consisting of white spaces.
2074+ Name string `json:"name"`
2075+ // More detail for this symbol, e.g the signature of a function.
2076+ Detail string `json:"detail,omitempty"`
2077+ // The kind of this symbol.
2078+ Kind SymbolKind `json:"kind"`
2079+ // Tags for this document symbol.
2080+ //
2081+ // @since 3.16.0
2082+ Tags []SymbolTag `json:"tags,omitempty"`
2083+ // Indicates if this symbol is deprecated.
2084+ //
2085+ // @deprecated Use tags instead
2086+ Deprecated bool `json:"deprecated,omitempty"`
2087+ // The range enclosing this symbol not including leading/trailing whitespace but everything else
2088+ // like comments. This information is typically used to determine if the clients cursor is
2089+ // inside the symbol to reveal in the symbol in the UI.
2090+ Range Range `json:"range"`
2091+ // The range that should be selected and revealed when this symbol is being picked, e.g the name of a function.
2092+ // Must be contained by the `range`.
2093+ SelectionRange Range `json:"selectionRange"`
2094+ // Children of this symbol, e.g. properties of a class.
2095+ Children []DocumentSymbol `json:"children,omitempty"`
2096+}
2097+
2098+// Client Capabilities for a {@link DocumentSymbolRequest}.
2099+//
2100+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentSymbolClientCapabilities
2101+type DocumentSymbolClientCapabilities struct {
2102+ // Whether document symbol supports dynamic registration.
2103+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
2104+ // Specific capabilities for the `SymbolKind` in the
2105+ // `textDocument/documentSymbol` request.
2106+ SymbolKind *ClientSymbolKindOptions `json:"symbolKind,omitempty"`
2107+ // The client supports hierarchical document symbols.
2108+ HierarchicalDocumentSymbolSupport bool `json:"hierarchicalDocumentSymbolSupport,omitempty"`
2109+ // The client supports tags on `SymbolInformation`. Tags are supported on
2110+ // `DocumentSymbol` if `hierarchicalDocumentSymbolSupport` is set to true.
2111+ // Clients supporting tags have to handle unknown tags gracefully.
2112+ //
2113+ // @since 3.16.0
2114+ TagSupport *ClientSymbolTagOptions `json:"tagSupport,omitempty"`
2115+ // The client supports an additional label presented in the UI when
2116+ // registering a document symbol provider.
2117+ //
2118+ // @since 3.16.0
2119+ LabelSupport bool `json:"labelSupport,omitempty"`
2120+}
2121+
2122+// Provider options for a {@link DocumentSymbolRequest}.
2123+//
2124+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentSymbolOptions
2125+type DocumentSymbolOptions struct {
2126+ // A human-readable string that is shown when multiple outlines trees
2127+ // are shown for the same document.
2128+ //
2129+ // @since 3.16.0
2130+ Label string `json:"label,omitempty"`
2131+ WorkDoneProgressOptions
2132+}
2133+
2134+// Parameters for a {@link DocumentSymbolRequest}.
2135+//
2136+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentSymbolParams
2137+type DocumentSymbolParams struct {
2138+ // The text document.
2139+ TextDocument TextDocumentIdentifier `json:"textDocument"`
2140+ WorkDoneProgressParams
2141+ PartialResultParams
2142+}
2143+
2144+// Registration options for a {@link DocumentSymbolRequest}.
2145+//
2146+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentSymbolRegistrationOptions
2147+type DocumentSymbolRegistrationOptions struct {
2148+ TextDocumentRegistrationOptions
2149+ DocumentSymbolOptions
2150+}
2151+
2152+// Edit range variant that includes ranges for insert and replace operations.
2153+//
2154+// @since 3.18.0
2155+//
2156+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#editRangeWithInsertReplace
2157+type EditRangeWithInsertReplace struct {
2158+ Insert Range `json:"insert"`
2159+ Replace Range `json:"replace"`
2160+}
2161+
2162+// Predefined error codes.
2163+type ErrorCodes int32
2164+
2165+// The client capabilities of a {@link ExecuteCommandRequest}.
2166+//
2167+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#executeCommandClientCapabilities
2168+type ExecuteCommandClientCapabilities struct {
2169+ // Execute command supports dynamic registration.
2170+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
2171+}
2172+
2173+// The server capabilities of a {@link ExecuteCommandRequest}.
2174+//
2175+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#executeCommandOptions
2176+type ExecuteCommandOptions struct {
2177+ // The commands to be executed on the server
2178+ Commands []string `json:"commands"`
2179+ WorkDoneProgressOptions
2180+}
2181+
2182+// The parameters of a {@link ExecuteCommandRequest}.
2183+//
2184+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#executeCommandParams
2185+type ExecuteCommandParams struct {
2186+ // The identifier of the actual command handler.
2187+ Command string `json:"command"`
2188+ // Arguments that the command should be invoked with.
2189+ Arguments []json.RawMessage `json:"arguments,omitempty"`
2190+ WorkDoneProgressParams
2191+}
2192+
2193+// Registration options for a {@link ExecuteCommandRequest}.
2194+//
2195+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#executeCommandRegistrationOptions
2196+type ExecuteCommandRegistrationOptions struct {
2197+ ExecuteCommandOptions
2198+}
2199+
2200+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#executionSummary
2201+type ExecutionSummary struct {
2202+ // A strict monotonically increasing value
2203+ // indicating the execution order of a cell
2204+ // inside a notebook.
2205+ ExecutionOrder uint32 `json:"executionOrder"`
2206+ // Whether the execution was successful or
2207+ // not if known by the client.
2208+ Success bool `json:"success,omitempty"`
2209+}
2210+type FailureHandlingKind string
2211+
2212+// The file event type
2213+type FileChangeType uint32
2214+
2215+// Represents information on a file/folder create.
2216+//
2217+// @since 3.16.0
2218+//
2219+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileCreate
2220+type FileCreate struct {
2221+ // A file:// URI for the location of the file/folder being created.
2222+ URI string `json:"uri"`
2223+}
2224+
2225+// Represents information on a file/folder delete.
2226+//
2227+// @since 3.16.0
2228+//
2229+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileDelete
2230+type FileDelete struct {
2231+ // A file:// URI for the location of the file/folder being deleted.
2232+ URI string `json:"uri"`
2233+}
2234+
2235+// An event describing a file change.
2236+//
2237+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileEvent
2238+type FileEvent struct {
2239+ // The file's uri.
2240+ URI DocumentUri `json:"uri"`
2241+ // The change type.
2242+ Type FileChangeType `json:"type"`
2243+}
2244+
2245+// Capabilities relating to events from file operations by the user in the client.
2246+//
2247+// These events do not come from the file system, they come from user operations
2248+// like renaming a file in the UI.
2249+//
2250+// @since 3.16.0
2251+//
2252+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileOperationClientCapabilities
2253+type FileOperationClientCapabilities struct {
2254+ // Whether the client supports dynamic registration for file requests/notifications.
2255+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
2256+ // The client has support for sending didCreateFiles notifications.
2257+ DidCreate bool `json:"didCreate,omitempty"`
2258+ // The client has support for sending willCreateFiles requests.
2259+ WillCreate bool `json:"willCreate,omitempty"`
2260+ // The client has support for sending didRenameFiles notifications.
2261+ DidRename bool `json:"didRename,omitempty"`
2262+ // The client has support for sending willRenameFiles requests.
2263+ WillRename bool `json:"willRename,omitempty"`
2264+ // The client has support for sending didDeleteFiles notifications.
2265+ DidDelete bool `json:"didDelete,omitempty"`
2266+ // The client has support for sending willDeleteFiles requests.
2267+ WillDelete bool `json:"willDelete,omitempty"`
2268+}
2269+
2270+// A filter to describe in which file operation requests or notifications
2271+// the server is interested in receiving.
2272+//
2273+// @since 3.16.0
2274+//
2275+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileOperationFilter
2276+type FileOperationFilter struct {
2277+ // A Uri scheme like `file` or `untitled`.
2278+ Scheme string `json:"scheme,omitempty"`
2279+ // The actual file operation pattern.
2280+ Pattern FileOperationPattern `json:"pattern"`
2281+}
2282+
2283+// Options for notifications/requests for user operations on files.
2284+//
2285+// @since 3.16.0
2286+//
2287+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileOperationOptions
2288+type FileOperationOptions struct {
2289+ // The server is interested in receiving didCreateFiles notifications.
2290+ DidCreate *FileOperationRegistrationOptions `json:"didCreate,omitempty"`
2291+ // The server is interested in receiving willCreateFiles requests.
2292+ WillCreate *FileOperationRegistrationOptions `json:"willCreate,omitempty"`
2293+ // The server is interested in receiving didRenameFiles notifications.
2294+ DidRename *FileOperationRegistrationOptions `json:"didRename,omitempty"`
2295+ // The server is interested in receiving willRenameFiles requests.
2296+ WillRename *FileOperationRegistrationOptions `json:"willRename,omitempty"`
2297+ // The server is interested in receiving didDeleteFiles file notifications.
2298+ DidDelete *FileOperationRegistrationOptions `json:"didDelete,omitempty"`
2299+ // The server is interested in receiving willDeleteFiles file requests.
2300+ WillDelete *FileOperationRegistrationOptions `json:"willDelete,omitempty"`
2301+}
2302+
2303+// A pattern to describe in which file operation requests or notifications
2304+// the server is interested in receiving.
2305+//
2306+// @since 3.16.0
2307+//
2308+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileOperationPattern
2309+type FileOperationPattern struct {
2310+ // The glob pattern to match. Glob patterns can have the following syntax:
2311+ //
2312+ // - `*` to match one or more characters in a path segment
2313+ // - `?` to match on one character in a path segment
2314+ // - `**` to match any number of path segments, including none
2315+ // - `{}` to group sub patterns into an OR expression. (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files)
2316+ // - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …)
2317+ // - `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`)
2318+ Glob string `json:"glob"`
2319+ // Whether to match files or folders with this pattern.
2320+ //
2321+ // Matches both if undefined.
2322+ Matches *FileOperationPatternKind `json:"matches,omitempty"`
2323+ // Additional options used during matching.
2324+ Options *FileOperationPatternOptions `json:"options,omitempty"`
2325+}
2326+
2327+// A pattern kind describing if a glob pattern matches a file a folder or
2328+// both.
2329+//
2330+// @since 3.16.0
2331+type FileOperationPatternKind string
2332+
2333+// Matching options for the file operation pattern.
2334+//
2335+// @since 3.16.0
2336+//
2337+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileOperationPatternOptions
2338+type FileOperationPatternOptions struct {
2339+ // The pattern should be matched ignoring casing.
2340+ IgnoreCase bool `json:"ignoreCase,omitempty"`
2341+}
2342+
2343+// The options to register for file operations.
2344+//
2345+// @since 3.16.0
2346+//
2347+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileOperationRegistrationOptions
2348+type FileOperationRegistrationOptions struct {
2349+ // The actual filters.
2350+ Filters []FileOperationFilter `json:"filters"`
2351+}
2352+
2353+// Represents information on a file/folder rename.
2354+//
2355+// @since 3.16.0
2356+//
2357+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileRename
2358+type FileRename struct {
2359+ // A file:// URI for the original location of the file/folder being renamed.
2360+ OldURI string `json:"oldUri"`
2361+ // A file:// URI for the new location of the file/folder being renamed.
2362+ NewURI string `json:"newUri"`
2363+}
2364+
2365+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileSystemWatcher
2366+type FileSystemWatcher struct {
2367+ // The glob pattern to watch. See {@link GlobPattern glob pattern} for more detail.
2368+ //
2369+ // @since 3.17.0 support for relative patterns.
2370+ GlobPattern GlobPattern `json:"globPattern"`
2371+ // The kind of events of interest. If omitted it defaults
2372+ // to WatchKind.Create | WatchKind.Change | WatchKind.Delete
2373+ // which is 7.
2374+ Kind *WatchKind `json:"kind,omitempty"`
2375+}
2376+
2377+// Represents a folding range. To be valid, start and end line must be bigger than zero and smaller
2378+// than the number of lines in the document. Clients are free to ignore invalid ranges.
2379+//
2380+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#foldingRange
2381+type FoldingRange struct {
2382+ // The zero-based start line of the range to fold. The folded area starts after the line's last character.
2383+ // To be valid, the end must be zero or larger and smaller than the number of lines in the document.
2384+ StartLine uint32 `json:"startLine"`
2385+ // The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line.
2386+ StartCharacter uint32 `json:"startCharacter,omitempty"`
2387+ // The zero-based end line of the range to fold. The folded area ends with the line's last character.
2388+ // To be valid, the end must be zero or larger and smaller than the number of lines in the document.
2389+ EndLine uint32 `json:"endLine"`
2390+ // The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line.
2391+ EndCharacter uint32 `json:"endCharacter,omitempty"`
2392+ // Describes the kind of the folding range such as 'comment' or 'region'. The kind
2393+ // is used to categorize folding ranges and used by commands like 'Fold all comments'.
2394+ // See {@link FoldingRangeKind} for an enumeration of standardized kinds.
2395+ Kind string `json:"kind,omitempty"`
2396+ // The text that the client should show when the specified range is
2397+ // collapsed. If not defined or not supported by the client, a default
2398+ // will be chosen by the client.
2399+ //
2400+ // @since 3.17.0
2401+ CollapsedText string `json:"collapsedText,omitempty"`
2402+}
2403+
2404+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#foldingRangeClientCapabilities
2405+type FoldingRangeClientCapabilities struct {
2406+ // Whether implementation supports dynamic registration for folding range
2407+ // providers. If this is set to `true` the client supports the new
2408+ // `FoldingRangeRegistrationOptions` return value for the corresponding
2409+ // server capability as well.
2410+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
2411+ // The maximum number of folding ranges that the client prefers to receive
2412+ // per document. The value serves as a hint, servers are free to follow the
2413+ // limit.
2414+ RangeLimit uint32 `json:"rangeLimit,omitempty"`
2415+ // If set, the client signals that it only supports folding complete lines.
2416+ // If set, client will ignore specified `startCharacter` and `endCharacter`
2417+ // properties in a FoldingRange.
2418+ LineFoldingOnly bool `json:"lineFoldingOnly,omitempty"`
2419+ // Specific options for the folding range kind.
2420+ //
2421+ // @since 3.17.0
2422+ FoldingRangeKind *ClientFoldingRangeKindOptions `json:"foldingRangeKind,omitempty"`
2423+ // Specific options for the folding range.
2424+ //
2425+ // @since 3.17.0
2426+ FoldingRange *ClientFoldingRangeOptions `json:"foldingRange,omitempty"`
2427+}
2428+
2429+// A set of predefined range kinds.
2430+type FoldingRangeKind string
2431+
2432+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#foldingRangeOptions
2433+type FoldingRangeOptions struct {
2434+ WorkDoneProgressOptions
2435+}
2436+
2437+// Parameters for a {@link FoldingRangeRequest}.
2438+//
2439+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#foldingRangeParams
2440+type FoldingRangeParams struct {
2441+ // The text document.
2442+ TextDocument TextDocumentIdentifier `json:"textDocument"`
2443+ WorkDoneProgressParams
2444+ PartialResultParams
2445+}
2446+
2447+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#foldingRangeRegistrationOptions
2448+type FoldingRangeRegistrationOptions struct {
2449+ TextDocumentRegistrationOptions
2450+ FoldingRangeOptions
2451+ StaticRegistrationOptions
2452+}
2453+
2454+// Client workspace capabilities specific to folding ranges
2455+//
2456+// @since 3.18.0
2457+// @proposed
2458+//
2459+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#foldingRangeWorkspaceClientCapabilities
2460+type FoldingRangeWorkspaceClientCapabilities struct {
2461+ // Whether the client implementation supports a refresh request sent from the
2462+ // server to the client.
2463+ //
2464+ // Note that this event is global and will force the client to refresh all
2465+ // folding ranges currently shown. It should be used with absolute care and is
2466+ // useful for situation where a server for example detects a project wide
2467+ // change that requires such a calculation.
2468+ //
2469+ // @since 3.18.0
2470+ // @proposed
2471+ RefreshSupport bool `json:"refreshSupport,omitempty"`
2472+}
2473+
2474+// Value-object describing what options formatting should use.
2475+//
2476+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#formattingOptions
2477+type FormattingOptions struct {
2478+ // Size of a tab in spaces.
2479+ TabSize uint32 `json:"tabSize"`
2480+ // Prefer spaces over tabs.
2481+ InsertSpaces bool `json:"insertSpaces"`
2482+ // Trim trailing whitespace on a line.
2483+ //
2484+ // @since 3.15.0
2485+ TrimTrailingWhitespace bool `json:"trimTrailingWhitespace,omitempty"`
2486+ // Insert a newline character at the end of the file if one does not exist.
2487+ //
2488+ // @since 3.15.0
2489+ InsertFinalNewline bool `json:"insertFinalNewline,omitempty"`
2490+ // Trim all newlines after the final newline at the end of the file.
2491+ //
2492+ // @since 3.15.0
2493+ TrimFinalNewlines bool `json:"trimFinalNewlines,omitempty"`
2494+}
2495+
2496+// A diagnostic report with a full set of problems.
2497+//
2498+// @since 3.17.0
2499+//
2500+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fullDocumentDiagnosticReport
2501+type FullDocumentDiagnosticReport struct {
2502+ // A full document diagnostic report.
2503+ Kind string `json:"kind"`
2504+ // An optional result id. If provided it will
2505+ // be sent on the next diagnostic request for the
2506+ // same document.
2507+ ResultID string `json:"resultId,omitempty"`
2508+ // The actual items.
2509+ Items []Diagnostic `json:"items"`
2510+}
2511+
2512+// General client capabilities.
2513+//
2514+// @since 3.16.0
2515+//
2516+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#generalClientCapabilities
2517+type GeneralClientCapabilities struct {
2518+ // Client capability that signals how the client
2519+ // handles stale requests (e.g. a request
2520+ // for which the client will not process the response
2521+ // anymore since the information is outdated).
2522+ //
2523+ // @since 3.17.0
2524+ StaleRequestSupport *StaleRequestSupportOptions `json:"staleRequestSupport,omitempty"`
2525+ // Client capabilities specific to regular expressions.
2526+ //
2527+ // @since 3.16.0
2528+ RegularExpressions *RegularExpressionsClientCapabilities `json:"regularExpressions,omitempty"`
2529+ // Client capabilities specific to the client's markdown parser.
2530+ //
2531+ // @since 3.16.0
2532+ Markdown *MarkdownClientCapabilities `json:"markdown,omitempty"`
2533+ // The position encodings supported by the client. Client and server
2534+ // have to agree on the same position encoding to ensure that offsets
2535+ // (e.g. character position in a line) are interpreted the same on both
2536+ // sides.
2537+ //
2538+ // To keep the protocol backwards compatible the following applies: if
2539+ // the value 'utf-16' is missing from the array of position encodings
2540+ // servers can assume that the client supports UTF-16. UTF-16 is
2541+ // therefore a mandatory encoding.
2542+ //
2543+ // If omitted it defaults to ['utf-16'].
2544+ //
2545+ // Implementation considerations: since the conversion from one encoding
2546+ // into another requires the content of the file / line the conversion
2547+ // is best done where the file is read which is usually on the server
2548+ // side.
2549+ //
2550+ // @since 3.17.0
2551+ PositionEncodings []PositionEncodingKind `json:"positionEncodings,omitempty"`
2552+}
2553+
2554+// The glob pattern. Either a string pattern or a relative pattern.
2555+//
2556+// @since 3.17.0
2557+//
2558+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#globPattern
2559+type GlobPattern = Or_GlobPattern // (alias)
2560+// The result of a hover request.
2561+//
2562+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#hover
2563+type Hover struct {
2564+ // The hover's content
2565+ Contents MarkupContent `json:"contents"`
2566+ // An optional range inside the text document that is used to
2567+ // visualize the hover, e.g. by changing the background color.
2568+ Range Range `json:"range,omitempty"`
2569+}
2570+
2571+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#hoverClientCapabilities
2572+type HoverClientCapabilities struct {
2573+ // Whether hover supports dynamic registration.
2574+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
2575+ // Client supports the following content formats for the content
2576+ // property. The order describes the preferred format of the client.
2577+ ContentFormat []MarkupKind `json:"contentFormat,omitempty"`
2578+}
2579+
2580+// Hover options.
2581+//
2582+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#hoverOptions
2583+type HoverOptions struct {
2584+ WorkDoneProgressOptions
2585+}
2586+
2587+// Parameters for a {@link HoverRequest}.
2588+//
2589+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#hoverParams
2590+type HoverParams struct {
2591+ TextDocumentPositionParams
2592+ WorkDoneProgressParams
2593+}
2594+
2595+// Registration options for a {@link HoverRequest}.
2596+//
2597+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#hoverRegistrationOptions
2598+type HoverRegistrationOptions struct {
2599+ TextDocumentRegistrationOptions
2600+ HoverOptions
2601+}
2602+
2603+// @since 3.6.0
2604+//
2605+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#implementationClientCapabilities
2606+type ImplementationClientCapabilities struct {
2607+ // Whether implementation supports dynamic registration. If this is set to `true`
2608+ // the client supports the new `ImplementationRegistrationOptions` return value
2609+ // for the corresponding server capability as well.
2610+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
2611+ // The client supports additional metadata in the form of definition links.
2612+ //
2613+ // @since 3.14.0
2614+ LinkSupport bool `json:"linkSupport,omitempty"`
2615+}
2616+
2617+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#implementationOptions
2618+type ImplementationOptions struct {
2619+ WorkDoneProgressOptions
2620+}
2621+
2622+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#implementationParams
2623+type ImplementationParams struct {
2624+ TextDocumentPositionParams
2625+ WorkDoneProgressParams
2626+ PartialResultParams
2627+}
2628+
2629+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#implementationRegistrationOptions
2630+type ImplementationRegistrationOptions struct {
2631+ TextDocumentRegistrationOptions
2632+ ImplementationOptions
2633+ StaticRegistrationOptions
2634+}
2635+
2636+// The data type of the ResponseError if the
2637+// initialize request fails.
2638+//
2639+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#initializeError
2640+type InitializeError struct {
2641+ // Indicates whether the client execute the following retry logic:
2642+ // (1) show the message provided by the ResponseError to the user
2643+ // (2) user selects retry or cancel
2644+ // (3) if user selected retry the initialize method is sent again.
2645+ Retry bool `json:"retry"`
2646+}
2647+
2648+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#initializeParams
2649+type InitializeParams struct {
2650+ XInitializeParams
2651+ WorkspaceFoldersInitializeParams
2652+}
2653+
2654+// The result returned from an initialize request.
2655+//
2656+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#initializeResult
2657+type InitializeResult struct {
2658+ // The capabilities the language server provides.
2659+ Capabilities ServerCapabilities `json:"capabilities"`
2660+ // Information about the server.
2661+ //
2662+ // @since 3.15.0
2663+ ServerInfo *ServerInfo `json:"serverInfo,omitempty"`
2664+}
2665+
2666+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#initializedParams
2667+type InitializedParams struct {
2668+}
2669+
2670+// Inlay hint information.
2671+//
2672+// @since 3.17.0
2673+//
2674+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlayHint
2675+type InlayHint struct {
2676+ // The position of this hint.
2677+ //
2678+ // If multiple hints have the same position, they will be shown in the order
2679+ // they appear in the response.
2680+ Position Position `json:"position"`
2681+ // The label of this hint. A human readable string or an array of
2682+ // InlayHintLabelPart label parts.
2683+ //
2684+ // *Note* that neither the string nor the label part can be empty.
2685+ Label []InlayHintLabelPart `json:"label"`
2686+ // The kind of this hint. Can be omitted in which case the client
2687+ // should fall back to a reasonable default.
2688+ Kind InlayHintKind `json:"kind,omitempty"`
2689+ // Optional text edits that are performed when accepting this inlay hint.
2690+ //
2691+ // *Note* that edits are expected to change the document so that the inlay
2692+ // hint (or its nearest variant) is now part of the document and the inlay
2693+ // hint itself is now obsolete.
2694+ TextEdits []TextEdit `json:"textEdits,omitempty"`
2695+ // The tooltip text when you hover over this item.
2696+ Tooltip *Or_InlayHint_tooltip `json:"tooltip,omitempty"`
2697+ // Render padding before the hint.
2698+ //
2699+ // Note: Padding should use the editor's background color, not the
2700+ // background color of the hint itself. That means padding can be used
2701+ // to visually align/separate an inlay hint.
2702+ PaddingLeft bool `json:"paddingLeft,omitempty"`
2703+ // Render padding after the hint.
2704+ //
2705+ // Note: Padding should use the editor's background color, not the
2706+ // background color of the hint itself. That means padding can be used
2707+ // to visually align/separate an inlay hint.
2708+ PaddingRight bool `json:"paddingRight,omitempty"`
2709+ // A data entry field that is preserved on an inlay hint between
2710+ // a `textDocument/inlayHint` and a `inlayHint/resolve` request.
2711+ Data interface{} `json:"data,omitempty"`
2712+}
2713+
2714+// Inlay hint client capabilities.
2715+//
2716+// @since 3.17.0
2717+//
2718+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlayHintClientCapabilities
2719+type InlayHintClientCapabilities struct {
2720+ // Whether inlay hints support dynamic registration.
2721+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
2722+ // Indicates which properties a client can resolve lazily on an inlay
2723+ // hint.
2724+ ResolveSupport *ClientInlayHintResolveOptions `json:"resolveSupport,omitempty"`
2725+}
2726+
2727+// Inlay hint kinds.
2728+//
2729+// @since 3.17.0
2730+type InlayHintKind uint32
2731+
2732+// An inlay hint label part allows for interactive and composite labels
2733+// of inlay hints.
2734+//
2735+// @since 3.17.0
2736+//
2737+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlayHintLabelPart
2738+type InlayHintLabelPart struct {
2739+ // The value of this label part.
2740+ Value string `json:"value"`
2741+ // The tooltip text when you hover over this label part. Depending on
2742+ // the client capability `inlayHint.resolveSupport` clients might resolve
2743+ // this property late using the resolve request.
2744+ Tooltip *Or_InlayHintLabelPart_tooltip `json:"tooltip,omitempty"`
2745+ // An optional source code location that represents this
2746+ // label part.
2747+ //
2748+ // The editor will use this location for the hover and for code navigation
2749+ // features: This part will become a clickable link that resolves to the
2750+ // definition of the symbol at the given location (not necessarily the
2751+ // location itself), it shows the hover that shows at the given location,
2752+ // and it shows a context menu with further code navigation commands.
2753+ //
2754+ // Depending on the client capability `inlayHint.resolveSupport` clients
2755+ // might resolve this property late using the resolve request.
2756+ Location *Location `json:"location,omitempty"`
2757+ // An optional command for this label part.
2758+ //
2759+ // Depending on the client capability `inlayHint.resolveSupport` clients
2760+ // might resolve this property late using the resolve request.
2761+ Command *Command `json:"command,omitempty"`
2762+}
2763+
2764+// Inlay hint options used during static registration.
2765+//
2766+// @since 3.17.0
2767+//
2768+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlayHintOptions
2769+type InlayHintOptions struct {
2770+ // The server provides support to resolve additional
2771+ // information for an inlay hint item.
2772+ ResolveProvider bool `json:"resolveProvider,omitempty"`
2773+ WorkDoneProgressOptions
2774+}
2775+
2776+// A parameter literal used in inlay hint requests.
2777+//
2778+// @since 3.17.0
2779+//
2780+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlayHintParams
2781+type InlayHintParams struct {
2782+ // The text document.
2783+ TextDocument TextDocumentIdentifier `json:"textDocument"`
2784+ // The document range for which inlay hints should be computed.
2785+ Range Range `json:"range"`
2786+ WorkDoneProgressParams
2787+}
2788+
2789+// Inlay hint options used during static or dynamic registration.
2790+//
2791+// @since 3.17.0
2792+//
2793+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlayHintRegistrationOptions
2794+type InlayHintRegistrationOptions struct {
2795+ InlayHintOptions
2796+ TextDocumentRegistrationOptions
2797+ StaticRegistrationOptions
2798+}
2799+
2800+// Client workspace capabilities specific to inlay hints.
2801+//
2802+// @since 3.17.0
2803+//
2804+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlayHintWorkspaceClientCapabilities
2805+type InlayHintWorkspaceClientCapabilities struct {
2806+ // Whether the client implementation supports a refresh request sent from
2807+ // the server to the client.
2808+ //
2809+ // Note that this event is global and will force the client to refresh all
2810+ // inlay hints currently shown. It should be used with absolute care and
2811+ // is useful for situation where a server for example detects a project wide
2812+ // change that requires such a calculation.
2813+ RefreshSupport bool `json:"refreshSupport,omitempty"`
2814+}
2815+
2816+// Client capabilities specific to inline completions.
2817+//
2818+// @since 3.18.0
2819+// @proposed
2820+//
2821+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineCompletionClientCapabilities
2822+type InlineCompletionClientCapabilities struct {
2823+ // Whether implementation supports dynamic registration for inline completion providers.
2824+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
2825+}
2826+
2827+// Provides information about the context in which an inline completion was requested.
2828+//
2829+// @since 3.18.0
2830+// @proposed
2831+//
2832+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineCompletionContext
2833+type InlineCompletionContext struct {
2834+ // Describes how the inline completion was triggered.
2835+ TriggerKind InlineCompletionTriggerKind `json:"triggerKind"`
2836+ // Provides information about the currently selected item in the autocomplete widget if it is visible.
2837+ SelectedCompletionInfo *SelectedCompletionInfo `json:"selectedCompletionInfo,omitempty"`
2838+}
2839+
2840+// An inline completion item represents a text snippet that is proposed inline to complete text that is being typed.
2841+//
2842+// @since 3.18.0
2843+// @proposed
2844+//
2845+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineCompletionItem
2846+type InlineCompletionItem struct {
2847+ // The text to replace the range with. Must be set.
2848+ InsertText Or_InlineCompletionItem_insertText `json:"insertText"`
2849+ // A text that is used to decide if this inline completion should be shown. When `falsy` the {@link InlineCompletionItem.insertText} is used.
2850+ FilterText string `json:"filterText,omitempty"`
2851+ // The range to replace. Must begin and end on the same line.
2852+ Range *Range `json:"range,omitempty"`
2853+ // An optional {@link Command} that is executed *after* inserting this completion.
2854+ Command *Command `json:"command,omitempty"`
2855+}
2856+
2857+// Represents a collection of {@link InlineCompletionItem inline completion items} to be presented in the editor.
2858+//
2859+// @since 3.18.0
2860+// @proposed
2861+//
2862+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineCompletionList
2863+type InlineCompletionList struct {
2864+ // The inline completion items
2865+ Items []InlineCompletionItem `json:"items"`
2866+}
2867+
2868+// Inline completion options used during static registration.
2869+//
2870+// @since 3.18.0
2871+// @proposed
2872+//
2873+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineCompletionOptions
2874+type InlineCompletionOptions struct {
2875+ WorkDoneProgressOptions
2876+}
2877+
2878+// A parameter literal used in inline completion requests.
2879+//
2880+// @since 3.18.0
2881+// @proposed
2882+//
2883+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineCompletionParams
2884+type InlineCompletionParams struct {
2885+ // Additional information about the context in which inline completions were
2886+ // requested.
2887+ Context InlineCompletionContext `json:"context"`
2888+ TextDocumentPositionParams
2889+ WorkDoneProgressParams
2890+}
2891+
2892+// Inline completion options used during static or dynamic registration.
2893+//
2894+// @since 3.18.0
2895+// @proposed
2896+//
2897+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineCompletionRegistrationOptions
2898+type InlineCompletionRegistrationOptions struct {
2899+ InlineCompletionOptions
2900+ TextDocumentRegistrationOptions
2901+ StaticRegistrationOptions
2902+}
2903+
2904+// Describes how an {@link InlineCompletionItemProvider inline completion provider} was triggered.
2905+//
2906+// @since 3.18.0
2907+// @proposed
2908+type InlineCompletionTriggerKind uint32
2909+
2910+// Inline value information can be provided by different means:
2911+//
2912+// - directly as a text value (class InlineValueText).
2913+// - as a name to use for a variable lookup (class InlineValueVariableLookup)
2914+// - as an evaluatable expression (class InlineValueEvaluatableExpression)
2915+//
2916+// The InlineValue types combines all inline value types into one type.
2917+//
2918+// @since 3.17.0
2919+//
2920+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValue
2921+type InlineValue = Or_InlineValue // (alias)
2922+// Client capabilities specific to inline values.
2923+//
2924+// @since 3.17.0
2925+//
2926+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValueClientCapabilities
2927+type InlineValueClientCapabilities struct {
2928+ // Whether implementation supports dynamic registration for inline value providers.
2929+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
2930+}
2931+
2932+// @since 3.17.0
2933+//
2934+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValueContext
2935+type InlineValueContext struct {
2936+ // The stack frame (as a DAP Id) where the execution has stopped.
2937+ FrameID int32 `json:"frameId"`
2938+ // The document range where execution has stopped.
2939+ // Typically the end position of the range denotes the line where the inline values are shown.
2940+ StoppedLocation Range `json:"stoppedLocation"`
2941+}
2942+
2943+// Provide an inline value through an expression evaluation.
2944+// If only a range is specified, the expression will be extracted from the underlying document.
2945+// An optional expression can be used to override the extracted expression.
2946+//
2947+// @since 3.17.0
2948+//
2949+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValueEvaluatableExpression
2950+type InlineValueEvaluatableExpression struct {
2951+ // The document range for which the inline value applies.
2952+ // The range is used to extract the evaluatable expression from the underlying document.
2953+ Range Range `json:"range"`
2954+ // If specified the expression overrides the extracted expression.
2955+ Expression string `json:"expression,omitempty"`
2956+}
2957+
2958+// Inline value options used during static registration.
2959+//
2960+// @since 3.17.0
2961+//
2962+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValueOptions
2963+type InlineValueOptions struct {
2964+ WorkDoneProgressOptions
2965+}
2966+
2967+// A parameter literal used in inline value requests.
2968+//
2969+// @since 3.17.0
2970+//
2971+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValueParams
2972+type InlineValueParams struct {
2973+ // The text document.
2974+ TextDocument TextDocumentIdentifier `json:"textDocument"`
2975+ // The document range for which inline values should be computed.
2976+ Range Range `json:"range"`
2977+ // Additional information about the context in which inline values were
2978+ // requested.
2979+ Context InlineValueContext `json:"context"`
2980+ WorkDoneProgressParams
2981+}
2982+
2983+// Inline value options used during static or dynamic registration.
2984+//
2985+// @since 3.17.0
2986+//
2987+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValueRegistrationOptions
2988+type InlineValueRegistrationOptions struct {
2989+ InlineValueOptions
2990+ TextDocumentRegistrationOptions
2991+ StaticRegistrationOptions
2992+}
2993+
2994+// Provide inline value as text.
2995+//
2996+// @since 3.17.0
2997+//
2998+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValueText
2999+type InlineValueText struct {
3000+ // The document range for which the inline value applies.
3001+ Range Range `json:"range"`
3002+ // The text of the inline value.
3003+ Text string `json:"text"`
3004+}
3005+
3006+// Provide inline value through a variable lookup.
3007+// If only a range is specified, the variable name will be extracted from the underlying document.
3008+// An optional variable name can be used to override the extracted name.
3009+//
3010+// @since 3.17.0
3011+//
3012+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValueVariableLookup
3013+type InlineValueVariableLookup struct {
3014+ // The document range for which the inline value applies.
3015+ // The range is used to extract the variable name from the underlying document.
3016+ Range Range `json:"range"`
3017+ // If specified the name of the variable to look up.
3018+ VariableName string `json:"variableName,omitempty"`
3019+ // How to perform the lookup.
3020+ CaseSensitiveLookup bool `json:"caseSensitiveLookup"`
3021+}
3022+
3023+// Client workspace capabilities specific to inline values.
3024+//
3025+// @since 3.17.0
3026+//
3027+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValueWorkspaceClientCapabilities
3028+type InlineValueWorkspaceClientCapabilities struct {
3029+ // Whether the client implementation supports a refresh request sent from the
3030+ // server to the client.
3031+ //
3032+ // Note that this event is global and will force the client to refresh all
3033+ // inline values currently shown. It should be used with absolute care and is
3034+ // useful for situation where a server for example detects a project wide
3035+ // change that requires such a calculation.
3036+ RefreshSupport bool `json:"refreshSupport,omitempty"`
3037+}
3038+
3039+// A special text edit to provide an insert and a replace operation.
3040+//
3041+// @since 3.16.0
3042+//
3043+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#insertReplaceEdit
3044+type InsertReplaceEdit struct {
3045+ // The string to be inserted.
3046+ NewText string `json:"newText"`
3047+ // The range if the insert is requested
3048+ Insert Range `json:"insert"`
3049+ // The range if the replace is requested.
3050+ Replace Range `json:"replace"`
3051+}
3052+
3053+// Defines whether the insert text in a completion item should be interpreted as
3054+// plain text or a snippet.
3055+type InsertTextFormat uint32
3056+
3057+// How whitespace and indentation is handled during completion
3058+// item insertion.
3059+//
3060+// @since 3.16.0
3061+type InsertTextMode uint32
3062+type LSPAny = interface{}
3063+
3064+// LSP arrays.
3065+// @since 3.17.0
3066+//
3067+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#lSPArray
3068+type LSPArray = []interface{} // (alias)
3069+type LSPErrorCodes int32
3070+
3071+// LSP object definition.
3072+// @since 3.17.0
3073+//
3074+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#lSPObject
3075+type LSPObject = map[string]LSPAny // (alias)
3076+// Predefined Language kinds
3077+// @since 3.18.0
3078+// @proposed
3079+type LanguageKind string
3080+
3081+// Client capabilities for the linked editing range request.
3082+//
3083+// @since 3.16.0
3084+//
3085+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#linkedEditingRangeClientCapabilities
3086+type LinkedEditingRangeClientCapabilities struct {
3087+ // Whether implementation supports dynamic registration. If this is set to `true`
3088+ // the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
3089+ // return value for the corresponding server capability as well.
3090+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
3091+}
3092+
3093+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#linkedEditingRangeOptions
3094+type LinkedEditingRangeOptions struct {
3095+ WorkDoneProgressOptions
3096+}
3097+
3098+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#linkedEditingRangeParams
3099+type LinkedEditingRangeParams struct {
3100+ TextDocumentPositionParams
3101+ WorkDoneProgressParams
3102+}
3103+
3104+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#linkedEditingRangeRegistrationOptions
3105+type LinkedEditingRangeRegistrationOptions struct {
3106+ TextDocumentRegistrationOptions
3107+ LinkedEditingRangeOptions
3108+ StaticRegistrationOptions
3109+}
3110+
3111+// The result of a linked editing range request.
3112+//
3113+// @since 3.16.0
3114+//
3115+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#linkedEditingRanges
3116+type LinkedEditingRanges struct {
3117+ // A list of ranges that can be edited together. The ranges must have
3118+ // identical length and contain identical text content. The ranges cannot overlap.
3119+ Ranges []Range `json:"ranges"`
3120+ // An optional word pattern (regular expression) that describes valid contents for
3121+ // the given ranges. If no pattern is provided, the client configuration's word
3122+ // pattern will be used.
3123+ WordPattern string `json:"wordPattern,omitempty"`
3124+}
3125+
3126+// created for Literal (Lit_ClientSemanticTokensRequestOptions_range_Item1)
3127+type Lit_ClientSemanticTokensRequestOptions_range_Item1 struct {
3128+}
3129+
3130+// created for Literal (Lit_SemanticTokensOptions_range_Item1)
3131+type Lit_SemanticTokensOptions_range_Item1 struct {
3132+}
3133+
3134+// Represents a location inside a resource, such as a line
3135+// inside a text file.
3136+//
3137+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#location
3138+type Location struct {
3139+ URI DocumentUri `json:"uri"`
3140+ Range Range `json:"range"`
3141+}
3142+
3143+// Represents the connection of two locations. Provides additional metadata over normal {@link Location locations},
3144+// including an origin range.
3145+//
3146+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#locationLink
3147+type LocationLink struct {
3148+ // Span of the origin of this link.
3149+ //
3150+ // Used as the underlined span for mouse interaction. Defaults to the word range at
3151+ // the definition position.
3152+ OriginSelectionRange *Range `json:"originSelectionRange,omitempty"`
3153+ // The target resource identifier of this link.
3154+ TargetURI DocumentUri `json:"targetUri"`
3155+ // The full target range of this link. If the target for example is a symbol then target range is the
3156+ // range enclosing this symbol not including leading/trailing whitespace but everything else
3157+ // like comments. This information is typically used to highlight the range in the editor.
3158+ TargetRange Range `json:"targetRange"`
3159+ // The range that should be selected and revealed when this link is being followed, e.g the name of a function.
3160+ // Must be contained by the `targetRange`. See also `DocumentSymbol#range`
3161+ TargetSelectionRange Range `json:"targetSelectionRange"`
3162+}
3163+
3164+// Location with only uri and does not include range.
3165+//
3166+// @since 3.18.0
3167+//
3168+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#locationUriOnly
3169+type LocationUriOnly struct {
3170+ URI DocumentUri `json:"uri"`
3171+}
3172+
3173+// The log message parameters.
3174+//
3175+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#logMessageParams
3176+type LogMessageParams struct {
3177+ // The message type. See {@link MessageType}
3178+ Type MessageType `json:"type"`
3179+ // The actual message.
3180+ Message string `json:"message"`
3181+}
3182+
3183+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#logTraceParams
3184+type LogTraceParams struct {
3185+ Message string `json:"message"`
3186+ Verbose string `json:"verbose,omitempty"`
3187+}
3188+
3189+// Client capabilities specific to the used markdown parser.
3190+//
3191+// @since 3.16.0
3192+//
3193+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#markdownClientCapabilities
3194+type MarkdownClientCapabilities struct {
3195+ // The name of the parser.
3196+ Parser string `json:"parser"`
3197+ // The version of the parser.
3198+ Version string `json:"version,omitempty"`
3199+ // A list of HTML tags that the client allows / supports in
3200+ // Markdown.
3201+ //
3202+ // @since 3.17.0
3203+ AllowedTags []string `json:"allowedTags,omitempty"`
3204+}
3205+
3206+// MarkedString can be used to render human readable text. It is either a markdown string
3207+// or a code-block that provides a language and a code snippet. The language identifier
3208+// is semantically equal to the optional language identifier in fenced code blocks in GitHub
3209+// issues. See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting
3210+//
3211+// The pair of a language and a value is an equivalent to markdown:
3212+// ```${language}
3213+// ${value}
3214+// ```
3215+//
3216+// Note that markdown strings will be sanitized - that means html will be escaped.
3217+// @deprecated use MarkupContent instead.
3218+//
3219+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#markedString
3220+type MarkedString = Or_MarkedString // (alias)
3221+// @since 3.18.0
3222+// @deprecated use MarkupContent instead.
3223+//
3224+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#markedStringWithLanguage
3225+type MarkedStringWithLanguage struct {
3226+ Language string `json:"language"`
3227+ Value string `json:"value"`
3228+}
3229+
3230+// A `MarkupContent` literal represents a string value which content is interpreted base on its
3231+// kind flag. Currently the protocol supports `plaintext` and `markdown` as markup kinds.
3232+//
3233+// If the kind is `markdown` then the value can contain fenced code blocks like in GitHub issues.
3234+// See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting
3235+//
3236+// Here is an example how such a string can be constructed using JavaScript / TypeScript:
3237+// ```ts
3238+//
3239+// let markdown: MarkdownContent = {
3240+// kind: MarkupKind.Markdown,
3241+// value: [
3242+// '# Header',
3243+// 'Some text',
3244+// '```typescript',
3245+// 'someCode();',
3246+// '```'
3247+// ].join('\n')
3248+// };
3249+//
3250+// ```
3251+//
3252+// *Please Note* that clients might sanitize the return markdown. A client could decide to
3253+// remove HTML from the markdown to avoid script execution.
3254+//
3255+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#markupContent
3256+type MarkupContent struct {
3257+ // The type of the Markup
3258+ Kind MarkupKind `json:"kind"`
3259+ // The content itself
3260+ Value string `json:"value"`
3261+}
3262+
3263+// Describes the content type that a client supports in various
3264+// result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
3265+//
3266+// Please note that `MarkupKinds` must not start with a `$`. This kinds
3267+// are reserved for internal usage.
3268+type MarkupKind string
3269+
3270+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#messageActionItem
3271+type MessageActionItem struct {
3272+ // A short title like 'Retry', 'Open Log' etc.
3273+ Title string `json:"title"`
3274+}
3275+
3276+// The message type
3277+type MessageType uint32
3278+
3279+// Moniker definition to match LSIF 0.5 moniker definition.
3280+//
3281+// @since 3.16.0
3282+//
3283+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#moniker
3284+type Moniker struct {
3285+ // The scheme of the moniker. For example tsc or .Net
3286+ Scheme string `json:"scheme"`
3287+ // The identifier of the moniker. The value is opaque in LSIF however
3288+ // schema owners are allowed to define the structure if they want.
3289+ Identifier string `json:"identifier"`
3290+ // The scope in which the moniker is unique
3291+ Unique UniquenessLevel `json:"unique"`
3292+ // The moniker kind if known.
3293+ Kind *MonikerKind `json:"kind,omitempty"`
3294+}
3295+
3296+// Client capabilities specific to the moniker request.
3297+//
3298+// @since 3.16.0
3299+//
3300+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#monikerClientCapabilities
3301+type MonikerClientCapabilities struct {
3302+ // Whether moniker supports dynamic registration. If this is set to `true`
3303+ // the client supports the new `MonikerRegistrationOptions` return value
3304+ // for the corresponding server capability as well.
3305+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
3306+}
3307+
3308+// The moniker kind.
3309+//
3310+// @since 3.16.0
3311+type MonikerKind string
3312+
3313+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#monikerOptions
3314+type MonikerOptions struct {
3315+ WorkDoneProgressOptions
3316+}
3317+
3318+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#monikerParams
3319+type MonikerParams struct {
3320+ TextDocumentPositionParams
3321+ WorkDoneProgressParams
3322+ PartialResultParams
3323+}
3324+
3325+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#monikerRegistrationOptions
3326+type MonikerRegistrationOptions struct {
3327+ TextDocumentRegistrationOptions
3328+ MonikerOptions
3329+}
3330+
3331+// A notebook cell.
3332+//
3333+// A cell's document URI must be unique across ALL notebook
3334+// cells and can therefore be used to uniquely identify a
3335+// notebook cell or the cell's text document.
3336+//
3337+// @since 3.17.0
3338+//
3339+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookCell
3340+type NotebookCell struct {
3341+ // The cell's kind
3342+ Kind NotebookCellKind `json:"kind"`
3343+ // The URI of the cell's text document
3344+ // content.
3345+ Document DocumentUri `json:"document"`
3346+ // Additional metadata stored with the cell.
3347+ //
3348+ // Note: should always be an object literal (e.g. LSPObject)
3349+ Metadata *LSPObject `json:"metadata,omitempty"`
3350+ // Additional execution summary information
3351+ // if supported by the client.
3352+ ExecutionSummary *ExecutionSummary `json:"executionSummary,omitempty"`
3353+}
3354+
3355+// A change describing how to move a `NotebookCell`
3356+// array from state S to S'.
3357+//
3358+// @since 3.17.0
3359+//
3360+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookCellArrayChange
3361+type NotebookCellArrayChange struct {
3362+ // The start oftest of the cell that changed.
3363+ Start uint32 `json:"start"`
3364+ // The deleted cells
3365+ DeleteCount uint32 `json:"deleteCount"`
3366+ // The new cells, if any
3367+ Cells []NotebookCell `json:"cells,omitempty"`
3368+}
3369+
3370+// A notebook cell kind.
3371+//
3372+// @since 3.17.0
3373+type NotebookCellKind uint32
3374+
3375+// @since 3.18.0
3376+//
3377+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookCellLanguage
3378+type NotebookCellLanguage struct {
3379+ Language string `json:"language"`
3380+}
3381+
3382+// A notebook cell text document filter denotes a cell text
3383+// document by different properties.
3384+//
3385+// @since 3.17.0
3386+//
3387+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookCellTextDocumentFilter
3388+type NotebookCellTextDocumentFilter struct {
3389+ // A filter that matches against the notebook
3390+ // containing the notebook cell. If a string
3391+ // value is provided it matches against the
3392+ // notebook type. '*' matches every notebook.
3393+ Notebook Or_NotebookCellTextDocumentFilter_notebook `json:"notebook"`
3394+ // A language id like `python`.
3395+ //
3396+ // Will be matched against the language id of the
3397+ // notebook cell document. '*' matches every language.
3398+ Language string `json:"language,omitempty"`
3399+}
3400+
3401+// A notebook document.
3402+//
3403+// @since 3.17.0
3404+//
3405+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocument
3406+type NotebookDocument struct {
3407+ // The notebook document's uri.
3408+ URI URI `json:"uri"`
3409+ // The type of the notebook.
3410+ NotebookType string `json:"notebookType"`
3411+ // The version number of this document (it will increase after each
3412+ // change, including undo/redo).
3413+ Version int32 `json:"version"`
3414+ // Additional metadata stored with the notebook
3415+ // document.
3416+ //
3417+ // Note: should always be an object literal (e.g. LSPObject)
3418+ Metadata *LSPObject `json:"metadata,omitempty"`
3419+ // The cells of a notebook.
3420+ Cells []NotebookCell `json:"cells"`
3421+}
3422+
3423+// Structural changes to cells in a notebook document.
3424+//
3425+// @since 3.18.0
3426+//
3427+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentCellChangeStructure
3428+type NotebookDocumentCellChangeStructure struct {
3429+ // The change to the cell array.
3430+ Array NotebookCellArrayChange `json:"array"`
3431+ // Additional opened cell text documents.
3432+ DidOpen []TextDocumentItem `json:"didOpen,omitempty"`
3433+ // Additional closed cell text documents.
3434+ DidClose []TextDocumentIdentifier `json:"didClose,omitempty"`
3435+}
3436+
3437+// Cell changes to a notebook document.
3438+//
3439+// @since 3.18.0
3440+//
3441+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentCellChanges
3442+type NotebookDocumentCellChanges struct {
3443+ // Changes to the cell structure to add or
3444+ // remove cells.
3445+ Structure *NotebookDocumentCellChangeStructure `json:"structure,omitempty"`
3446+ // Changes to notebook cells properties like its
3447+ // kind, execution summary or metadata.
3448+ Data []NotebookCell `json:"data,omitempty"`
3449+ // Changes to the text content of notebook cells.
3450+ TextContent []NotebookDocumentCellContentChanges `json:"textContent,omitempty"`
3451+}
3452+
3453+// Content changes to a cell in a notebook document.
3454+//
3455+// @since 3.18.0
3456+//
3457+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentCellContentChanges
3458+type NotebookDocumentCellContentChanges struct {
3459+ Document VersionedTextDocumentIdentifier `json:"document"`
3460+ Changes []TextDocumentContentChangeEvent `json:"changes"`
3461+}
3462+
3463+// A change event for a notebook document.
3464+//
3465+// @since 3.17.0
3466+//
3467+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentChangeEvent
3468+type NotebookDocumentChangeEvent struct {
3469+ // The changed meta data if any.
3470+ //
3471+ // Note: should always be an object literal (e.g. LSPObject)
3472+ Metadata *LSPObject `json:"metadata,omitempty"`
3473+ // Changes to cells
3474+ Cells *NotebookDocumentCellChanges `json:"cells,omitempty"`
3475+}
3476+
3477+// Capabilities specific to the notebook document support.
3478+//
3479+// @since 3.17.0
3480+//
3481+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentClientCapabilities
3482+type NotebookDocumentClientCapabilities struct {
3483+ // Capabilities specific to notebook document synchronization
3484+ //
3485+ // @since 3.17.0
3486+ Synchronization NotebookDocumentSyncClientCapabilities `json:"synchronization"`
3487+}
3488+
3489+// A notebook document filter denotes a notebook document by
3490+// different properties. The properties will be match
3491+// against the notebook's URI (same as with documents)
3492+//
3493+// @since 3.17.0
3494+//
3495+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentFilter
3496+type NotebookDocumentFilter = Or_NotebookDocumentFilter // (alias)
3497+// A notebook document filter where `notebookType` is required field.
3498+//
3499+// @since 3.18.0
3500+//
3501+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentFilterNotebookType
3502+type NotebookDocumentFilterNotebookType struct {
3503+ // The type of the enclosing notebook.
3504+ NotebookType string `json:"notebookType"`
3505+ // A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
3506+ Scheme string `json:"scheme,omitempty"`
3507+ // A glob pattern.
3508+ Pattern *GlobPattern `json:"pattern,omitempty"`
3509+}
3510+
3511+// A notebook document filter where `pattern` is required field.
3512+//
3513+// @since 3.18.0
3514+//
3515+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentFilterPattern
3516+type NotebookDocumentFilterPattern struct {
3517+ // The type of the enclosing notebook.
3518+ NotebookType string `json:"notebookType,omitempty"`
3519+ // A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
3520+ Scheme string `json:"scheme,omitempty"`
3521+ // A glob pattern.
3522+ Pattern GlobPattern `json:"pattern"`
3523+}
3524+
3525+// A notebook document filter where `scheme` is required field.
3526+//
3527+// @since 3.18.0
3528+//
3529+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentFilterScheme
3530+type NotebookDocumentFilterScheme struct {
3531+ // The type of the enclosing notebook.
3532+ NotebookType string `json:"notebookType,omitempty"`
3533+ // A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
3534+ Scheme string `json:"scheme"`
3535+ // A glob pattern.
3536+ Pattern *GlobPattern `json:"pattern,omitempty"`
3537+}
3538+
3539+// @since 3.18.0
3540+//
3541+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentFilterWithCells
3542+type NotebookDocumentFilterWithCells struct {
3543+ // The notebook to be synced If a string
3544+ // value is provided it matches against the
3545+ // notebook type. '*' matches every notebook.
3546+ Notebook *Or_NotebookDocumentFilterWithCells_notebook `json:"notebook,omitempty"`
3547+ // The cells of the matching notebook to be synced.
3548+ Cells []NotebookCellLanguage `json:"cells"`
3549+}
3550+
3551+// @since 3.18.0
3552+//
3553+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentFilterWithNotebook
3554+type NotebookDocumentFilterWithNotebook struct {
3555+ // The notebook to be synced If a string
3556+ // value is provided it matches against the
3557+ // notebook type. '*' matches every notebook.
3558+ Notebook Or_NotebookDocumentFilterWithNotebook_notebook `json:"notebook"`
3559+ // The cells of the matching notebook to be synced.
3560+ Cells []NotebookCellLanguage `json:"cells,omitempty"`
3561+}
3562+
3563+// A literal to identify a notebook document in the client.
3564+//
3565+// @since 3.17.0
3566+//
3567+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentIdentifier
3568+type NotebookDocumentIdentifier struct {
3569+ // The notebook document's uri.
3570+ URI URI `json:"uri"`
3571+}
3572+
3573+// Notebook specific client capabilities.
3574+//
3575+// @since 3.17.0
3576+//
3577+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentSyncClientCapabilities
3578+type NotebookDocumentSyncClientCapabilities struct {
3579+ // Whether implementation supports dynamic registration. If this is
3580+ // set to `true` the client supports the new
3581+ // `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
3582+ // return value for the corresponding server capability as well.
3583+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
3584+ // The client supports sending execution summary data per cell.
3585+ ExecutionSummarySupport bool `json:"executionSummarySupport,omitempty"`
3586+}
3587+
3588+// Options specific to a notebook plus its cells
3589+// to be synced to the server.
3590+//
3591+// If a selector provides a notebook document
3592+// filter but no cell selector all cells of a
3593+// matching notebook document will be synced.
3594+//
3595+// If a selector provides no notebook document
3596+// filter but only a cell selector all notebook
3597+// document that contain at least one matching
3598+// cell will be synced.
3599+//
3600+// @since 3.17.0
3601+//
3602+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentSyncOptions
3603+type NotebookDocumentSyncOptions struct {
3604+ // The notebooks to be synced
3605+ NotebookSelector []Or_NotebookDocumentSyncOptions_notebookSelector_Elem `json:"notebookSelector"`
3606+ // Whether save notification should be forwarded to
3607+ // the server. Will only be honored if mode === `notebook`.
3608+ Save bool `json:"save,omitempty"`
3609+}
3610+
3611+// Registration options specific to a notebook.
3612+//
3613+// @since 3.17.0
3614+//
3615+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentSyncRegistrationOptions
3616+type NotebookDocumentSyncRegistrationOptions struct {
3617+ NotebookDocumentSyncOptions
3618+ StaticRegistrationOptions
3619+}
3620+
3621+// A text document identifier to optionally denote a specific version of a text document.
3622+//
3623+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#optionalVersionedTextDocumentIdentifier
3624+type OptionalVersionedTextDocumentIdentifier struct {
3625+ // The version number of this document. If a versioned text document identifier
3626+ // is sent from the server to the client and the file is not open in the editor
3627+ // (the server has not received an open notification before) the server can send
3628+ // `null` to indicate that the version is unknown and the content on disk is the
3629+ // truth (as specified with document content ownership).
3630+ Version int32 `json:"version"`
3631+ TextDocumentIdentifier
3632+}
3633+
3634+// created for Or [int32 string]
3635+type Or_CancelParams_id struct {
3636+ Value interface{} `json:"value"`
3637+}
3638+
3639+// created for Or [ClientSemanticTokensRequestFullDelta bool]
3640+type Or_ClientSemanticTokensRequestOptions_full struct {
3641+ Value interface{} `json:"value"`
3642+}
3643+
3644+// created for Or [Lit_ClientSemanticTokensRequestOptions_range_Item1 bool]
3645+type Or_ClientSemanticTokensRequestOptions_range struct {
3646+ Value interface{} `json:"value"`
3647+}
3648+
3649+// created for Or [EditRangeWithInsertReplace Range]
3650+type Or_CompletionItemDefaults_editRange struct {
3651+ Value interface{} `json:"value"`
3652+}
3653+
3654+// created for Or [MarkupContent string]
3655+type Or_CompletionItem_documentation struct {
3656+ Value interface{} `json:"value"`
3657+}
3658+
3659+// created for Or [InsertReplaceEdit TextEdit]
3660+type Or_CompletionItem_textEdit struct {
3661+ Value interface{} `json:"value"`
3662+}
3663+
3664+// created for Or [Location []Location]
3665+type Or_Declaration struct {
3666+ Value interface{} `json:"value"`
3667+}
3668+
3669+// created for Or [Location []Location]
3670+type Or_Definition struct {
3671+ Value interface{} `json:"value"`
3672+}
3673+
3674+// created for Or [int32 string]
3675+type Or_Diagnostic_code struct {
3676+ Value interface{} `json:"value"`
3677+}
3678+
3679+// created for Or [[]string string]
3680+type Or_DidChangeConfigurationRegistrationOptions_section struct {
3681+ Value interface{} `json:"value"`
3682+}
3683+
3684+// created for Or [RelatedFullDocumentDiagnosticReport RelatedUnchangedDocumentDiagnosticReport]
3685+type Or_DocumentDiagnosticReport struct {
3686+ Value interface{} `json:"value"`
3687+}
3688+
3689+// created for Or [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]
3690+type Or_DocumentDiagnosticReportPartialResult_relatedDocuments_Value struct {
3691+ Value interface{} `json:"value"`
3692+}
3693+
3694+// created for Or [NotebookCellTextDocumentFilter TextDocumentFilter]
3695+type Or_DocumentFilter struct {
3696+ Value interface{} `json:"value"`
3697+}
3698+
3699+// created for Or [Pattern RelativePattern]
3700+type Or_GlobPattern struct {
3701+ Value interface{} `json:"value"`
3702+}
3703+
3704+// created for Or [MarkedString MarkupContent []MarkedString]
3705+type Or_Hover_contents struct {
3706+ Value interface{} `json:"value"`
3707+}
3708+
3709+// created for Or [MarkupContent string]
3710+type Or_InlayHintLabelPart_tooltip struct {
3711+ Value interface{} `json:"value"`
3712+}
3713+
3714+// created for Or [[]InlayHintLabelPart string]
3715+type Or_InlayHint_label struct {
3716+ Value interface{} `json:"value"`
3717+}
3718+
3719+// created for Or [MarkupContent string]
3720+type Or_InlayHint_tooltip struct {
3721+ Value interface{} `json:"value"`
3722+}
3723+
3724+// created for Or [StringValue string]
3725+type Or_InlineCompletionItem_insertText struct {
3726+ Value interface{} `json:"value"`
3727+}
3728+
3729+// created for Or [InlineValueEvaluatableExpression InlineValueText InlineValueVariableLookup]
3730+type Or_InlineValue struct {
3731+ Value interface{} `json:"value"`
3732+}
3733+
3734+// created for Or [LSPArray LSPObject bool float64 int32 string uint32]
3735+type Or_LSPAny struct {
3736+ Value interface{} `json:"value"`
3737+}
3738+
3739+// created for Or [MarkedStringWithLanguage string]
3740+type Or_MarkedString struct {
3741+ Value interface{} `json:"value"`
3742+}
3743+
3744+// created for Or [NotebookDocumentFilter string]
3745+type Or_NotebookCellTextDocumentFilter_notebook struct {
3746+ Value interface{} `json:"value"`
3747+}
3748+
3749+// created for Or [NotebookDocumentFilterNotebookType NotebookDocumentFilterPattern NotebookDocumentFilterScheme]
3750+type Or_NotebookDocumentFilter struct {
3751+ Value interface{} `json:"value"`
3752+}
3753+
3754+// created for Or [NotebookDocumentFilter string]
3755+type Or_NotebookDocumentFilterWithCells_notebook struct {
3756+ Value interface{} `json:"value"`
3757+}
3758+
3759+// created for Or [NotebookDocumentFilter string]
3760+type Or_NotebookDocumentFilterWithNotebook_notebook struct {
3761+ Value interface{} `json:"value"`
3762+}
3763+
3764+// created for Or [NotebookDocumentFilterWithCells NotebookDocumentFilterWithNotebook]
3765+type Or_NotebookDocumentSyncOptions_notebookSelector_Elem struct {
3766+ Value interface{} `json:"value"`
3767+}
3768+
3769+// created for Or [MarkupContent string]
3770+type Or_ParameterInformation_documentation struct {
3771+ Value interface{} `json:"value"`
3772+}
3773+
3774+// created for Or [Tuple_ParameterInformation_label_Item1 string]
3775+type Or_ParameterInformation_label struct {
3776+ Value interface{} `json:"value"`
3777+}
3778+
3779+// created for Or [PrepareRenameDefaultBehavior PrepareRenamePlaceholder Range]
3780+type Or_PrepareRenameResult struct {
3781+ Value interface{} `json:"value"`
3782+}
3783+
3784+// created for Or [int32 string]
3785+type Or_ProgressToken struct {
3786+ Value interface{} `json:"value"`
3787+}
3788+
3789+// created for Or [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]
3790+type Or_RelatedFullDocumentDiagnosticReport_relatedDocuments_Value struct {
3791+ Value interface{} `json:"value"`
3792+}
3793+
3794+// created for Or [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]
3795+type Or_RelatedUnchangedDocumentDiagnosticReport_relatedDocuments_Value struct {
3796+ Value interface{} `json:"value"`
3797+}
3798+
3799+// created for Or [URI WorkspaceFolder]
3800+type Or_RelativePattern_baseUri struct {
3801+ Value interface{} `json:"value"`
3802+}
3803+
3804+// created for Or [CodeAction Command]
3805+type Or_Result_textDocument_codeAction_Item0_Elem struct {
3806+ Value interface{} `json:"value"`
3807+}
3808+
3809+// created for Or [CompletionList []CompletionItem]
3810+type Or_Result_textDocument_completion struct {
3811+ Value interface{} `json:"value"`
3812+}
3813+
3814+// created for Or [Declaration []DeclarationLink]
3815+type Or_Result_textDocument_declaration struct {
3816+ Value interface{} `json:"value"`
3817+}
3818+
3819+// created for Or [Definition []DefinitionLink]
3820+type Or_Result_textDocument_definition struct {
3821+ Value interface{} `json:"value"`
3822+}
3823+
3824+// created for Or [[]DocumentSymbol []SymbolInformation]
3825+type Or_Result_textDocument_documentSymbol struct {
3826+ Value interface{} `json:"value"`
3827+}
3828+
3829+// created for Or [Definition []DefinitionLink]
3830+type Or_Result_textDocument_implementation struct {
3831+ Value interface{} `json:"value"`
3832+}
3833+
3834+// created for Or [InlineCompletionList []InlineCompletionItem]
3835+type Or_Result_textDocument_inlineCompletion struct {
3836+ Value interface{} `json:"value"`
3837+}
3838+
3839+// created for Or [SemanticTokens SemanticTokensDelta]
3840+type Or_Result_textDocument_semanticTokens_full_delta struct {
3841+ Value interface{} `json:"value"`
3842+}
3843+
3844+// created for Or [Definition []DefinitionLink]
3845+type Or_Result_textDocument_typeDefinition struct {
3846+ Value interface{} `json:"value"`
3847+}
3848+
3849+// created for Or [[]SymbolInformation []WorkspaceSymbol]
3850+type Or_Result_workspace_symbol struct {
3851+ Value interface{} `json:"value"`
3852+}
3853+
3854+// created for Or [SemanticTokensFullDelta bool]
3855+type Or_SemanticTokensOptions_full struct {
3856+ Value interface{} `json:"value"`
3857+}
3858+
3859+// created for Or [Lit_SemanticTokensOptions_range_Item1 bool]
3860+type Or_SemanticTokensOptions_range struct {
3861+ Value interface{} `json:"value"`
3862+}
3863+
3864+// created for Or [CallHierarchyOptions CallHierarchyRegistrationOptions bool]
3865+type Or_ServerCapabilities_callHierarchyProvider struct {
3866+ Value interface{} `json:"value"`
3867+}
3868+
3869+// created for Or [CodeActionOptions bool]
3870+type Or_ServerCapabilities_codeActionProvider struct {
3871+ Value interface{} `json:"value"`
3872+}
3873+
3874+// created for Or [DocumentColorOptions DocumentColorRegistrationOptions bool]
3875+type Or_ServerCapabilities_colorProvider struct {
3876+ Value interface{} `json:"value"`
3877+}
3878+
3879+// created for Or [DeclarationOptions DeclarationRegistrationOptions bool]
3880+type Or_ServerCapabilities_declarationProvider struct {
3881+ Value interface{} `json:"value"`
3882+}
3883+
3884+// created for Or [DefinitionOptions bool]
3885+type Or_ServerCapabilities_definitionProvider struct {
3886+ Value interface{} `json:"value"`
3887+}
3888+
3889+// created for Or [DiagnosticOptions DiagnosticRegistrationOptions]
3890+type Or_ServerCapabilities_diagnosticProvider struct {
3891+ Value interface{} `json:"value"`
3892+}
3893+
3894+// created for Or [DocumentFormattingOptions bool]
3895+type Or_ServerCapabilities_documentFormattingProvider struct {
3896+ Value interface{} `json:"value"`
3897+}
3898+
3899+// created for Or [DocumentHighlightOptions bool]
3900+type Or_ServerCapabilities_documentHighlightProvider struct {
3901+ Value interface{} `json:"value"`
3902+}
3903+
3904+// created for Or [DocumentRangeFormattingOptions bool]
3905+type Or_ServerCapabilities_documentRangeFormattingProvider struct {
3906+ Value interface{} `json:"value"`
3907+}
3908+
3909+// created for Or [DocumentSymbolOptions bool]
3910+type Or_ServerCapabilities_documentSymbolProvider struct {
3911+ Value interface{} `json:"value"`
3912+}
3913+
3914+// created for Or [FoldingRangeOptions FoldingRangeRegistrationOptions bool]
3915+type Or_ServerCapabilities_foldingRangeProvider struct {
3916+ Value interface{} `json:"value"`
3917+}
3918+
3919+// created for Or [HoverOptions bool]
3920+type Or_ServerCapabilities_hoverProvider struct {
3921+ Value interface{} `json:"value"`
3922+}
3923+
3924+// created for Or [ImplementationOptions ImplementationRegistrationOptions bool]
3925+type Or_ServerCapabilities_implementationProvider struct {
3926+ Value interface{} `json:"value"`
3927+}
3928+
3929+// created for Or [InlayHintOptions InlayHintRegistrationOptions bool]
3930+type Or_ServerCapabilities_inlayHintProvider struct {
3931+ Value interface{} `json:"value"`
3932+}
3933+
3934+// created for Or [InlineCompletionOptions bool]
3935+type Or_ServerCapabilities_inlineCompletionProvider struct {
3936+ Value interface{} `json:"value"`
3937+}
3938+
3939+// created for Or [InlineValueOptions InlineValueRegistrationOptions bool]
3940+type Or_ServerCapabilities_inlineValueProvider struct {
3941+ Value interface{} `json:"value"`
3942+}
3943+
3944+// created for Or [LinkedEditingRangeOptions LinkedEditingRangeRegistrationOptions bool]
3945+type Or_ServerCapabilities_linkedEditingRangeProvider struct {
3946+ Value interface{} `json:"value"`
3947+}
3948+
3949+// created for Or [MonikerOptions MonikerRegistrationOptions bool]
3950+type Or_ServerCapabilities_monikerProvider struct {
3951+ Value interface{} `json:"value"`
3952+}
3953+
3954+// created for Or [NotebookDocumentSyncOptions NotebookDocumentSyncRegistrationOptions]
3955+type Or_ServerCapabilities_notebookDocumentSync struct {
3956+ Value interface{} `json:"value"`
3957+}
3958+
3959+// created for Or [ReferenceOptions bool]
3960+type Or_ServerCapabilities_referencesProvider struct {
3961+ Value interface{} `json:"value"`
3962+}
3963+
3964+// created for Or [RenameOptions bool]
3965+type Or_ServerCapabilities_renameProvider struct {
3966+ Value interface{} `json:"value"`
3967+}
3968+
3969+// created for Or [SelectionRangeOptions SelectionRangeRegistrationOptions bool]
3970+type Or_ServerCapabilities_selectionRangeProvider struct {
3971+ Value interface{} `json:"value"`
3972+}
3973+
3974+// created for Or [SemanticTokensOptions SemanticTokensRegistrationOptions]
3975+type Or_ServerCapabilities_semanticTokensProvider struct {
3976+ Value interface{} `json:"value"`
3977+}
3978+
3979+// created for Or [TextDocumentSyncKind TextDocumentSyncOptions]
3980+type Or_ServerCapabilities_textDocumentSync struct {
3981+ Value interface{} `json:"value"`
3982+}
3983+
3984+// created for Or [TypeDefinitionOptions TypeDefinitionRegistrationOptions bool]
3985+type Or_ServerCapabilities_typeDefinitionProvider struct {
3986+ Value interface{} `json:"value"`
3987+}
3988+
3989+// created for Or [TypeHierarchyOptions TypeHierarchyRegistrationOptions bool]
3990+type Or_ServerCapabilities_typeHierarchyProvider struct {
3991+ Value interface{} `json:"value"`
3992+}
3993+
3994+// created for Or [WorkspaceSymbolOptions bool]
3995+type Or_ServerCapabilities_workspaceSymbolProvider struct {
3996+ Value interface{} `json:"value"`
3997+}
3998+
3999+// created for Or [MarkupContent string]
4000+type Or_SignatureInformation_documentation struct {
4001+ Value interface{} `json:"value"`
4002+}
4003+
4004+// created for Or [TextDocumentContentChangePartial TextDocumentContentChangeWholeDocument]
4005+type Or_TextDocumentContentChangeEvent struct {
4006+ Value interface{} `json:"value"`
4007+}
4008+
4009+// created for Or [AnnotatedTextEdit SnippetTextEdit TextEdit]
4010+type Or_TextDocumentEdit_edits_Elem struct {
4011+ Value interface{} `json:"value"`
4012+}
4013+
4014+// created for Or [TextDocumentFilterLanguage TextDocumentFilterPattern TextDocumentFilterScheme]
4015+type Or_TextDocumentFilter struct {
4016+ Value interface{} `json:"value"`
4017+}
4018+
4019+// created for Or [SaveOptions bool]
4020+type Or_TextDocumentSyncOptions_save struct {
4021+ Value interface{} `json:"value"`
4022+}
4023+
4024+// created for Or [WorkspaceFullDocumentDiagnosticReport WorkspaceUnchangedDocumentDiagnosticReport]
4025+type Or_WorkspaceDocumentDiagnosticReport struct {
4026+ Value interface{} `json:"value"`
4027+}
4028+
4029+// created for Or [CreateFile DeleteFile RenameFile TextDocumentEdit]
4030+type Or_WorkspaceEdit_documentChanges_Elem struct {
4031+ Value interface{} `json:"value"`
4032+}
4033+
4034+// created for Or [bool string]
4035+type Or_WorkspaceFoldersServerCapabilities_changeNotifications struct {
4036+ Value interface{} `json:"value"`
4037+}
4038+
4039+// created for Or [TextDocumentContentOptions TextDocumentContentRegistrationOptions]
4040+type Or_WorkspaceOptions_textDocumentContent struct {
4041+ Value interface{} `json:"value"`
4042+}
4043+
4044+// created for Or [Location LocationUriOnly]
4045+type Or_WorkspaceSymbol_location struct {
4046+ Value interface{} `json:"value"`
4047+}
4048+
4049+// The parameters of a configuration request.
4050+//
4051+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#configurationParams
4052+type ParamConfiguration struct {
4053+ Items []ConfigurationItem `json:"items"`
4054+}
4055+
4056+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#initializeParams
4057+type ParamInitialize struct {
4058+ XInitializeParams
4059+ WorkspaceFoldersInitializeParams
4060+}
4061+
4062+// Represents a parameter of a callable-signature. A parameter can
4063+// have a label and a doc-comment.
4064+//
4065+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#parameterInformation
4066+type ParameterInformation struct {
4067+ // The label of this parameter information.
4068+ //
4069+ // Either a string or an inclusive start and exclusive end offsets within its containing
4070+ // signature label. (see SignatureInformation.label). The offsets are based on a UTF-16
4071+ // string representation as `Position` and `Range` does.
4072+ //
4073+ // To avoid ambiguities a server should use the [start, end] offset value instead of using
4074+ // a substring. Whether a client support this is controlled via `labelOffsetSupport` client
4075+ // capability.
4076+ //
4077+ // *Note*: a label of type string should be a substring of its containing signature label.
4078+ // Its intended use case is to highlight the parameter label part in the `SignatureInformation.label`.
4079+ Label Or_ParameterInformation_label `json:"label"`
4080+ // The human-readable doc-comment of this parameter. Will be shown
4081+ // in the UI but can be omitted.
4082+ Documentation *Or_ParameterInformation_documentation `json:"documentation,omitempty"`
4083+}
4084+
4085+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#partialResultParams
4086+type PartialResultParams struct {
4087+ // An optional token that a server can use to report partial results (e.g. streaming) to
4088+ // the client.
4089+ PartialResultToken *ProgressToken `json:"partialResultToken,omitempty"`
4090+}
4091+
4092+// The glob pattern to watch relative to the base path. Glob patterns can have the following syntax:
4093+//
4094+// - `*` to match one or more characters in a path segment
4095+// - `?` to match on one character in a path segment
4096+// - `**` to match any number of path segments, including none
4097+// - `{}` to group conditions (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files)
4098+// - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …)
4099+// - `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`)
4100+//
4101+// @since 3.17.0
4102+//
4103+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#pattern
4104+type Pattern = string // (alias)
4105+// Position in a text document expressed as zero-based line and character
4106+// offset. Prior to 3.17 the offsets were always based on a UTF-16 string
4107+// representation. So a string of the form `a𐐀b` the character offset of the
4108+// character `a` is 0, the character offset of `𐐀` is 1 and the character
4109+// offset of b is 3 since `𐐀` is represented using two code units in UTF-16.
4110+// Since 3.17 clients and servers can agree on a different string encoding
4111+// representation (e.g. UTF-8). The client announces it's supported encoding
4112+// via the client capability [`general.positionEncodings`](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#clientCapabilities).
4113+// The value is an array of position encodings the client supports, with
4114+// decreasing preference (e.g. the encoding at index `0` is the most preferred
4115+// one). To stay backwards compatible the only mandatory encoding is UTF-16
4116+// represented via the string `utf-16`. The server can pick one of the
4117+// encodings offered by the client and signals that encoding back to the
4118+// client via the initialize result's property
4119+// [`capabilities.positionEncoding`](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#serverCapabilities). If the string value
4120+// `utf-16` is missing from the client's capability `general.positionEncodings`
4121+// servers can safely assume that the client supports UTF-16. If the server
4122+// omits the position encoding in its initialize result the encoding defaults
4123+// to the string value `utf-16`. Implementation considerations: since the
4124+// conversion from one encoding into another requires the content of the
4125+// file / line the conversion is best done where the file is read which is
4126+// usually on the server side.
4127+//
4128+// Positions are line end character agnostic. So you can not specify a position
4129+// that denotes `\r|\n` or `\n|` where `|` represents the character offset.
4130+//
4131+// @since 3.17.0 - support for negotiated position encoding.
4132+//
4133+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#position
4134+type Position struct {
4135+ // Line position in a document (zero-based).
4136+ //
4137+ // If a line number is greater than the number of lines in a document, it defaults back to the number of lines in the document.
4138+ // If a line number is negative, it defaults to 0.
4139+ Line uint32 `json:"line"`
4140+ // Character offset on a line in a document (zero-based).
4141+ //
4142+ // The meaning of this offset is determined by the negotiated
4143+ // `PositionEncodingKind`.
4144+ //
4145+ // If the character value is greater than the line length it defaults back to the
4146+ // line length.
4147+ Character uint32 `json:"character"`
4148+}
4149+
4150+// A set of predefined position encoding kinds.
4151+//
4152+// @since 3.17.0
4153+type PositionEncodingKind string
4154+
4155+// @since 3.18.0
4156+//
4157+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#prepareRenameDefaultBehavior
4158+type PrepareRenameDefaultBehavior struct {
4159+ DefaultBehavior bool `json:"defaultBehavior"`
4160+}
4161+
4162+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#prepareRenameParams
4163+type PrepareRenameParams struct {
4164+ TextDocumentPositionParams
4165+ WorkDoneProgressParams
4166+}
4167+
4168+// @since 3.18.0
4169+//
4170+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#prepareRenamePlaceholder
4171+type PrepareRenamePlaceholder struct {
4172+ Range Range `json:"range"`
4173+ Placeholder string `json:"placeholder"`
4174+}
4175+
4176+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#prepareRenameResult
4177+type PrepareRenameResult = Or_PrepareRenameResult // (alias)
4178+type PrepareSupportDefaultBehavior uint32
4179+
4180+// A previous result id in a workspace pull request.
4181+//
4182+// @since 3.17.0
4183+//
4184+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#previousResultId
4185+type PreviousResultID struct {
4186+ // The URI for which the client knowns a
4187+ // result id.
4188+ URI DocumentUri `json:"uri"`
4189+ // The value of the previous result id.
4190+ Value string `json:"value"`
4191+}
4192+
4193+// A previous result id in a workspace pull request.
4194+//
4195+// @since 3.17.0
4196+//
4197+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#previousResultId
4198+type PreviousResultId struct {
4199+ // The URI for which the client knowns a
4200+ // result id.
4201+ URI DocumentUri `json:"uri"`
4202+ // The value of the previous result id.
4203+ Value string `json:"value"`
4204+}
4205+
4206+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#progressParams
4207+type ProgressParams struct {
4208+ // The progress token provided by the client or server.
4209+ Token ProgressToken `json:"token"`
4210+ // The progress data.
4211+ Value interface{} `json:"value"`
4212+}
4213+
4214+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#progressToken
4215+type ProgressToken = Or_ProgressToken // (alias)
4216+// The publish diagnostic client capabilities.
4217+//
4218+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#publishDiagnosticsClientCapabilities
4219+type PublishDiagnosticsClientCapabilities struct {
4220+ // Whether the client interprets the version property of the
4221+ // `textDocument/publishDiagnostics` notification's parameter.
4222+ //
4223+ // @since 3.15.0
4224+ VersionSupport bool `json:"versionSupport,omitempty"`
4225+ DiagnosticsCapabilities
4226+}
4227+
4228+// The publish diagnostic notification's parameters.
4229+//
4230+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#publishDiagnosticsParams
4231+type PublishDiagnosticsParams struct {
4232+ // The URI for which diagnostic information is reported.
4233+ URI DocumentUri `json:"uri"`
4234+ // Optional the version number of the document the diagnostics are published for.
4235+ //
4236+ // @since 3.15.0
4237+ Version int32 `json:"version,omitempty"`
4238+ // An array of diagnostic information items.
4239+ Diagnostics []Diagnostic `json:"diagnostics"`
4240+}
4241+
4242+// A range in a text document expressed as (zero-based) start and end positions.
4243+//
4244+// If you want to specify a range that contains a line including the line ending
4245+// character(s) then use an end position denoting the start of the next line.
4246+// For example:
4247+// ```ts
4248+//
4249+// {
4250+// start: { line: 5, character: 23 }
4251+// end : { line 6, character : 0 }
4252+// }
4253+//
4254+// ```
4255+//
4256+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#range
4257+type Range struct {
4258+ // The range's start position.
4259+ Start Position `json:"start"`
4260+ // The range's end position.
4261+ End Position `json:"end"`
4262+}
4263+
4264+// Client Capabilities for a {@link ReferencesRequest}.
4265+//
4266+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#referenceClientCapabilities
4267+type ReferenceClientCapabilities struct {
4268+ // Whether references supports dynamic registration.
4269+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
4270+}
4271+
4272+// Value-object that contains additional information when
4273+// requesting references.
4274+//
4275+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#referenceContext
4276+type ReferenceContext struct {
4277+ // Include the declaration of the current symbol.
4278+ IncludeDeclaration bool `json:"includeDeclaration"`
4279+}
4280+
4281+// Reference options.
4282+//
4283+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#referenceOptions
4284+type ReferenceOptions struct {
4285+ WorkDoneProgressOptions
4286+}
4287+
4288+// Parameters for a {@link ReferencesRequest}.
4289+//
4290+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#referenceParams
4291+type ReferenceParams struct {
4292+ Context ReferenceContext `json:"context"`
4293+ TextDocumentPositionParams
4294+ WorkDoneProgressParams
4295+ PartialResultParams
4296+}
4297+
4298+// Registration options for a {@link ReferencesRequest}.
4299+//
4300+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#referenceRegistrationOptions
4301+type ReferenceRegistrationOptions struct {
4302+ TextDocumentRegistrationOptions
4303+ ReferenceOptions
4304+}
4305+
4306+// General parameters to register for a notification or to register a provider.
4307+//
4308+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#registration
4309+type Registration struct {
4310+ // The id used to register the request. The id can be used to deregister
4311+ // the request again.
4312+ ID string `json:"id"`
4313+ // The method / capability to register for.
4314+ Method string `json:"method"`
4315+ // Options necessary for the registration.
4316+ RegisterOptions interface{} `json:"registerOptions,omitempty"`
4317+}
4318+
4319+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#registrationParams
4320+type RegistrationParams struct {
4321+ Registrations []Registration `json:"registrations"`
4322+}
4323+
4324+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#regularExpressionEngineKind
4325+type RegularExpressionEngineKind = string // (alias)
4326+// Client capabilities specific to regular expressions.
4327+//
4328+// @since 3.16.0
4329+//
4330+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#regularExpressionsClientCapabilities
4331+type RegularExpressionsClientCapabilities struct {
4332+ // The engine's name.
4333+ Engine RegularExpressionEngineKind `json:"engine"`
4334+ // The engine's version.
4335+ Version string `json:"version,omitempty"`
4336+}
4337+
4338+// A full diagnostic report with a set of related documents.
4339+//
4340+// @since 3.17.0
4341+//
4342+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#relatedFullDocumentDiagnosticReport
4343+type RelatedFullDocumentDiagnosticReport struct {
4344+ // Diagnostics of related documents. This information is useful
4345+ // in programming languages where code in a file A can generate
4346+ // diagnostics in a file B which A depends on. An example of
4347+ // such a language is C/C++ where marco definitions in a file
4348+ // a.cpp and result in errors in a header file b.hpp.
4349+ //
4350+ // @since 3.17.0
4351+ RelatedDocuments map[DocumentUri]interface{} `json:"relatedDocuments,omitempty"`
4352+ FullDocumentDiagnosticReport
4353+}
4354+
4355+// An unchanged diagnostic report with a set of related documents.
4356+//
4357+// @since 3.17.0
4358+//
4359+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#relatedUnchangedDocumentDiagnosticReport
4360+type RelatedUnchangedDocumentDiagnosticReport struct {
4361+ // Diagnostics of related documents. This information is useful
4362+ // in programming languages where code in a file A can generate
4363+ // diagnostics in a file B which A depends on. An example of
4364+ // such a language is C/C++ where marco definitions in a file
4365+ // a.cpp and result in errors in a header file b.hpp.
4366+ //
4367+ // @since 3.17.0
4368+ RelatedDocuments map[DocumentUri]interface{} `json:"relatedDocuments,omitempty"`
4369+ UnchangedDocumentDiagnosticReport
4370+}
4371+
4372+// A relative pattern is a helper to construct glob patterns that are matched
4373+// relatively to a base URI. The common value for a `baseUri` is a workspace
4374+// folder root, but it can be another absolute URI as well.
4375+//
4376+// @since 3.17.0
4377+//
4378+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#relativePattern
4379+type RelativePattern struct {
4380+ // A workspace folder or a base URI to which this pattern will be matched
4381+ // against relatively.
4382+ BaseURI Or_RelativePattern_baseUri `json:"baseUri"`
4383+ // The actual glob pattern;
4384+ Pattern Pattern `json:"pattern"`
4385+}
4386+
4387+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#renameClientCapabilities
4388+type RenameClientCapabilities struct {
4389+ // Whether rename supports dynamic registration.
4390+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
4391+ // Client supports testing for validity of rename operations
4392+ // before execution.
4393+ //
4394+ // @since 3.12.0
4395+ PrepareSupport bool `json:"prepareSupport,omitempty"`
4396+ // Client supports the default behavior result.
4397+ //
4398+ // The value indicates the default behavior used by the
4399+ // client.
4400+ //
4401+ // @since 3.16.0
4402+ PrepareSupportDefaultBehavior *PrepareSupportDefaultBehavior `json:"prepareSupportDefaultBehavior,omitempty"`
4403+ // Whether the client honors the change annotations in
4404+ // text edits and resource operations returned via the
4405+ // rename request's workspace edit by for example presenting
4406+ // the workspace edit in the user interface and asking
4407+ // for confirmation.
4408+ //
4409+ // @since 3.16.0
4410+ HonorsChangeAnnotations bool `json:"honorsChangeAnnotations,omitempty"`
4411+}
4412+
4413+// Rename file operation
4414+//
4415+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#renameFile
4416+type RenameFile struct {
4417+ // A rename
4418+ Kind string `json:"kind"`
4419+ // The old (existing) location.
4420+ OldURI DocumentUri `json:"oldUri"`
4421+ // The new location.
4422+ NewURI DocumentUri `json:"newUri"`
4423+ // Rename options.
4424+ Options *RenameFileOptions `json:"options,omitempty"`
4425+ ResourceOperation
4426+}
4427+
4428+// Rename file options
4429+//
4430+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#renameFileOptions
4431+type RenameFileOptions struct {
4432+ // Overwrite target if existing. Overwrite wins over `ignoreIfExists`
4433+ Overwrite bool `json:"overwrite,omitempty"`
4434+ // Ignores if target exists.
4435+ IgnoreIfExists bool `json:"ignoreIfExists,omitempty"`
4436+}
4437+
4438+// The parameters sent in notifications/requests for user-initiated renames of
4439+// files.
4440+//
4441+// @since 3.16.0
4442+//
4443+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#renameFilesParams
4444+type RenameFilesParams struct {
4445+ // An array of all files/folders renamed in this operation. When a folder is renamed, only
4446+ // the folder will be included, and not its children.
4447+ Files []FileRename `json:"files"`
4448+}
4449+
4450+// Provider options for a {@link RenameRequest}.
4451+//
4452+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#renameOptions
4453+type RenameOptions struct {
4454+ // Renames should be checked and tested before being executed.
4455+ //
4456+ // @since version 3.12.0
4457+ PrepareProvider bool `json:"prepareProvider,omitempty"`
4458+ WorkDoneProgressOptions
4459+}
4460+
4461+// The parameters of a {@link RenameRequest}.
4462+//
4463+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#renameParams
4464+type RenameParams struct {
4465+ // The document to rename.
4466+ TextDocument TextDocumentIdentifier `json:"textDocument"`
4467+ // The position at which this request was sent.
4468+ Position Position `json:"position"`
4469+ // The new name of the symbol. If the given name is not valid the
4470+ // request must return a {@link ResponseError} with an
4471+ // appropriate message set.
4472+ NewName string `json:"newName"`
4473+ WorkDoneProgressParams
4474+}
4475+
4476+// Registration options for a {@link RenameRequest}.
4477+//
4478+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#renameRegistrationOptions
4479+type RenameRegistrationOptions struct {
4480+ TextDocumentRegistrationOptions
4481+ RenameOptions
4482+}
4483+
4484+// A generic resource operation.
4485+//
4486+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#resourceOperation
4487+type ResourceOperation struct {
4488+ // The resource operation kind.
4489+ Kind string `json:"kind"`
4490+ // An optional annotation identifier describing the operation.
4491+ //
4492+ // @since 3.16.0
4493+ AnnotationID *ChangeAnnotationIdentifier `json:"annotationId,omitempty"`
4494+}
4495+type ResourceOperationKind string
4496+
4497+// Save options.
4498+//
4499+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#saveOptions
4500+type SaveOptions struct {
4501+ // The client is supposed to include the content on save.
4502+ IncludeText bool `json:"includeText,omitempty"`
4503+}
4504+
4505+// Describes the currently selected completion item.
4506+//
4507+// @since 3.18.0
4508+// @proposed
4509+//
4510+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#selectedCompletionInfo
4511+type SelectedCompletionInfo struct {
4512+ // The range that will be replaced if this completion item is accepted.
4513+ Range Range `json:"range"`
4514+ // The text the range will be replaced with if this completion is accepted.
4515+ Text string `json:"text"`
4516+}
4517+
4518+// A selection range represents a part of a selection hierarchy. A selection range
4519+// may have a parent selection range that contains it.
4520+//
4521+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#selectionRange
4522+type SelectionRange struct {
4523+ // The {@link Range range} of this selection range.
4524+ Range Range `json:"range"`
4525+ // The parent selection range containing this range. Therefore `parent.range` must contain `this.range`.
4526+ Parent *SelectionRange `json:"parent,omitempty"`
4527+}
4528+
4529+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#selectionRangeClientCapabilities
4530+type SelectionRangeClientCapabilities struct {
4531+ // Whether implementation supports dynamic registration for selection range providers. If this is set to `true`
4532+ // the client supports the new `SelectionRangeRegistrationOptions` return value for the corresponding server
4533+ // capability as well.
4534+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
4535+}
4536+
4537+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#selectionRangeOptions
4538+type SelectionRangeOptions struct {
4539+ WorkDoneProgressOptions
4540+}
4541+
4542+// A parameter literal used in selection range requests.
4543+//
4544+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#selectionRangeParams
4545+type SelectionRangeParams struct {
4546+ // The text document.
4547+ TextDocument TextDocumentIdentifier `json:"textDocument"`
4548+ // The positions inside the text document.
4549+ Positions []Position `json:"positions"`
4550+ WorkDoneProgressParams
4551+ PartialResultParams
4552+}
4553+
4554+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#selectionRangeRegistrationOptions
4555+type SelectionRangeRegistrationOptions struct {
4556+ SelectionRangeOptions
4557+ TextDocumentRegistrationOptions
4558+ StaticRegistrationOptions
4559+}
4560+
4561+// A set of predefined token modifiers. This set is not fixed
4562+// an clients can specify additional token types via the
4563+// corresponding client capabilities.
4564+//
4565+// @since 3.16.0
4566+type SemanticTokenModifiers string
4567+
4568+// A set of predefined token types. This set is not fixed
4569+// an clients can specify additional token types via the
4570+// corresponding client capabilities.
4571+//
4572+// @since 3.16.0
4573+type SemanticTokenTypes string
4574+
4575+// @since 3.16.0
4576+//
4577+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokens
4578+type SemanticTokens struct {
4579+ // An optional result id. If provided and clients support delta updating
4580+ // the client will include the result id in the next semantic token request.
4581+ // A server can then instead of computing all semantic tokens again simply
4582+ // send a delta.
4583+ ResultID string `json:"resultId,omitempty"`
4584+ // The actual tokens.
4585+ Data []uint32 `json:"data"`
4586+}
4587+
4588+// @since 3.16.0
4589+//
4590+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensClientCapabilities
4591+type SemanticTokensClientCapabilities struct {
4592+ // Whether implementation supports dynamic registration. If this is set to `true`
4593+ // the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
4594+ // return value for the corresponding server capability as well.
4595+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
4596+ // Which requests the client supports and might send to the server
4597+ // depending on the server's capability. Please note that clients might not
4598+ // show semantic tokens or degrade some of the user experience if a range
4599+ // or full request is advertised by the client but not provided by the
4600+ // server. If for example the client capability `requests.full` and
4601+ // `request.range` are both set to true but the server only provides a
4602+ // range provider the client might not render a minimap correctly or might
4603+ // even decide to not show any semantic tokens at all.
4604+ Requests ClientSemanticTokensRequestOptions `json:"requests"`
4605+ // The token types that the client supports.
4606+ TokenTypes []string `json:"tokenTypes"`
4607+ // The token modifiers that the client supports.
4608+ TokenModifiers []string `json:"tokenModifiers"`
4609+ // The token formats the clients supports.
4610+ Formats []TokenFormat `json:"formats"`
4611+ // Whether the client supports tokens that can overlap each other.
4612+ OverlappingTokenSupport bool `json:"overlappingTokenSupport,omitempty"`
4613+ // Whether the client supports tokens that can span multiple lines.
4614+ MultilineTokenSupport bool `json:"multilineTokenSupport,omitempty"`
4615+ // Whether the client allows the server to actively cancel a
4616+ // semantic token request, e.g. supports returning
4617+ // LSPErrorCodes.ServerCancelled. If a server does the client
4618+ // needs to retrigger the request.
4619+ //
4620+ // @since 3.17.0
4621+ ServerCancelSupport bool `json:"serverCancelSupport,omitempty"`
4622+ // Whether the client uses semantic tokens to augment existing
4623+ // syntax tokens. If set to `true` client side created syntax
4624+ // tokens and semantic tokens are both used for colorization. If
4625+ // set to `false` the client only uses the returned semantic tokens
4626+ // for colorization.
4627+ //
4628+ // If the value is `undefined` then the client behavior is not
4629+ // specified.
4630+ //
4631+ // @since 3.17.0
4632+ AugmentsSyntaxTokens bool `json:"augmentsSyntaxTokens,omitempty"`
4633+}
4634+
4635+// @since 3.16.0
4636+//
4637+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensDelta
4638+type SemanticTokensDelta struct {
4639+ ResultID string `json:"resultId,omitempty"`
4640+ // The semantic token edits to transform a previous result into a new result.
4641+ Edits []SemanticTokensEdit `json:"edits"`
4642+}
4643+
4644+// @since 3.16.0
4645+//
4646+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensDeltaParams
4647+type SemanticTokensDeltaParams struct {
4648+ // The text document.
4649+ TextDocument TextDocumentIdentifier `json:"textDocument"`
4650+ // The result id of a previous response. The result Id can either point to a full response
4651+ // or a delta response depending on what was received last.
4652+ PreviousResultID string `json:"previousResultId"`
4653+ WorkDoneProgressParams
4654+ PartialResultParams
4655+}
4656+
4657+// @since 3.16.0
4658+//
4659+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensDeltaPartialResult
4660+type SemanticTokensDeltaPartialResult struct {
4661+ Edits []SemanticTokensEdit `json:"edits"`
4662+}
4663+
4664+// @since 3.16.0
4665+//
4666+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensEdit
4667+type SemanticTokensEdit struct {
4668+ // The start offset of the edit.
4669+ Start uint32 `json:"start"`
4670+ // The count of elements to remove.
4671+ DeleteCount uint32 `json:"deleteCount"`
4672+ // The elements to insert.
4673+ Data []uint32 `json:"data,omitempty"`
4674+}
4675+
4676+// Semantic tokens options to support deltas for full documents
4677+//
4678+// @since 3.18.0
4679+//
4680+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensFullDelta
4681+type SemanticTokensFullDelta struct {
4682+ // The server supports deltas for full documents.
4683+ Delta bool `json:"delta,omitempty"`
4684+}
4685+
4686+// @since 3.16.0
4687+//
4688+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensLegend
4689+type SemanticTokensLegend struct {
4690+ // The token types a server uses.
4691+ TokenTypes []string `json:"tokenTypes"`
4692+ // The token modifiers a server uses.
4693+ TokenModifiers []string `json:"tokenModifiers"`
4694+}
4695+
4696+// @since 3.16.0
4697+//
4698+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensOptions
4699+type SemanticTokensOptions struct {
4700+ // The legend used by the server
4701+ Legend SemanticTokensLegend `json:"legend"`
4702+ // Server supports providing semantic tokens for a specific range
4703+ // of a document.
4704+ Range *Or_SemanticTokensOptions_range `json:"range,omitempty"`
4705+ // Server supports providing semantic tokens for a full document.
4706+ Full *Or_SemanticTokensOptions_full `json:"full,omitempty"`
4707+ WorkDoneProgressOptions
4708+}
4709+
4710+// @since 3.16.0
4711+//
4712+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensParams
4713+type SemanticTokensParams struct {
4714+ // The text document.
4715+ TextDocument TextDocumentIdentifier `json:"textDocument"`
4716+ WorkDoneProgressParams
4717+ PartialResultParams
4718+}
4719+
4720+// @since 3.16.0
4721+//
4722+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensPartialResult
4723+type SemanticTokensPartialResult struct {
4724+ Data []uint32 `json:"data"`
4725+}
4726+
4727+// @since 3.16.0
4728+//
4729+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensRangeParams
4730+type SemanticTokensRangeParams struct {
4731+ // The text document.
4732+ TextDocument TextDocumentIdentifier `json:"textDocument"`
4733+ // The range the semantic tokens are requested for.
4734+ Range Range `json:"range"`
4735+ WorkDoneProgressParams
4736+ PartialResultParams
4737+}
4738+
4739+// @since 3.16.0
4740+//
4741+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensRegistrationOptions
4742+type SemanticTokensRegistrationOptions struct {
4743+ TextDocumentRegistrationOptions
4744+ SemanticTokensOptions
4745+ StaticRegistrationOptions
4746+}
4747+
4748+// @since 3.16.0
4749+//
4750+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensWorkspaceClientCapabilities
4751+type SemanticTokensWorkspaceClientCapabilities struct {
4752+ // Whether the client implementation supports a refresh request sent from
4753+ // the server to the client.
4754+ //
4755+ // Note that this event is global and will force the client to refresh all
4756+ // semantic tokens currently shown. It should be used with absolute care
4757+ // and is useful for situation where a server for example detects a project
4758+ // wide change that requires such a calculation.
4759+ RefreshSupport bool `json:"refreshSupport,omitempty"`
4760+}
4761+
4762+// Defines the capabilities provided by a language
4763+// server.
4764+//
4765+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#serverCapabilities
4766+type ServerCapabilities struct {
4767+ // The position encoding the server picked from the encodings offered
4768+ // by the client via the client capability `general.positionEncodings`.
4769+ //
4770+ // If the client didn't provide any position encodings the only valid
4771+ // value that a server can return is 'utf-16'.
4772+ //
4773+ // If omitted it defaults to 'utf-16'.
4774+ //
4775+ // @since 3.17.0
4776+ PositionEncoding *PositionEncodingKind `json:"positionEncoding,omitempty"`
4777+ // Defines how text documents are synced. Is either a detailed structure
4778+ // defining each notification or for backwards compatibility the
4779+ // TextDocumentSyncKind number.
4780+ TextDocumentSync interface{} `json:"textDocumentSync,omitempty"`
4781+ // Defines how notebook documents are synced.
4782+ //
4783+ // @since 3.17.0
4784+ NotebookDocumentSync *Or_ServerCapabilities_notebookDocumentSync `json:"notebookDocumentSync,omitempty"`
4785+ // The server provides completion support.
4786+ CompletionProvider *CompletionOptions `json:"completionProvider,omitempty"`
4787+ // The server provides hover support.
4788+ HoverProvider *Or_ServerCapabilities_hoverProvider `json:"hoverProvider,omitempty"`
4789+ // The server provides signature help support.
4790+ SignatureHelpProvider *SignatureHelpOptions `json:"signatureHelpProvider,omitempty"`
4791+ // The server provides Goto Declaration support.
4792+ DeclarationProvider *Or_ServerCapabilities_declarationProvider `json:"declarationProvider,omitempty"`
4793+ // The server provides goto definition support.
4794+ DefinitionProvider *Or_ServerCapabilities_definitionProvider `json:"definitionProvider,omitempty"`
4795+ // The server provides Goto Type Definition support.
4796+ TypeDefinitionProvider *Or_ServerCapabilities_typeDefinitionProvider `json:"typeDefinitionProvider,omitempty"`
4797+ // The server provides Goto Implementation support.
4798+ ImplementationProvider *Or_ServerCapabilities_implementationProvider `json:"implementationProvider,omitempty"`
4799+ // The server provides find references support.
4800+ ReferencesProvider *Or_ServerCapabilities_referencesProvider `json:"referencesProvider,omitempty"`
4801+ // The server provides document highlight support.
4802+ DocumentHighlightProvider *Or_ServerCapabilities_documentHighlightProvider `json:"documentHighlightProvider,omitempty"`
4803+ // The server provides document symbol support.
4804+ DocumentSymbolProvider *Or_ServerCapabilities_documentSymbolProvider `json:"documentSymbolProvider,omitempty"`
4805+ // The server provides code actions. CodeActionOptions may only be
4806+ // specified if the client states that it supports
4807+ // `codeActionLiteralSupport` in its initial `initialize` request.
4808+ CodeActionProvider interface{} `json:"codeActionProvider,omitempty"`
4809+ // The server provides code lens.
4810+ CodeLensProvider *CodeLensOptions `json:"codeLensProvider,omitempty"`
4811+ // The server provides document link support.
4812+ DocumentLinkProvider *DocumentLinkOptions `json:"documentLinkProvider,omitempty"`
4813+ // The server provides color provider support.
4814+ ColorProvider *Or_ServerCapabilities_colorProvider `json:"colorProvider,omitempty"`
4815+ // The server provides workspace symbol support.
4816+ WorkspaceSymbolProvider *Or_ServerCapabilities_workspaceSymbolProvider `json:"workspaceSymbolProvider,omitempty"`
4817+ // The server provides document formatting.
4818+ DocumentFormattingProvider *Or_ServerCapabilities_documentFormattingProvider `json:"documentFormattingProvider,omitempty"`
4819+ // The server provides document range formatting.
4820+ DocumentRangeFormattingProvider *Or_ServerCapabilities_documentRangeFormattingProvider `json:"documentRangeFormattingProvider,omitempty"`
4821+ // The server provides document formatting on typing.
4822+ DocumentOnTypeFormattingProvider *DocumentOnTypeFormattingOptions `json:"documentOnTypeFormattingProvider,omitempty"`
4823+ // The server provides rename support. RenameOptions may only be
4824+ // specified if the client states that it supports
4825+ // `prepareSupport` in its initial `initialize` request.
4826+ RenameProvider interface{} `json:"renameProvider,omitempty"`
4827+ // The server provides folding provider support.
4828+ FoldingRangeProvider *Or_ServerCapabilities_foldingRangeProvider `json:"foldingRangeProvider,omitempty"`
4829+ // The server provides selection range support.
4830+ SelectionRangeProvider *Or_ServerCapabilities_selectionRangeProvider `json:"selectionRangeProvider,omitempty"`
4831+ // The server provides execute command support.
4832+ ExecuteCommandProvider *ExecuteCommandOptions `json:"executeCommandProvider,omitempty"`
4833+ // The server provides call hierarchy support.
4834+ //
4835+ // @since 3.16.0
4836+ CallHierarchyProvider *Or_ServerCapabilities_callHierarchyProvider `json:"callHierarchyProvider,omitempty"`
4837+ // The server provides linked editing range support.
4838+ //
4839+ // @since 3.16.0
4840+ LinkedEditingRangeProvider *Or_ServerCapabilities_linkedEditingRangeProvider `json:"linkedEditingRangeProvider,omitempty"`
4841+ // The server provides semantic tokens support.
4842+ //
4843+ // @since 3.16.0
4844+ SemanticTokensProvider interface{} `json:"semanticTokensProvider,omitempty"`
4845+ // The server provides moniker support.
4846+ //
4847+ // @since 3.16.0
4848+ MonikerProvider *Or_ServerCapabilities_monikerProvider `json:"monikerProvider,omitempty"`
4849+ // The server provides type hierarchy support.
4850+ //
4851+ // @since 3.17.0
4852+ TypeHierarchyProvider *Or_ServerCapabilities_typeHierarchyProvider `json:"typeHierarchyProvider,omitempty"`
4853+ // The server provides inline values.
4854+ //
4855+ // @since 3.17.0
4856+ InlineValueProvider *Or_ServerCapabilities_inlineValueProvider `json:"inlineValueProvider,omitempty"`
4857+ // The server provides inlay hints.
4858+ //
4859+ // @since 3.17.0
4860+ InlayHintProvider interface{} `json:"inlayHintProvider,omitempty"`
4861+ // The server has support for pull model diagnostics.
4862+ //
4863+ // @since 3.17.0
4864+ DiagnosticProvider *Or_ServerCapabilities_diagnosticProvider `json:"diagnosticProvider,omitempty"`
4865+ // Inline completion options used during static registration.
4866+ //
4867+ // @since 3.18.0
4868+ // @proposed
4869+ InlineCompletionProvider *Or_ServerCapabilities_inlineCompletionProvider `json:"inlineCompletionProvider,omitempty"`
4870+ // Workspace specific server capabilities.
4871+ Workspace *WorkspaceOptions `json:"workspace,omitempty"`
4872+ // Experimental server capabilities.
4873+ Experimental interface{} `json:"experimental,omitempty"`
4874+}
4875+
4876+// @since 3.18.0
4877+//
4878+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#serverCompletionItemOptions
4879+type ServerCompletionItemOptions struct {
4880+ // The server has support for completion item label
4881+ // details (see also `CompletionItemLabelDetails`) when
4882+ // receiving a completion item in a resolve call.
4883+ //
4884+ // @since 3.17.0
4885+ LabelDetailsSupport bool `json:"labelDetailsSupport,omitempty"`
4886+}
4887+
4888+// Information about the server
4889+//
4890+// @since 3.15.0
4891+// @since 3.18.0 ServerInfo type name added.
4892+//
4893+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#serverInfo
4894+type ServerInfo struct {
4895+ // The name of the server as defined by the server.
4896+ Name string `json:"name"`
4897+ // The server's version as defined by the server.
4898+ Version string `json:"version,omitempty"`
4899+}
4900+
4901+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#setTraceParams
4902+type SetTraceParams struct {
4903+ Value TraceValue `json:"value"`
4904+}
4905+
4906+// Client capabilities for the showDocument request.
4907+//
4908+// @since 3.16.0
4909+//
4910+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#showDocumentClientCapabilities
4911+type ShowDocumentClientCapabilities struct {
4912+ // The client has support for the showDocument
4913+ // request.
4914+ Support bool `json:"support"`
4915+}
4916+
4917+// Params to show a resource in the UI.
4918+//
4919+// @since 3.16.0
4920+//
4921+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#showDocumentParams
4922+type ShowDocumentParams struct {
4923+ // The uri to show.
4924+ URI URI `json:"uri"`
4925+ // Indicates to show the resource in an external program.
4926+ // To show, for example, `https://code.visualstudio.com/`
4927+ // in the default WEB browser set `external` to `true`.
4928+ External bool `json:"external,omitempty"`
4929+ // An optional property to indicate whether the editor
4930+ // showing the document should take focus or not.
4931+ // Clients might ignore this property if an external
4932+ // program is started.
4933+ TakeFocus bool `json:"takeFocus,omitempty"`
4934+ // An optional selection range if the document is a text
4935+ // document. Clients might ignore the property if an
4936+ // external program is started or the file is not a text
4937+ // file.
4938+ Selection *Range `json:"selection,omitempty"`
4939+}
4940+
4941+// The result of a showDocument request.
4942+//
4943+// @since 3.16.0
4944+//
4945+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#showDocumentResult
4946+type ShowDocumentResult struct {
4947+ // A boolean indicating if the show was successful.
4948+ Success bool `json:"success"`
4949+}
4950+
4951+// The parameters of a notification message.
4952+//
4953+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#showMessageParams
4954+type ShowMessageParams struct {
4955+ // The message type. See {@link MessageType}
4956+ Type MessageType `json:"type"`
4957+ // The actual message.
4958+ Message string `json:"message"`
4959+}
4960+
4961+// Show message request client capabilities
4962+//
4963+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#showMessageRequestClientCapabilities
4964+type ShowMessageRequestClientCapabilities struct {
4965+ // Capabilities specific to the `MessageActionItem` type.
4966+ MessageActionItem *ClientShowMessageActionItemOptions `json:"messageActionItem,omitempty"`
4967+}
4968+
4969+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#showMessageRequestParams
4970+type ShowMessageRequestParams struct {
4971+ // The message type. See {@link MessageType}
4972+ Type MessageType `json:"type"`
4973+ // The actual message.
4974+ Message string `json:"message"`
4975+ // The message action items to present.
4976+ Actions []MessageActionItem `json:"actions,omitempty"`
4977+}
4978+
4979+// Signature help represents the signature of something
4980+// callable. There can be multiple signature but only one
4981+// active and only one active parameter.
4982+//
4983+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#signatureHelp
4984+type SignatureHelp struct {
4985+ // One or more signatures.
4986+ Signatures []SignatureInformation `json:"signatures"`
4987+ // The active signature. If omitted or the value lies outside the
4988+ // range of `signatures` the value defaults to zero or is ignored if
4989+ // the `SignatureHelp` has no signatures.
4990+ //
4991+ // Whenever possible implementors should make an active decision about
4992+ // the active signature and shouldn't rely on a default value.
4993+ //
4994+ // In future version of the protocol this property might become
4995+ // mandatory to better express this.
4996+ ActiveSignature uint32 `json:"activeSignature,omitempty"`
4997+ // The active parameter of the active signature.
4998+ //
4999+ // If `null`, no parameter of the signature is active (for example a named
5000+ // argument that does not match any declared parameters). This is only valid
5001+ // if the client specifies the client capability
5002+ // `textDocument.signatureHelp.noActiveParameterSupport === true`
5003+ //
5004+ // If omitted or the value lies outside the range of
5005+ // `signatures[activeSignature].parameters` defaults to 0 if the active
5006+ // signature has parameters.
5007+ //
5008+ // If the active signature has no parameters it is ignored.
5009+ //
5010+ // In future version of the protocol this property might become
5011+ // mandatory (but still nullable) to better express the active parameter if
5012+ // the active signature does have any.
5013+ ActiveParameter uint32 `json:"activeParameter,omitempty"`
5014+}
5015+
5016+// Client Capabilities for a {@link SignatureHelpRequest}.
5017+//
5018+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#signatureHelpClientCapabilities
5019+type SignatureHelpClientCapabilities struct {
5020+ // Whether signature help supports dynamic registration.
5021+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
5022+ // The client supports the following `SignatureInformation`
5023+ // specific properties.
5024+ SignatureInformation *ClientSignatureInformationOptions `json:"signatureInformation,omitempty"`
5025+ // The client supports to send additional context information for a
5026+ // `textDocument/signatureHelp` request. A client that opts into
5027+ // contextSupport will also support the `retriggerCharacters` on
5028+ // `SignatureHelpOptions`.
5029+ //
5030+ // @since 3.15.0
5031+ ContextSupport bool `json:"contextSupport,omitempty"`
5032+}
5033+
5034+// Additional information about the context in which a signature help request was triggered.
5035+//
5036+// @since 3.15.0
5037+//
5038+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#signatureHelpContext
5039+type SignatureHelpContext struct {
5040+ // Action that caused signature help to be triggered.
5041+ TriggerKind SignatureHelpTriggerKind `json:"triggerKind"`
5042+ // Character that caused signature help to be triggered.
5043+ //
5044+ // This is undefined when `triggerKind !== SignatureHelpTriggerKind.TriggerCharacter`
5045+ TriggerCharacter string `json:"triggerCharacter,omitempty"`
5046+ // `true` if signature help was already showing when it was triggered.
5047+ //
5048+ // Retriggers occurs when the signature help is already active and can be caused by actions such as
5049+ // typing a trigger character, a cursor move, or document content changes.
5050+ IsRetrigger bool `json:"isRetrigger"`
5051+ // The currently active `SignatureHelp`.
5052+ //
5053+ // The `activeSignatureHelp` has its `SignatureHelp.activeSignature` field updated based on
5054+ // the user navigating through available signatures.
5055+ ActiveSignatureHelp *SignatureHelp `json:"activeSignatureHelp,omitempty"`
5056+}
5057+
5058+// Server Capabilities for a {@link SignatureHelpRequest}.
5059+//
5060+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#signatureHelpOptions
5061+type SignatureHelpOptions struct {
5062+ // List of characters that trigger signature help automatically.
5063+ TriggerCharacters []string `json:"triggerCharacters,omitempty"`
5064+ // List of characters that re-trigger signature help.
5065+ //
5066+ // These trigger characters are only active when signature help is already showing. All trigger characters
5067+ // are also counted as re-trigger characters.
5068+ //
5069+ // @since 3.15.0
5070+ RetriggerCharacters []string `json:"retriggerCharacters,omitempty"`
5071+ WorkDoneProgressOptions
5072+}
5073+
5074+// Parameters for a {@link SignatureHelpRequest}.
5075+//
5076+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#signatureHelpParams
5077+type SignatureHelpParams struct {
5078+ // The signature help context. This is only available if the client specifies
5079+ // to send this using the client capability `textDocument.signatureHelp.contextSupport === true`
5080+ //
5081+ // @since 3.15.0
5082+ Context *SignatureHelpContext `json:"context,omitempty"`
5083+ TextDocumentPositionParams
5084+ WorkDoneProgressParams
5085+}
5086+
5087+// Registration options for a {@link SignatureHelpRequest}.
5088+//
5089+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#signatureHelpRegistrationOptions
5090+type SignatureHelpRegistrationOptions struct {
5091+ TextDocumentRegistrationOptions
5092+ SignatureHelpOptions
5093+}
5094+
5095+// How a signature help was triggered.
5096+//
5097+// @since 3.15.0
5098+type SignatureHelpTriggerKind uint32
5099+
5100+// Represents the signature of something callable. A signature
5101+// can have a label, like a function-name, a doc-comment, and
5102+// a set of parameters.
5103+//
5104+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#signatureInformation
5105+type SignatureInformation struct {
5106+ // The label of this signature. Will be shown in
5107+ // the UI.
5108+ Label string `json:"label"`
5109+ // The human-readable doc-comment of this signature. Will be shown
5110+ // in the UI but can be omitted.
5111+ Documentation *Or_SignatureInformation_documentation `json:"documentation,omitempty"`
5112+ // The parameters of this signature.
5113+ Parameters []ParameterInformation `json:"parameters,omitempty"`
5114+ // The index of the active parameter.
5115+ //
5116+ // If `null`, no parameter of the signature is active (for example a named
5117+ // argument that does not match any declared parameters). This is only valid
5118+ // if the client specifies the client capability
5119+ // `textDocument.signatureHelp.noActiveParameterSupport === true`
5120+ //
5121+ // If provided (or `null`), this is used in place of
5122+ // `SignatureHelp.activeParameter`.
5123+ //
5124+ // @since 3.16.0
5125+ ActiveParameter uint32 `json:"activeParameter,omitempty"`
5126+}
5127+
5128+// An interactive text edit.
5129+//
5130+// @since 3.18.0
5131+// @proposed
5132+//
5133+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#snippetTextEdit
5134+type SnippetTextEdit struct {
5135+ // The range of the text document to be manipulated.
5136+ Range Range `json:"range"`
5137+ // The snippet to be inserted.
5138+ Snippet StringValue `json:"snippet"`
5139+ // The actual identifier of the snippet edit.
5140+ AnnotationID *ChangeAnnotationIdentifier `json:"annotationId,omitempty"`
5141+}
5142+
5143+// @since 3.18.0
5144+//
5145+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#staleRequestSupportOptions
5146+type StaleRequestSupportOptions struct {
5147+ // The client will actively cancel the request.
5148+ Cancel bool `json:"cancel"`
5149+ // The list of requests for which the client
5150+ // will retry the request if it receives a
5151+ // response with error code `ContentModified`
5152+ RetryOnContentModified []string `json:"retryOnContentModified"`
5153+}
5154+
5155+// Static registration options to be returned in the initialize
5156+// request.
5157+//
5158+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#staticRegistrationOptions
5159+type StaticRegistrationOptions struct {
5160+ // The id used to register the request. The id can be used to deregister
5161+ // the request again. See also Registration#id.
5162+ ID string `json:"id,omitempty"`
5163+}
5164+
5165+// A string value used as a snippet is a template which allows to insert text
5166+// and to control the editor cursor when insertion happens.
5167+//
5168+// A snippet can define tab stops and placeholders with `$1`, `$2`
5169+// and `${3:foo}`. `$0` defines the final tab stop, it defaults to
5170+// the end of the snippet. Variables are defined with `$name` and
5171+// `${name:default value}`.
5172+//
5173+// @since 3.18.0
5174+// @proposed
5175+//
5176+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#stringValue
5177+type StringValue struct {
5178+ // The kind of string value.
5179+ Kind string `json:"kind"`
5180+ // The snippet string.
5181+ Value string `json:"value"`
5182+}
5183+
5184+// Represents information about programming constructs like variables, classes,
5185+// interfaces etc.
5186+//
5187+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#symbolInformation
5188+type SymbolInformation struct {
5189+ // extends BaseSymbolInformation
5190+ // Indicates if this symbol is deprecated.
5191+ //
5192+ // @deprecated Use tags instead
5193+ Deprecated bool `json:"deprecated,omitempty"`
5194+ // The location of this symbol. The location's range is used by a tool
5195+ // to reveal the location in the editor. If the symbol is selected in the
5196+ // tool the range's start information is used to position the cursor. So
5197+ // the range usually spans more than the actual symbol's name and does
5198+ // normally include things like visibility modifiers.
5199+ //
5200+ // The range doesn't have to denote a node range in the sense of an abstract
5201+ // syntax tree. It can therefore not be used to re-construct a hierarchy of
5202+ // the symbols.
5203+ Location Location `json:"location"`
5204+ // The name of this symbol.
5205+ Name string `json:"name"`
5206+ // The kind of this symbol.
5207+ Kind SymbolKind `json:"kind"`
5208+ // Tags for this symbol.
5209+ //
5210+ // @since 3.16.0
5211+ Tags []SymbolTag `json:"tags,omitempty"`
5212+ // The name of the symbol containing this symbol. This information is for
5213+ // user interface purposes (e.g. to render a qualifier in the user interface
5214+ // if necessary). It can't be used to re-infer a hierarchy for the document
5215+ // symbols.
5216+ ContainerName string `json:"containerName,omitempty"`
5217+}
5218+
5219+// A symbol kind.
5220+type SymbolKind uint32
5221+
5222+// Symbol tags are extra annotations that tweak the rendering of a symbol.
5223+//
5224+// @since 3.16
5225+type SymbolTag uint32
5226+
5227+// Describe options to be used when registered for text document change events.
5228+//
5229+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentChangeRegistrationOptions
5230+type TextDocumentChangeRegistrationOptions struct {
5231+ // How documents are synced to the server.
5232+ SyncKind TextDocumentSyncKind `json:"syncKind"`
5233+ TextDocumentRegistrationOptions
5234+}
5235+
5236+// Text document specific client capabilities.
5237+//
5238+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentClientCapabilities
5239+type TextDocumentClientCapabilities struct {
5240+ // Defines which synchronization capabilities the client supports.
5241+ Synchronization *TextDocumentSyncClientCapabilities `json:"synchronization,omitempty"`
5242+ // Capabilities specific to the `textDocument/completion` request.
5243+ Completion CompletionClientCapabilities `json:"completion,omitempty"`
5244+ // Capabilities specific to the `textDocument/hover` request.
5245+ Hover *HoverClientCapabilities `json:"hover,omitempty"`
5246+ // Capabilities specific to the `textDocument/signatureHelp` request.
5247+ SignatureHelp *SignatureHelpClientCapabilities `json:"signatureHelp,omitempty"`
5248+ // Capabilities specific to the `textDocument/declaration` request.
5249+ //
5250+ // @since 3.14.0
5251+ Declaration *DeclarationClientCapabilities `json:"declaration,omitempty"`
5252+ // Capabilities specific to the `textDocument/definition` request.
5253+ Definition *DefinitionClientCapabilities `json:"definition,omitempty"`
5254+ // Capabilities specific to the `textDocument/typeDefinition` request.
5255+ //
5256+ // @since 3.6.0
5257+ TypeDefinition *TypeDefinitionClientCapabilities `json:"typeDefinition,omitempty"`
5258+ // Capabilities specific to the `textDocument/implementation` request.
5259+ //
5260+ // @since 3.6.0
5261+ Implementation *ImplementationClientCapabilities `json:"implementation,omitempty"`
5262+ // Capabilities specific to the `textDocument/references` request.
5263+ References *ReferenceClientCapabilities `json:"references,omitempty"`
5264+ // Capabilities specific to the `textDocument/documentHighlight` request.
5265+ DocumentHighlight *DocumentHighlightClientCapabilities `json:"documentHighlight,omitempty"`
5266+ // Capabilities specific to the `textDocument/documentSymbol` request.
5267+ DocumentSymbol DocumentSymbolClientCapabilities `json:"documentSymbol,omitempty"`
5268+ // Capabilities specific to the `textDocument/codeAction` request.
5269+ CodeAction CodeActionClientCapabilities `json:"codeAction,omitempty"`
5270+ // Capabilities specific to the `textDocument/codeLens` request.
5271+ CodeLens *CodeLensClientCapabilities `json:"codeLens,omitempty"`
5272+ // Capabilities specific to the `textDocument/documentLink` request.
5273+ DocumentLink *DocumentLinkClientCapabilities `json:"documentLink,omitempty"`
5274+ // Capabilities specific to the `textDocument/documentColor` and the
5275+ // `textDocument/colorPresentation` request.
5276+ //
5277+ // @since 3.6.0
5278+ ColorProvider *DocumentColorClientCapabilities `json:"colorProvider,omitempty"`
5279+ // Capabilities specific to the `textDocument/formatting` request.
5280+ Formatting *DocumentFormattingClientCapabilities `json:"formatting,omitempty"`
5281+ // Capabilities specific to the `textDocument/rangeFormatting` request.
5282+ RangeFormatting *DocumentRangeFormattingClientCapabilities `json:"rangeFormatting,omitempty"`
5283+ // Capabilities specific to the `textDocument/onTypeFormatting` request.
5284+ OnTypeFormatting *DocumentOnTypeFormattingClientCapabilities `json:"onTypeFormatting,omitempty"`
5285+ // Capabilities specific to the `textDocument/rename` request.
5286+ Rename *RenameClientCapabilities `json:"rename,omitempty"`
5287+ // Capabilities specific to the `textDocument/foldingRange` request.
5288+ //
5289+ // @since 3.10.0
5290+ FoldingRange *FoldingRangeClientCapabilities `json:"foldingRange,omitempty"`
5291+ // Capabilities specific to the `textDocument/selectionRange` request.
5292+ //
5293+ // @since 3.15.0
5294+ SelectionRange *SelectionRangeClientCapabilities `json:"selectionRange,omitempty"`
5295+ // Capabilities specific to the `textDocument/publishDiagnostics` notification.
5296+ PublishDiagnostics PublishDiagnosticsClientCapabilities `json:"publishDiagnostics,omitempty"`
5297+ // Capabilities specific to the various call hierarchy requests.
5298+ //
5299+ // @since 3.16.0
5300+ CallHierarchy *CallHierarchyClientCapabilities `json:"callHierarchy,omitempty"`
5301+ // Capabilities specific to the various semantic token request.
5302+ //
5303+ // @since 3.16.0
5304+ SemanticTokens SemanticTokensClientCapabilities `json:"semanticTokens,omitempty"`
5305+ // Capabilities specific to the `textDocument/linkedEditingRange` request.
5306+ //
5307+ // @since 3.16.0
5308+ LinkedEditingRange *LinkedEditingRangeClientCapabilities `json:"linkedEditingRange,omitempty"`
5309+ // Client capabilities specific to the `textDocument/moniker` request.
5310+ //
5311+ // @since 3.16.0
5312+ Moniker *MonikerClientCapabilities `json:"moniker,omitempty"`
5313+ // Capabilities specific to the various type hierarchy requests.
5314+ //
5315+ // @since 3.17.0
5316+ TypeHierarchy *TypeHierarchyClientCapabilities `json:"typeHierarchy,omitempty"`
5317+ // Capabilities specific to the `textDocument/inlineValue` request.
5318+ //
5319+ // @since 3.17.0
5320+ InlineValue *InlineValueClientCapabilities `json:"inlineValue,omitempty"`
5321+ // Capabilities specific to the `textDocument/inlayHint` request.
5322+ //
5323+ // @since 3.17.0
5324+ InlayHint *InlayHintClientCapabilities `json:"inlayHint,omitempty"`
5325+ // Capabilities specific to the diagnostic pull model.
5326+ //
5327+ // @since 3.17.0
5328+ Diagnostic *DiagnosticClientCapabilities `json:"diagnostic,omitempty"`
5329+ // Client capabilities specific to inline completions.
5330+ //
5331+ // @since 3.18.0
5332+ // @proposed
5333+ InlineCompletion *InlineCompletionClientCapabilities `json:"inlineCompletion,omitempty"`
5334+}
5335+
5336+// An event describing a change to a text document. If only a text is provided
5337+// it is considered to be the full content of the document.
5338+//
5339+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentContentChangeEvent
5340+type TextDocumentContentChangeEvent = Or_TextDocumentContentChangeEvent // (alias)
5341+// @since 3.18.0
5342+//
5343+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentContentChangePartial
5344+type TextDocumentContentChangePartial struct {
5345+ // The range of the document that changed.
5346+ Range *Range `json:"range,omitempty"`
5347+ // The optional length of the range that got replaced.
5348+ //
5349+ // @deprecated use range instead.
5350+ RangeLength uint32 `json:"rangeLength,omitempty"`
5351+ // The new text for the provided range.
5352+ Text string `json:"text"`
5353+}
5354+
5355+// @since 3.18.0
5356+//
5357+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentContentChangeWholeDocument
5358+type TextDocumentContentChangeWholeDocument struct {
5359+ // The new text of the whole document.
5360+ Text string `json:"text"`
5361+}
5362+
5363+// Client capabilities for a text document content provider.
5364+//
5365+// @since 3.18.0
5366+// @proposed
5367+//
5368+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentContentClientCapabilities
5369+type TextDocumentContentClientCapabilities struct {
5370+ // Text document content provider supports dynamic registration.
5371+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
5372+}
5373+
5374+// Text document content provider options.
5375+//
5376+// @since 3.18.0
5377+// @proposed
5378+//
5379+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentContentOptions
5380+type TextDocumentContentOptions struct {
5381+ // The scheme for which the server provides content.
5382+ Scheme string `json:"scheme"`
5383+}
5384+
5385+// Parameters for the `workspace/textDocumentContent` request.
5386+//
5387+// @since 3.18.0
5388+// @proposed
5389+//
5390+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentContentParams
5391+type TextDocumentContentParams struct {
5392+ // The uri of the text document.
5393+ URI DocumentUri `json:"uri"`
5394+}
5395+
5396+// Parameters for the `workspace/textDocumentContent/refresh` request.
5397+//
5398+// @since 3.18.0
5399+// @proposed
5400+//
5401+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentContentRefreshParams
5402+type TextDocumentContentRefreshParams struct {
5403+ // The uri of the text document to refresh.
5404+ URI DocumentUri `json:"uri"`
5405+}
5406+
5407+// Text document content provider registration options.
5408+//
5409+// @since 3.18.0
5410+// @proposed
5411+//
5412+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentContentRegistrationOptions
5413+type TextDocumentContentRegistrationOptions struct {
5414+ TextDocumentContentOptions
5415+ StaticRegistrationOptions
5416+}
5417+
5418+// Describes textual changes on a text document. A TextDocumentEdit describes all changes
5419+// on a document version Si and after they are applied move the document to version Si+1.
5420+// So the creator of a TextDocumentEdit doesn't need to sort the array of edits or do any
5421+// kind of ordering. However the edits must be non overlapping.
5422+//
5423+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentEdit
5424+type TextDocumentEdit struct {
5425+ // The text document to change.
5426+ TextDocument OptionalVersionedTextDocumentIdentifier `json:"textDocument"`
5427+ // The edits to be applied.
5428+ //
5429+ // @since 3.16.0 - support for AnnotatedTextEdit. This is guarded using a
5430+ // client capability.
5431+ //
5432+ // @since 3.18.0 - support for SnippetTextEdit. This is guarded using a
5433+ // client capability.
5434+ Edits []Or_TextDocumentEdit_edits_Elem `json:"edits"`
5435+}
5436+
5437+// A document filter denotes a document by different properties like
5438+// the {@link TextDocument.languageId language}, the {@link Uri.scheme scheme} of
5439+// its resource, or a glob-pattern that is applied to the {@link TextDocument.fileName path}.
5440+//
5441+// Glob patterns can have the following syntax:
5442+//
5443+// - `*` to match one or more characters in a path segment
5444+// - `?` to match on one character in a path segment
5445+// - `**` to match any number of path segments, including none
5446+// - `{}` to group sub patterns into an OR expression. (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files)
5447+// - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …)
5448+// - `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`)
5449+//
5450+// @sample A language filter that applies to typescript files on disk: `{ language: 'typescript', scheme: 'file' }`
5451+// @sample A language filter that applies to all package.json paths: `{ language: 'json', pattern: '**package.json' }`
5452+//
5453+// @since 3.17.0
5454+//
5455+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentFilter
5456+type TextDocumentFilter = Or_TextDocumentFilter // (alias)
5457+// A document filter where `language` is required field.
5458+//
5459+// @since 3.18.0
5460+//
5461+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentFilterLanguage
5462+type TextDocumentFilterLanguage struct {
5463+ // A language id, like `typescript`.
5464+ Language string `json:"language"`
5465+ // A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
5466+ Scheme string `json:"scheme,omitempty"`
5467+ // A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples.
5468+ //
5469+ // @since 3.18.0 - support for relative patterns.
5470+ Pattern *GlobPattern `json:"pattern,omitempty"`
5471+}
5472+
5473+// A document filter where `pattern` is required field.
5474+//
5475+// @since 3.18.0
5476+//
5477+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentFilterPattern
5478+type TextDocumentFilterPattern struct {
5479+ // A language id, like `typescript`.
5480+ Language string `json:"language,omitempty"`
5481+ // A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
5482+ Scheme string `json:"scheme,omitempty"`
5483+ // A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples.
5484+ //
5485+ // @since 3.18.0 - support for relative patterns.
5486+ Pattern GlobPattern `json:"pattern"`
5487+}
5488+
5489+// A document filter where `scheme` is required field.
5490+//
5491+// @since 3.18.0
5492+//
5493+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentFilterScheme
5494+type TextDocumentFilterScheme struct {
5495+ // A language id, like `typescript`.
5496+ Language string `json:"language,omitempty"`
5497+ // A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
5498+ Scheme string `json:"scheme"`
5499+ // A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples.
5500+ //
5501+ // @since 3.18.0 - support for relative patterns.
5502+ Pattern *GlobPattern `json:"pattern,omitempty"`
5503+}
5504+
5505+// A literal to identify a text document in the client.
5506+//
5507+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentIdentifier
5508+type TextDocumentIdentifier struct {
5509+ // The text document's uri.
5510+ URI DocumentUri `json:"uri"`
5511+}
5512+
5513+// An item to transfer a text document from the client to the
5514+// server.
5515+//
5516+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentItem
5517+type TextDocumentItem struct {
5518+ // The text document's uri.
5519+ URI DocumentUri `json:"uri"`
5520+ // The text document's language identifier.
5521+ LanguageID LanguageKind `json:"languageId"`
5522+ // The version number of this document (it will increase after each
5523+ // change, including undo/redo).
5524+ Version int32 `json:"version"`
5525+ // The content of the opened text document.
5526+ Text string `json:"text"`
5527+}
5528+
5529+// A parameter literal used in requests to pass a text document and a position inside that
5530+// document.
5531+//
5532+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentPositionParams
5533+type TextDocumentPositionParams struct {
5534+ // The text document.
5535+ TextDocument TextDocumentIdentifier `json:"textDocument"`
5536+ // The position inside the text document.
5537+ Position Position `json:"position"`
5538+}
5539+
5540+// General text document registration options.
5541+//
5542+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentRegistrationOptions
5543+type TextDocumentRegistrationOptions struct {
5544+ // A document selector to identify the scope of the registration. If set to null
5545+ // the document selector provided on the client side will be used.
5546+ DocumentSelector DocumentSelector `json:"documentSelector"`
5547+}
5548+
5549+// Represents reasons why a text document is saved.
5550+type TextDocumentSaveReason uint32
5551+
5552+// Save registration options.
5553+//
5554+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentSaveRegistrationOptions
5555+type TextDocumentSaveRegistrationOptions struct {
5556+ TextDocumentRegistrationOptions
5557+ SaveOptions
5558+}
5559+
5560+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentSyncClientCapabilities
5561+type TextDocumentSyncClientCapabilities struct {
5562+ // Whether text document synchronization supports dynamic registration.
5563+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
5564+ // The client supports sending will save notifications.
5565+ WillSave bool `json:"willSave,omitempty"`
5566+ // The client supports sending a will save request and
5567+ // waits for a response providing text edits which will
5568+ // be applied to the document before it is saved.
5569+ WillSaveWaitUntil bool `json:"willSaveWaitUntil,omitempty"`
5570+ // The client supports did save notifications.
5571+ DidSave bool `json:"didSave,omitempty"`
5572+}
5573+
5574+// Defines how the host (editor) should sync
5575+// document changes to the language server.
5576+type TextDocumentSyncKind uint32
5577+
5578+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentSyncOptions
5579+type TextDocumentSyncOptions struct {
5580+ // Open and close notifications are sent to the server. If omitted open close notification should not
5581+ // be sent.
5582+ OpenClose bool `json:"openClose,omitempty"`
5583+ // Change notifications are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full
5584+ // and TextDocumentSyncKind.Incremental. If omitted it defaults to TextDocumentSyncKind.None.
5585+ Change TextDocumentSyncKind `json:"change,omitempty"`
5586+ // If present will save notifications are sent to the server. If omitted the notification should not be
5587+ // sent.
5588+ WillSave bool `json:"willSave,omitempty"`
5589+ // If present will save wait until requests are sent to the server. If omitted the request should not be
5590+ // sent.
5591+ WillSaveWaitUntil bool `json:"willSaveWaitUntil,omitempty"`
5592+ // If present save notifications are sent to the server. If omitted the notification should not be
5593+ // sent.
5594+ Save *SaveOptions `json:"save,omitempty"`
5595+}
5596+
5597+// A text edit applicable to a text document.
5598+//
5599+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textEdit
5600+type TextEdit struct {
5601+ // The range of the text document to be manipulated. To insert
5602+ // text into a document create a range where start === end.
5603+ Range Range `json:"range"`
5604+ // The string to be inserted. For delete operations use an
5605+ // empty string.
5606+ NewText string `json:"newText"`
5607+}
5608+type TokenFormat string
5609+type TraceValue string
5610+
5611+// created for Tuple
5612+type Tuple_ParameterInformation_label_Item1 struct {
5613+ Fld0 uint32 `json:"fld0"`
5614+ Fld1 uint32 `json:"fld1"`
5615+}
5616+
5617+// Since 3.6.0
5618+//
5619+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeDefinitionClientCapabilities
5620+type TypeDefinitionClientCapabilities struct {
5621+ // Whether implementation supports dynamic registration. If this is set to `true`
5622+ // the client supports the new `TypeDefinitionRegistrationOptions` return value
5623+ // for the corresponding server capability as well.
5624+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
5625+ // The client supports additional metadata in the form of definition links.
5626+ //
5627+ // Since 3.14.0
5628+ LinkSupport bool `json:"linkSupport,omitempty"`
5629+}
5630+
5631+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeDefinitionOptions
5632+type TypeDefinitionOptions struct {
5633+ WorkDoneProgressOptions
5634+}
5635+
5636+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeDefinitionParams
5637+type TypeDefinitionParams struct {
5638+ TextDocumentPositionParams
5639+ WorkDoneProgressParams
5640+ PartialResultParams
5641+}
5642+
5643+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeDefinitionRegistrationOptions
5644+type TypeDefinitionRegistrationOptions struct {
5645+ TextDocumentRegistrationOptions
5646+ TypeDefinitionOptions
5647+ StaticRegistrationOptions
5648+}
5649+
5650+// @since 3.17.0
5651+//
5652+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeHierarchyClientCapabilities
5653+type TypeHierarchyClientCapabilities struct {
5654+ // Whether implementation supports dynamic registration. If this is set to `true`
5655+ // the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
5656+ // return value for the corresponding server capability as well.
5657+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
5658+}
5659+
5660+// @since 3.17.0
5661+//
5662+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeHierarchyItem
5663+type TypeHierarchyItem struct {
5664+ // The name of this item.
5665+ Name string `json:"name"`
5666+ // The kind of this item.
5667+ Kind SymbolKind `json:"kind"`
5668+ // Tags for this item.
5669+ Tags []SymbolTag `json:"tags,omitempty"`
5670+ // More detail for this item, e.g. the signature of a function.
5671+ Detail string `json:"detail,omitempty"`
5672+ // The resource identifier of this item.
5673+ URI DocumentUri `json:"uri"`
5674+ // The range enclosing this symbol not including leading/trailing whitespace
5675+ // but everything else, e.g. comments and code.
5676+ Range Range `json:"range"`
5677+ // The range that should be selected and revealed when this symbol is being
5678+ // picked, e.g. the name of a function. Must be contained by the
5679+ // {@link TypeHierarchyItem.range `range`}.
5680+ SelectionRange Range `json:"selectionRange"`
5681+ // A data entry field that is preserved between a type hierarchy prepare and
5682+ // supertypes or subtypes requests. It could also be used to identify the
5683+ // type hierarchy in the server, helping improve the performance on
5684+ // resolving supertypes and subtypes.
5685+ Data interface{} `json:"data,omitempty"`
5686+}
5687+
5688+// Type hierarchy options used during static registration.
5689+//
5690+// @since 3.17.0
5691+//
5692+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeHierarchyOptions
5693+type TypeHierarchyOptions struct {
5694+ WorkDoneProgressOptions
5695+}
5696+
5697+// The parameter of a `textDocument/prepareTypeHierarchy` request.
5698+//
5699+// @since 3.17.0
5700+//
5701+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeHierarchyPrepareParams
5702+type TypeHierarchyPrepareParams struct {
5703+ TextDocumentPositionParams
5704+ WorkDoneProgressParams
5705+}
5706+
5707+// Type hierarchy options used during static or dynamic registration.
5708+//
5709+// @since 3.17.0
5710+//
5711+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeHierarchyRegistrationOptions
5712+type TypeHierarchyRegistrationOptions struct {
5713+ TextDocumentRegistrationOptions
5714+ TypeHierarchyOptions
5715+ StaticRegistrationOptions
5716+}
5717+
5718+// The parameter of a `typeHierarchy/subtypes` request.
5719+//
5720+// @since 3.17.0
5721+//
5722+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeHierarchySubtypesParams
5723+type TypeHierarchySubtypesParams struct {
5724+ Item TypeHierarchyItem `json:"item"`
5725+ WorkDoneProgressParams
5726+ PartialResultParams
5727+}
5728+
5729+// The parameter of a `typeHierarchy/supertypes` request.
5730+//
5731+// @since 3.17.0
5732+//
5733+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeHierarchySupertypesParams
5734+type TypeHierarchySupertypesParams struct {
5735+ Item TypeHierarchyItem `json:"item"`
5736+ WorkDoneProgressParams
5737+ PartialResultParams
5738+}
5739+
5740+// A diagnostic report indicating that the last returned
5741+// report is still accurate.
5742+//
5743+// @since 3.17.0
5744+//
5745+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#unchangedDocumentDiagnosticReport
5746+type UnchangedDocumentDiagnosticReport struct {
5747+ // A document diagnostic report indicating
5748+ // no changes to the last result. A server can
5749+ // only return `unchanged` if result ids are
5750+ // provided.
5751+ Kind string `json:"kind"`
5752+ // A result id which will be sent on the next
5753+ // diagnostic request for the same document.
5754+ ResultID string `json:"resultId"`
5755+}
5756+
5757+// Moniker uniqueness level to define scope of the moniker.
5758+//
5759+// @since 3.16.0
5760+type UniquenessLevel string
5761+
5762+// General parameters to unregister a request or notification.
5763+//
5764+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#unregistration
5765+type Unregistration struct {
5766+ // The id used to unregister the request or notification. Usually an id
5767+ // provided during the register request.
5768+ ID string `json:"id"`
5769+ // The method to unregister for.
5770+ Method string `json:"method"`
5771+}
5772+
5773+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#unregistrationParams
5774+type UnregistrationParams struct {
5775+ Unregisterations []Unregistration `json:"unregisterations"`
5776+}
5777+
5778+// A versioned notebook document identifier.
5779+//
5780+// @since 3.17.0
5781+//
5782+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#versionedNotebookDocumentIdentifier
5783+type VersionedNotebookDocumentIdentifier struct {
5784+ // The version number of this notebook document.
5785+ Version int32 `json:"version"`
5786+ // The notebook document's uri.
5787+ URI URI `json:"uri"`
5788+}
5789+
5790+// A text document identifier to denote a specific version of a text document.
5791+//
5792+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#versionedTextDocumentIdentifier
5793+type VersionedTextDocumentIdentifier struct {
5794+ // The version number of this document.
5795+ Version int32 `json:"version"`
5796+ TextDocumentIdentifier
5797+}
5798+type WatchKind = uint32 // The parameters sent in a will save text document notification.
5799+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#willSaveTextDocumentParams
5800+type WillSaveTextDocumentParams struct {
5801+ // The document that will be saved.
5802+ TextDocument TextDocumentIdentifier `json:"textDocument"`
5803+ // The 'TextDocumentSaveReason'.
5804+ Reason TextDocumentSaveReason `json:"reason"`
5805+}
5806+
5807+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#windowClientCapabilities
5808+type WindowClientCapabilities struct {
5809+ // It indicates whether the client supports server initiated
5810+ // progress using the `window/workDoneProgress/create` request.
5811+ //
5812+ // The capability also controls Whether client supports handling
5813+ // of progress notifications. If set servers are allowed to report a
5814+ // `workDoneProgress` property in the request specific server
5815+ // capabilities.
5816+ //
5817+ // @since 3.15.0
5818+ WorkDoneProgress bool `json:"workDoneProgress,omitempty"`
5819+ // Capabilities specific to the showMessage request.
5820+ //
5821+ // @since 3.16.0
5822+ ShowMessage *ShowMessageRequestClientCapabilities `json:"showMessage,omitempty"`
5823+ // Capabilities specific to the showDocument request.
5824+ //
5825+ // @since 3.16.0
5826+ ShowDocument *ShowDocumentClientCapabilities `json:"showDocument,omitempty"`
5827+}
5828+
5829+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workDoneProgressBegin
5830+type WorkDoneProgressBegin struct {
5831+ Kind string `json:"kind"`
5832+ // Mandatory title of the progress operation. Used to briefly inform about
5833+ // the kind of operation being performed.
5834+ //
5835+ // Examples: "Indexing" or "Linking dependencies".
5836+ Title string `json:"title"`
5837+ // Controls if a cancel button should show to allow the user to cancel the
5838+ // long running operation. Clients that don't support cancellation are allowed
5839+ // to ignore the setting.
5840+ Cancellable bool `json:"cancellable,omitempty"`
5841+ // Optional, more detailed associated progress message. Contains
5842+ // complementary information to the `title`.
5843+ //
5844+ // Examples: "3/25 files", "project/src/module2", "node_modules/some_dep".
5845+ // If unset, the previous progress message (if any) is still valid.
5846+ Message string `json:"message,omitempty"`
5847+ // Optional progress percentage to display (value 100 is considered 100%).
5848+ // If not provided infinite progress is assumed and clients are allowed
5849+ // to ignore the `percentage` value in subsequent in report notifications.
5850+ //
5851+ // The value should be steadily rising. Clients are free to ignore values
5852+ // that are not following this rule. The value range is [0, 100].
5853+ Percentage uint32 `json:"percentage,omitempty"`
5854+}
5855+
5856+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workDoneProgressCancelParams
5857+type WorkDoneProgressCancelParams struct {
5858+ // The token to be used to report progress.
5859+ Token ProgressToken `json:"token"`
5860+}
5861+
5862+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workDoneProgressCreateParams
5863+type WorkDoneProgressCreateParams struct {
5864+ // The token to be used to report progress.
5865+ Token ProgressToken `json:"token"`
5866+}
5867+
5868+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workDoneProgressEnd
5869+type WorkDoneProgressEnd struct {
5870+ Kind string `json:"kind"`
5871+ // Optional, a final message indicating to for example indicate the outcome
5872+ // of the operation.
5873+ Message string `json:"message,omitempty"`
5874+}
5875+
5876+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workDoneProgressOptions
5877+type WorkDoneProgressOptions struct {
5878+ WorkDoneProgress bool `json:"workDoneProgress,omitempty"`
5879+}
5880+
5881+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workDoneProgressParams
5882+type WorkDoneProgressParams struct {
5883+ // An optional token that a server can use to report work done progress.
5884+ WorkDoneToken ProgressToken `json:"workDoneToken,omitempty"`
5885+}
5886+
5887+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workDoneProgressReport
5888+type WorkDoneProgressReport struct {
5889+ Kind string `json:"kind"`
5890+ // Controls enablement state of a cancel button.
5891+ //
5892+ // Clients that don't support cancellation or don't support controlling the button's
5893+ // enablement state are allowed to ignore the property.
5894+ Cancellable bool `json:"cancellable,omitempty"`
5895+ // Optional, more detailed associated progress message. Contains
5896+ // complementary information to the `title`.
5897+ //
5898+ // Examples: "3/25 files", "project/src/module2", "node_modules/some_dep".
5899+ // If unset, the previous progress message (if any) is still valid.
5900+ Message string `json:"message,omitempty"`
5901+ // Optional progress percentage to display (value 100 is considered 100%).
5902+ // If not provided infinite progress is assumed and clients are allowed
5903+ // to ignore the `percentage` value in subsequent in report notifications.
5904+ //
5905+ // The value should be steadily rising. Clients are free to ignore values
5906+ // that are not following this rule. The value range is [0, 100]
5907+ Percentage uint32 `json:"percentage,omitempty"`
5908+}
5909+
5910+// Workspace specific client capabilities.
5911+//
5912+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceClientCapabilities
5913+type WorkspaceClientCapabilities struct {
5914+ // The client supports applying batch edits
5915+ // to the workspace by supporting the request
5916+ // 'workspace/applyEdit'
5917+ ApplyEdit bool `json:"applyEdit,omitempty"`
5918+ // Capabilities specific to `WorkspaceEdit`s.
5919+ WorkspaceEdit *WorkspaceEditClientCapabilities `json:"workspaceEdit,omitempty"`
5920+ // Capabilities specific to the `workspace/didChangeConfiguration` notification.
5921+ DidChangeConfiguration DidChangeConfigurationClientCapabilities `json:"didChangeConfiguration,omitempty"`
5922+ // Capabilities specific to the `workspace/didChangeWatchedFiles` notification.
5923+ DidChangeWatchedFiles DidChangeWatchedFilesClientCapabilities `json:"didChangeWatchedFiles,omitempty"`
5924+ // Capabilities specific to the `workspace/symbol` request.
5925+ Symbol *WorkspaceSymbolClientCapabilities `json:"symbol,omitempty"`
5926+ // Capabilities specific to the `workspace/executeCommand` request.
5927+ ExecuteCommand *ExecuteCommandClientCapabilities `json:"executeCommand,omitempty"`
5928+ // The client has support for workspace folders.
5929+ //
5930+ // @since 3.6.0
5931+ WorkspaceFolders bool `json:"workspaceFolders,omitempty"`
5932+ // The client supports `workspace/configuration` requests.
5933+ //
5934+ // @since 3.6.0
5935+ Configuration bool `json:"configuration,omitempty"`
5936+ // Capabilities specific to the semantic token requests scoped to the
5937+ // workspace.
5938+ //
5939+ // @since 3.16.0.
5940+ SemanticTokens *SemanticTokensWorkspaceClientCapabilities `json:"semanticTokens,omitempty"`
5941+ // Capabilities specific to the code lens requests scoped to the
5942+ // workspace.
5943+ //
5944+ // @since 3.16.0.
5945+ CodeLens *CodeLensWorkspaceClientCapabilities `json:"codeLens,omitempty"`
5946+ // The client has support for file notifications/requests for user operations on files.
5947+ //
5948+ // Since 3.16.0
5949+ FileOperations *FileOperationClientCapabilities `json:"fileOperations,omitempty"`
5950+ // Capabilities specific to the inline values requests scoped to the
5951+ // workspace.
5952+ //
5953+ // @since 3.17.0.
5954+ InlineValue *InlineValueWorkspaceClientCapabilities `json:"inlineValue,omitempty"`
5955+ // Capabilities specific to the inlay hint requests scoped to the
5956+ // workspace.
5957+ //
5958+ // @since 3.17.0.
5959+ InlayHint *InlayHintWorkspaceClientCapabilities `json:"inlayHint,omitempty"`
5960+ // Capabilities specific to the diagnostic requests scoped to the
5961+ // workspace.
5962+ //
5963+ // @since 3.17.0.
5964+ Diagnostics *DiagnosticWorkspaceClientCapabilities `json:"diagnostics,omitempty"`
5965+ // Capabilities specific to the folding range requests scoped to the workspace.
5966+ //
5967+ // @since 3.18.0
5968+ // @proposed
5969+ FoldingRange *FoldingRangeWorkspaceClientCapabilities `json:"foldingRange,omitempty"`
5970+ // Capabilities specific to the `workspace/textDocumentContent` request.
5971+ //
5972+ // @since 3.18.0
5973+ // @proposed
5974+ TextDocumentContent *TextDocumentContentClientCapabilities `json:"textDocumentContent,omitempty"`
5975+}
5976+
5977+// Parameters of the workspace diagnostic request.
5978+//
5979+// @since 3.17.0
5980+//
5981+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceDiagnosticParams
5982+type WorkspaceDiagnosticParams struct {
5983+ // The additional identifier provided during registration.
5984+ Identifier string `json:"identifier,omitempty"`
5985+ // The currently known diagnostic reports with their
5986+ // previous result ids.
5987+ PreviousResultIds []PreviousResultId `json:"previousResultIds"`
5988+ WorkDoneProgressParams
5989+ PartialResultParams
5990+}
5991+
5992+// A workspace diagnostic report.
5993+//
5994+// @since 3.17.0
5995+//
5996+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceDiagnosticReport
5997+type WorkspaceDiagnosticReport struct {
5998+ Items []WorkspaceDocumentDiagnosticReport `json:"items"`
5999+}
6000+
6001+// A partial result for a workspace diagnostic report.
6002+//
6003+// @since 3.17.0
6004+//
6005+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceDiagnosticReportPartialResult
6006+type WorkspaceDiagnosticReportPartialResult struct {
6007+ Items []WorkspaceDocumentDiagnosticReport `json:"items"`
6008+}
6009+
6010+// A workspace diagnostic document report.
6011+//
6012+// @since 3.17.0
6013+//
6014+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceDocumentDiagnosticReport
6015+type WorkspaceDocumentDiagnosticReport = Or_WorkspaceDocumentDiagnosticReport // (alias)
6016+// A workspace edit represents changes to many resources managed in the workspace. The edit
6017+// should either provide `changes` or `documentChanges`. If documentChanges are present
6018+// they are preferred over `changes` if the client can handle versioned document edits.
6019+//
6020+// Since version 3.13.0 a workspace edit can contain resource operations as well. If resource
6021+// operations are present clients need to execute the operations in the order in which they
6022+// are provided. So a workspace edit for example can consist of the following two changes:
6023+// (1) a create file a.txt and (2) a text document edit which insert text into file a.txt.
6024+//
6025+// An invalid sequence (e.g. (1) delete file a.txt and (2) insert text into file a.txt) will
6026+// cause failure of the operation. How the client recovers from the failure is described by
6027+// the client capability: `workspace.workspaceEdit.failureHandling`
6028+//
6029+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceEdit
6030+type WorkspaceEdit struct {
6031+ // Holds changes to existing resources.
6032+ Changes map[DocumentUri][]TextEdit `json:"changes,omitempty"`
6033+ // Depending on the client capability `workspace.workspaceEdit.resourceOperations` document changes
6034+ // are either an array of `TextDocumentEdit`s to express changes to n different text documents
6035+ // where each text document edit addresses a specific version of a text document. Or it can contain
6036+ // above `TextDocumentEdit`s mixed with create, rename and delete file / folder operations.
6037+ //
6038+ // Whether a client supports versioned document edits is expressed via
6039+ // `workspace.workspaceEdit.documentChanges` client capability.
6040+ //
6041+ // If a client neither supports `documentChanges` nor `workspace.workspaceEdit.resourceOperations` then
6042+ // only plain `TextEdit`s using the `changes` property are supported.
6043+ DocumentChanges []DocumentChange `json:"documentChanges,omitempty"`
6044+ // A map of change annotations that can be referenced in `AnnotatedTextEdit`s or create, rename and
6045+ // delete file / folder operations.
6046+ //
6047+ // Whether clients honor this property depends on the client capability `workspace.changeAnnotationSupport`.
6048+ //
6049+ // @since 3.16.0
6050+ ChangeAnnotations map[ChangeAnnotationIdentifier]ChangeAnnotation `json:"changeAnnotations,omitempty"`
6051+}
6052+
6053+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceEditClientCapabilities
6054+type WorkspaceEditClientCapabilities struct {
6055+ // The client supports versioned document changes in `WorkspaceEdit`s
6056+ DocumentChanges bool `json:"documentChanges,omitempty"`
6057+ // The resource operations the client supports. Clients should at least
6058+ // support 'create', 'rename' and 'delete' files and folders.
6059+ //
6060+ // @since 3.13.0
6061+ ResourceOperations []ResourceOperationKind `json:"resourceOperations,omitempty"`
6062+ // The failure handling strategy of a client if applying the workspace edit
6063+ // fails.
6064+ //
6065+ // @since 3.13.0
6066+ FailureHandling *FailureHandlingKind `json:"failureHandling,omitempty"`
6067+ // Whether the client normalizes line endings to the client specific
6068+ // setting.
6069+ // If set to `true` the client will normalize line ending characters
6070+ // in a workspace edit to the client-specified new line
6071+ // character.
6072+ //
6073+ // @since 3.16.0
6074+ NormalizesLineEndings bool `json:"normalizesLineEndings,omitempty"`
6075+ // Whether the client in general supports change annotations on text edits,
6076+ // create file, rename file and delete file changes.
6077+ //
6078+ // @since 3.16.0
6079+ ChangeAnnotationSupport *ChangeAnnotationsSupportOptions `json:"changeAnnotationSupport,omitempty"`
6080+ // Whether the client supports `WorkspaceEditMetadata` in `WorkspaceEdit`s.
6081+ //
6082+ // @since 3.18.0
6083+ // @proposed
6084+ MetadataSupport bool `json:"metadataSupport,omitempty"`
6085+ // Whether the client supports snippets as text edits.
6086+ //
6087+ // @since 3.18.0
6088+ // @proposed
6089+ SnippetEditSupport bool `json:"snippetEditSupport,omitempty"`
6090+}
6091+
6092+// Additional data about a workspace edit.
6093+//
6094+// @since 3.18.0
6095+// @proposed
6096+//
6097+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceEditMetadata
6098+type WorkspaceEditMetadata struct {
6099+ // Signal to the editor that this edit is a refactoring.
6100+ IsRefactoring bool `json:"isRefactoring,omitempty"`
6101+}
6102+
6103+// A workspace folder inside a client.
6104+//
6105+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceFolder
6106+type WorkspaceFolder struct {
6107+ // The associated URI for this workspace folder.
6108+ URI URI `json:"uri"`
6109+ // The name of the workspace folder. Used to refer to this
6110+ // workspace folder in the user interface.
6111+ Name string `json:"name"`
6112+}
6113+
6114+// The workspace folder change event.
6115+//
6116+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceFoldersChangeEvent
6117+type WorkspaceFoldersChangeEvent struct {
6118+ // The array of added workspace folders
6119+ Added []WorkspaceFolder `json:"added"`
6120+ // The array of the removed workspace folders
6121+ Removed []WorkspaceFolder `json:"removed"`
6122+}
6123+
6124+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceFoldersInitializeParams
6125+type WorkspaceFoldersInitializeParams struct {
6126+ // The workspace folders configured in the client when the server starts.
6127+ //
6128+ // This property is only available if the client supports workspace folders.
6129+ // It can be `null` if the client supports workspace folders but none are
6130+ // configured.
6131+ //
6132+ // @since 3.6.0
6133+ WorkspaceFolders []WorkspaceFolder `json:"workspaceFolders,omitempty"`
6134+}
6135+
6136+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceFoldersServerCapabilities
6137+type WorkspaceFoldersServerCapabilities struct {
6138+ // The server has support for workspace folders
6139+ Supported bool `json:"supported,omitempty"`
6140+ // Whether the server wants to receive workspace folder
6141+ // change notifications.
6142+ //
6143+ // If a string is provided the string is treated as an ID
6144+ // under which the notification is registered on the client
6145+ // side. The ID can be used to unregister for these events
6146+ // using the `client/unregisterCapability` request.
6147+ ChangeNotifications *Or_WorkspaceFoldersServerCapabilities_changeNotifications `json:"changeNotifications,omitempty"`
6148+}
6149+
6150+// A full document diagnostic report for a workspace diagnostic result.
6151+//
6152+// @since 3.17.0
6153+//
6154+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceFullDocumentDiagnosticReport
6155+type WorkspaceFullDocumentDiagnosticReport struct {
6156+ // The URI for which diagnostic information is reported.
6157+ URI DocumentUri `json:"uri"`
6158+ // The version number for which the diagnostics are reported.
6159+ // If the document is not marked as open `null` can be provided.
6160+ Version int32 `json:"version"`
6161+ FullDocumentDiagnosticReport
6162+}
6163+
6164+// Defines workspace specific capabilities of the server.
6165+//
6166+// @since 3.18.0
6167+//
6168+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceOptions
6169+type WorkspaceOptions struct {
6170+ // The server supports workspace folder.
6171+ //
6172+ // @since 3.6.0
6173+ WorkspaceFolders *WorkspaceFoldersServerCapabilities `json:"workspaceFolders,omitempty"`
6174+ // The server is interested in notifications/requests for operations on files.
6175+ //
6176+ // @since 3.16.0
6177+ FileOperations *FileOperationOptions `json:"fileOperations,omitempty"`
6178+ // The server supports the `workspace/textDocumentContent` request.
6179+ //
6180+ // @since 3.18.0
6181+ // @proposed
6182+ TextDocumentContent *Or_WorkspaceOptions_textDocumentContent `json:"textDocumentContent,omitempty"`
6183+}
6184+
6185+// A special workspace symbol that supports locations without a range.
6186+//
6187+// See also SymbolInformation.
6188+//
6189+// @since 3.17.0
6190+//
6191+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceSymbol
6192+type WorkspaceSymbol struct {
6193+ // The location of the symbol. Whether a server is allowed to
6194+ // return a location without a range depends on the client
6195+ // capability `workspace.symbol.resolveSupport`.
6196+ //
6197+ // See SymbolInformation#location for more details.
6198+ Location Or_WorkspaceSymbol_location `json:"location"`
6199+ // A data entry field that is preserved on a workspace symbol between a
6200+ // workspace symbol request and a workspace symbol resolve request.
6201+ Data interface{} `json:"data,omitempty"`
6202+ BaseSymbolInformation
6203+}
6204+
6205+// Client capabilities for a {@link WorkspaceSymbolRequest}.
6206+//
6207+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceSymbolClientCapabilities
6208+type WorkspaceSymbolClientCapabilities struct {
6209+ // Symbol request supports dynamic registration.
6210+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
6211+ // Specific capabilities for the `SymbolKind` in the `workspace/symbol` request.
6212+ SymbolKind *ClientSymbolKindOptions `json:"symbolKind,omitempty"`
6213+ // The client supports tags on `SymbolInformation`.
6214+ // Clients supporting tags have to handle unknown tags gracefully.
6215+ //
6216+ // @since 3.16.0
6217+ TagSupport *ClientSymbolTagOptions `json:"tagSupport,omitempty"`
6218+ // The client support partial workspace symbols. The client will send the
6219+ // request `workspaceSymbol/resolve` to the server to resolve additional
6220+ // properties.
6221+ //
6222+ // @since 3.17.0
6223+ ResolveSupport *ClientSymbolResolveOptions `json:"resolveSupport,omitempty"`
6224+}
6225+
6226+// Server capabilities for a {@link WorkspaceSymbolRequest}.
6227+//
6228+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceSymbolOptions
6229+type WorkspaceSymbolOptions struct {
6230+ // The server provides support to resolve additional
6231+ // information for a workspace symbol.
6232+ //
6233+ // @since 3.17.0
6234+ ResolveProvider bool `json:"resolveProvider,omitempty"`
6235+ WorkDoneProgressOptions
6236+}
6237+
6238+// The parameters of a {@link WorkspaceSymbolRequest}.
6239+//
6240+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceSymbolParams
6241+type WorkspaceSymbolParams struct {
6242+ // A query string to filter symbols by. Clients may send an empty
6243+ // string here to request all symbols.
6244+ //
6245+ // The `query`-parameter should be interpreted in a *relaxed way* as editors
6246+ // will apply their own highlighting and scoring on the results. A good rule
6247+ // of thumb is to match case-insensitive and to simply check that the
6248+ // characters of *query* appear in their order in a candidate symbol.
6249+ // Servers shouldn't use prefix, substring, or similar strict matching.
6250+ Query string `json:"query"`
6251+ WorkDoneProgressParams
6252+ PartialResultParams
6253+}
6254+
6255+// Registration options for a {@link WorkspaceSymbolRequest}.
6256+//
6257+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceSymbolRegistrationOptions
6258+type WorkspaceSymbolRegistrationOptions struct {
6259+ WorkspaceSymbolOptions
6260+}
6261+
6262+// An unchanged document diagnostic report for a workspace diagnostic result.
6263+//
6264+// @since 3.17.0
6265+//
6266+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceUnchangedDocumentDiagnosticReport
6267+type WorkspaceUnchangedDocumentDiagnosticReport struct {
6268+ // The URI for which diagnostic information is reported.
6269+ URI DocumentUri `json:"uri"`
6270+ // The version number for which the diagnostics are reported.
6271+ // If the document is not marked as open `null` can be provided.
6272+ Version int32 `json:"version"`
6273+ UnchangedDocumentDiagnosticReport
6274+}
6275+
6276+// The initialize parameters
6277+//
6278+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#_InitializeParams
6279+type XInitializeParams struct {
6280+ // The process Id of the parent process that started
6281+ // the server.
6282+ //
6283+ // Is `null` if the process has not been started by another process.
6284+ // If the parent process is not alive then the server should exit.
6285+ ProcessID int32 `json:"processId"`
6286+ // Information about the client
6287+ //
6288+ // @since 3.15.0
6289+ ClientInfo *ClientInfo `json:"clientInfo,omitempty"`
6290+ // The locale the client is currently showing the user interface
6291+ // in. This must not necessarily be the locale of the operating
6292+ // system.
6293+ //
6294+ // Uses IETF language tags as the value's syntax
6295+ // (See https://en.wikipedia.org/wiki/IETF_language_tag)
6296+ //
6297+ // @since 3.16.0
6298+ Locale string `json:"locale,omitempty"`
6299+ // The rootPath of the workspace. Is null
6300+ // if no folder is open.
6301+ //
6302+ // @deprecated in favour of rootUri.
6303+ RootPath string `json:"rootPath,omitempty"`
6304+ // The rootUri of the workspace. Is null if no
6305+ // folder is open. If both `rootPath` and `rootUri` are set
6306+ // `rootUri` wins.
6307+ //
6308+ // @deprecated in favour of workspaceFolders.
6309+ RootURI DocumentUri `json:"rootUri"`
6310+ // The capabilities provided by the client (editor or tool)
6311+ Capabilities ClientCapabilities `json:"capabilities"`
6312+ // User provided initialization options.
6313+ InitializationOptions interface{} `json:"initializationOptions,omitempty"`
6314+ // The initial trace setting. If omitted trace is disabled ('off').
6315+ Trace *TraceValue `json:"trace,omitempty"`
6316+ WorkDoneProgressParams
6317+}
6318+
6319+// The initialize parameters
6320+//
6321+// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#_InitializeParams
6322+type _InitializeParams struct {
6323+ // The process Id of the parent process that started
6324+ // the server.
6325+ //
6326+ // Is `null` if the process has not been started by another process.
6327+ // If the parent process is not alive then the server should exit.
6328+ ProcessID int32 `json:"processId"`
6329+ // Information about the client
6330+ //
6331+ // @since 3.15.0
6332+ ClientInfo *ClientInfo `json:"clientInfo,omitempty"`
6333+ // The locale the client is currently showing the user interface
6334+ // in. This must not necessarily be the locale of the operating
6335+ // system.
6336+ //
6337+ // Uses IETF language tags as the value's syntax
6338+ // (See https://en.wikipedia.org/wiki/IETF_language_tag)
6339+ //
6340+ // @since 3.16.0
6341+ Locale string `json:"locale,omitempty"`
6342+ // The rootPath of the workspace. Is null
6343+ // if no folder is open.
6344+ //
6345+ // @deprecated in favour of rootUri.
6346+ RootPath string `json:"rootPath,omitempty"`
6347+ // The rootUri of the workspace. Is null if no
6348+ // folder is open. If both `rootPath` and `rootUri` are set
6349+ // `rootUri` wins.
6350+ //
6351+ // @deprecated in favour of workspaceFolders.
6352+ RootURI DocumentUri `json:"rootUri"`
6353+ // The capabilities provided by the client (editor or tool)
6354+ Capabilities ClientCapabilities `json:"capabilities"`
6355+ // User provided initialization options.
6356+ InitializationOptions interface{} `json:"initializationOptions,omitempty"`
6357+ // The initial trace setting. If omitted trace is disabled ('off').
6358+ Trace *TraceValue `json:"trace,omitempty"`
6359+ WorkDoneProgressParams
6360+}
6361+
6362+const (
6363+ // A set of predefined code action kinds
6364+ // Empty kind.
6365+ Empty CodeActionKind = ""
6366+ // Base kind for quickfix actions: 'quickfix'
6367+ QuickFix CodeActionKind = "quickfix"
6368+ // Base kind for refactoring actions: 'refactor'
6369+ Refactor CodeActionKind = "refactor"
6370+ // Base kind for refactoring extraction actions: 'refactor.extract'
6371+ //
6372+ // Example extract actions:
6373+ //
6374+ //
6375+ // - Extract method
6376+ // - Extract function
6377+ // - Extract variable
6378+ // - Extract interface from class
6379+ // - ...
6380+ RefactorExtract CodeActionKind = "refactor.extract"
6381+ // Base kind for refactoring inline actions: 'refactor.inline'
6382+ //
6383+ // Example inline actions:
6384+ //
6385+ //
6386+ // - Inline function
6387+ // - Inline variable
6388+ // - Inline constant
6389+ // - ...
6390+ RefactorInline CodeActionKind = "refactor.inline"
6391+ // Base kind for refactoring move actions: `refactor.move`
6392+ //
6393+ // Example move actions:
6394+ //
6395+ //
6396+ // - Move a function to a new file
6397+ // - Move a property between classes
6398+ // - Move method to base class
6399+ // - ...
6400+ //
6401+ // @since 3.18.0
6402+ // @proposed
6403+ RefactorMove CodeActionKind = "refactor.move"
6404+ // Base kind for refactoring rewrite actions: 'refactor.rewrite'
6405+ //
6406+ // Example rewrite actions:
6407+ //
6408+ //
6409+ // - Convert JavaScript function to class
6410+ // - Add or remove parameter
6411+ // - Encapsulate field
6412+ // - Make method static
6413+ // - Move method to base class
6414+ // - ...
6415+ RefactorRewrite CodeActionKind = "refactor.rewrite"
6416+ // Base kind for source actions: `source`
6417+ //
6418+ // Source code actions apply to the entire file.
6419+ Source CodeActionKind = "source"
6420+ // Base kind for an organize imports source action: `source.organizeImports`
6421+ SourceOrganizeImports CodeActionKind = "source.organizeImports"
6422+ // Base kind for auto-fix source actions: `source.fixAll`.
6423+ //
6424+ // Fix all actions automatically fix errors that have a clear fix that do not require user input.
6425+ // They should not suppress errors or perform unsafe fixes such as generating new types or classes.
6426+ //
6427+ // @since 3.15.0
6428+ SourceFixAll CodeActionKind = "source.fixAll"
6429+ // Base kind for all code actions applying to the entire notebook's scope. CodeActionKinds using
6430+ // this should always begin with `notebook.`
6431+ //
6432+ // @since 3.18.0
6433+ Notebook CodeActionKind = "notebook"
6434+ // The reason why code actions were requested.
6435+ //
6436+ // @since 3.17.0
6437+ // Code actions were explicitly requested by the user or by an extension.
6438+ CodeActionInvoked CodeActionTriggerKind = 1
6439+ // Code actions were requested automatically.
6440+ //
6441+ // This typically happens when current selection in a file changes, but can
6442+ // also be triggered when file content changes.
6443+ CodeActionAutomatic CodeActionTriggerKind = 2
6444+ // The kind of a completion entry.
6445+ TextCompletion CompletionItemKind = 1
6446+ MethodCompletion CompletionItemKind = 2
6447+ FunctionCompletion CompletionItemKind = 3
6448+ ConstructorCompletion CompletionItemKind = 4
6449+ FieldCompletion CompletionItemKind = 5
6450+ VariableCompletion CompletionItemKind = 6
6451+ ClassCompletion CompletionItemKind = 7
6452+ InterfaceCompletion CompletionItemKind = 8
6453+ ModuleCompletion CompletionItemKind = 9
6454+ PropertyCompletion CompletionItemKind = 10
6455+ UnitCompletion CompletionItemKind = 11
6456+ ValueCompletion CompletionItemKind = 12
6457+ EnumCompletion CompletionItemKind = 13
6458+ KeywordCompletion CompletionItemKind = 14
6459+ SnippetCompletion CompletionItemKind = 15
6460+ ColorCompletion CompletionItemKind = 16
6461+ FileCompletion CompletionItemKind = 17
6462+ ReferenceCompletion CompletionItemKind = 18
6463+ FolderCompletion CompletionItemKind = 19
6464+ EnumMemberCompletion CompletionItemKind = 20
6465+ ConstantCompletion CompletionItemKind = 21
6466+ StructCompletion CompletionItemKind = 22
6467+ EventCompletion CompletionItemKind = 23
6468+ OperatorCompletion CompletionItemKind = 24
6469+ TypeParameterCompletion CompletionItemKind = 25
6470+ // Completion item tags are extra annotations that tweak the rendering of a completion
6471+ // item.
6472+ //
6473+ // @since 3.15.0
6474+ // Render a completion as obsolete, usually using a strike-out.
6475+ ComplDeprecated CompletionItemTag = 1
6476+ // How a completion was triggered
6477+ // Completion was triggered by typing an identifier (24x7 code
6478+ // complete), manual invocation (e.g Ctrl+Space) or via API.
6479+ Invoked CompletionTriggerKind = 1
6480+ // Completion was triggered by a trigger character specified by
6481+ // the `triggerCharacters` properties of the `CompletionRegistrationOptions`.
6482+ TriggerCharacter CompletionTriggerKind = 2
6483+ // Completion was re-triggered as current completion list is incomplete
6484+ TriggerForIncompleteCompletions CompletionTriggerKind = 3
6485+ // The diagnostic's severity.
6486+ // Reports an error.
6487+ SeverityError DiagnosticSeverity = 1
6488+ // Reports a warning.
6489+ SeverityWarning DiagnosticSeverity = 2
6490+ // Reports an information.
6491+ SeverityInformation DiagnosticSeverity = 3
6492+ // Reports a hint.
6493+ SeverityHint DiagnosticSeverity = 4
6494+ // The diagnostic tags.
6495+ //
6496+ // @since 3.15.0
6497+ // Unused or unnecessary code.
6498+ //
6499+ // Clients are allowed to render diagnostics with this tag faded out instead of having
6500+ // an error squiggle.
6501+ Unnecessary DiagnosticTag = 1
6502+ // Deprecated or obsolete code.
6503+ //
6504+ // Clients are allowed to rendered diagnostics with this tag strike through.
6505+ Deprecated DiagnosticTag = 2
6506+ // The document diagnostic report kinds.
6507+ //
6508+ // @since 3.17.0
6509+ // A diagnostic report with a full
6510+ // set of problems.
6511+ DiagnosticFull DocumentDiagnosticReportKind = "full"
6512+ // A report indicating that the last
6513+ // returned report is still accurate.
6514+ DiagnosticUnchanged DocumentDiagnosticReportKind = "unchanged"
6515+ // A document highlight kind.
6516+ // A textual occurrence.
6517+ Text DocumentHighlightKind = 1
6518+ // Read-access of a symbol, like reading a variable.
6519+ Read DocumentHighlightKind = 2
6520+ // Write-access of a symbol, like writing to a variable.
6521+ Write DocumentHighlightKind = 3
6522+ // Predefined error codes.
6523+ ParseError ErrorCodes = -32700
6524+ InvalidRequest ErrorCodes = -32600
6525+ MethodNotFound ErrorCodes = -32601
6526+ InvalidParams ErrorCodes = -32602
6527+ InternalError ErrorCodes = -32603
6528+ // Error code indicating that a server received a notification or
6529+ // request before the server has received the `initialize` request.
6530+ ServerNotInitialized ErrorCodes = -32002
6531+ UnknownErrorCode ErrorCodes = -32001
6532+ // Applying the workspace change is simply aborted if one of the changes provided
6533+ // fails. All operations executed before the failing operation stay executed.
6534+ Abort FailureHandlingKind = "abort"
6535+ // All operations are executed transactional. That means they either all
6536+ // succeed or no changes at all are applied to the workspace.
6537+ Transactional FailureHandlingKind = "transactional"
6538+ // If the workspace edit contains only textual file changes they are executed transactional.
6539+ // If resource changes (create, rename or delete file) are part of the change the failure
6540+ // handling strategy is abort.
6541+ TextOnlyTransactional FailureHandlingKind = "textOnlyTransactional"
6542+ // The client tries to undo the operations already executed. But there is no
6543+ // guarantee that this is succeeding.
6544+ Undo FailureHandlingKind = "undo"
6545+ // The file event type
6546+ // The file got created.
6547+ Created FileChangeType = 1
6548+ // The file got changed.
6549+ Changed FileChangeType = 2
6550+ // The file got deleted.
6551+ Deleted FileChangeType = 3
6552+ // A pattern kind describing if a glob pattern matches a file a folder or
6553+ // both.
6554+ //
6555+ // @since 3.16.0
6556+ // The pattern matches a file only.
6557+ FilePattern FileOperationPatternKind = "file"
6558+ // The pattern matches a folder only.
6559+ FolderPattern FileOperationPatternKind = "folder"
6560+ // A set of predefined range kinds.
6561+ // Folding range for a comment
6562+ Comment FoldingRangeKind = "comment"
6563+ // Folding range for an import or include
6564+ Imports FoldingRangeKind = "imports"
6565+ // Folding range for a region (e.g. `#region`)
6566+ Region FoldingRangeKind = "region"
6567+ // Inlay hint kinds.
6568+ //
6569+ // @since 3.17.0
6570+ // An inlay hint that for a type annotation.
6571+ Type InlayHintKind = 1
6572+ // An inlay hint that is for a parameter.
6573+ Parameter InlayHintKind = 2
6574+ // Describes how an {@link InlineCompletionItemProvider inline completion provider} was triggered.
6575+ //
6576+ // @since 3.18.0
6577+ // @proposed
6578+ // Completion was triggered explicitly by a user gesture.
6579+ InlineInvoked InlineCompletionTriggerKind = 1
6580+ // Completion was triggered automatically while editing.
6581+ InlineAutomatic InlineCompletionTriggerKind = 2
6582+ // Defines whether the insert text in a completion item should be interpreted as
6583+ // plain text or a snippet.
6584+ // The primary text to be inserted is treated as a plain string.
6585+ PlainTextTextFormat InsertTextFormat = 1
6586+ // The primary text to be inserted is treated as a snippet.
6587+ //
6588+ // A snippet can define tab stops and placeholders with `$1`, `$2`
6589+ // and `${3:foo}`. `$0` defines the final tab stop, it defaults to
6590+ // the end of the snippet. Placeholders with equal identifiers are linked,
6591+ // that is typing in one will update others too.
6592+ //
6593+ // See also: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax
6594+ SnippetTextFormat InsertTextFormat = 2
6595+ // How whitespace and indentation is handled during completion
6596+ // item insertion.
6597+ //
6598+ // @since 3.16.0
6599+ // The insertion or replace strings is taken as it is. If the
6600+ // value is multi line the lines below the cursor will be
6601+ // inserted using the indentation defined in the string value.
6602+ // The client will not apply any kind of adjustments to the
6603+ // string.
6604+ AsIs InsertTextMode = 1
6605+ // The editor adjusts leading whitespace of new lines so that
6606+ // they match the indentation up to the cursor of the line for
6607+ // which the item is accepted.
6608+ //
6609+ // Consider a line like this: <2tabs><cursor><3tabs>foo. Accepting a
6610+ // multi line completion item is indented using 2 tabs and all
6611+ // following lines inserted will be indented using 2 tabs as well.
6612+ AdjustIndentation InsertTextMode = 2
6613+ // A request failed but it was syntactically correct, e.g the
6614+ // method name was known and the parameters were valid. The error
6615+ // message should contain human readable information about why
6616+ // the request failed.
6617+ //
6618+ // @since 3.17.0
6619+ RequestFailed LSPErrorCodes = -32803
6620+ // The server cancelled the request. This error code should
6621+ // only be used for requests that explicitly support being
6622+ // server cancellable.
6623+ //
6624+ // @since 3.17.0
6625+ ServerCancelled LSPErrorCodes = -32802
6626+ // The server detected that the content of a document got
6627+ // modified outside normal conditions. A server should
6628+ // NOT send this error code if it detects a content change
6629+ // in it unprocessed messages. The result even computed
6630+ // on an older state might still be useful for the client.
6631+ //
6632+ // If a client decides that a result is not of any use anymore
6633+ // the client should cancel the request.
6634+ ContentModified LSPErrorCodes = -32801
6635+ // The client has canceled a request and a server has detected
6636+ // the cancel.
6637+ RequestCancelled LSPErrorCodes = -32800
6638+ // Predefined Language kinds
6639+ // @since 3.18.0
6640+ // @proposed
6641+ LangABAP LanguageKind = "abap"
6642+ LangWindowsBat LanguageKind = "bat"
6643+ LangBibTeX LanguageKind = "bibtex"
6644+ LangClojure LanguageKind = "clojure"
6645+ LangCoffeescript LanguageKind = "coffeescript"
6646+ LangC LanguageKind = "c"
6647+ LangCPP LanguageKind = "cpp"
6648+ LangCSharp LanguageKind = "csharp"
6649+ LangCSS LanguageKind = "css"
6650+ // @since 3.18.0
6651+ // @proposed
6652+ LangD LanguageKind = "d"
6653+ // @since 3.18.0
6654+ // @proposed
6655+ LangDelphi LanguageKind = "pascal"
6656+ LangDiff LanguageKind = "diff"
6657+ LangDart LanguageKind = "dart"
6658+ LangDockerfile LanguageKind = "dockerfile"
6659+ LangElixir LanguageKind = "elixir"
6660+ LangErlang LanguageKind = "erlang"
6661+ LangFSharp LanguageKind = "fsharp"
6662+ LangGitCommit LanguageKind = "git-commit"
6663+ LangGitRebase LanguageKind = "rebase"
6664+ LangGo LanguageKind = "go"
6665+ LangGroovy LanguageKind = "groovy"
6666+ LangHandlebars LanguageKind = "handlebars"
6667+ LangHaskell LanguageKind = "haskell"
6668+ LangHTML LanguageKind = "html"
6669+ LangIni LanguageKind = "ini"
6670+ LangJava LanguageKind = "java"
6671+ LangJavaScript LanguageKind = "javascript"
6672+ LangJavaScriptReact LanguageKind = "javascriptreact"
6673+ LangJSON LanguageKind = "json"
6674+ LangLaTeX LanguageKind = "latex"
6675+ LangLess LanguageKind = "less"
6676+ LangLua LanguageKind = "lua"
6677+ LangMakefile LanguageKind = "makefile"
6678+ LangMarkdown LanguageKind = "markdown"
6679+ LangObjectiveC LanguageKind = "objective-c"
6680+ LangObjectiveCPP LanguageKind = "objective-cpp"
6681+ // @since 3.18.0
6682+ // @proposed
6683+ LangPascal LanguageKind = "pascal"
6684+ LangPerl LanguageKind = "perl"
6685+ LangPerl6 LanguageKind = "perl6"
6686+ LangPHP LanguageKind = "php"
6687+ LangPowershell LanguageKind = "powershell"
6688+ LangPug LanguageKind = "jade"
6689+ LangPython LanguageKind = "python"
6690+ LangR LanguageKind = "r"
6691+ LangRazor LanguageKind = "razor"
6692+ LangRuby LanguageKind = "ruby"
6693+ LangRust LanguageKind = "rust"
6694+ LangSCSS LanguageKind = "scss"
6695+ LangSASS LanguageKind = "sass"
6696+ LangScala LanguageKind = "scala"
6697+ LangShaderLab LanguageKind = "shaderlab"
6698+ LangShellScript LanguageKind = "shellscript"
6699+ LangSQL LanguageKind = "sql"
6700+ LangSwift LanguageKind = "swift"
6701+ LangTypeScript LanguageKind = "typescript"
6702+ LangTypeScriptReact LanguageKind = "typescriptreact"
6703+ LangTeX LanguageKind = "tex"
6704+ LangVisualBasic LanguageKind = "vb"
6705+ LangXML LanguageKind = "xml"
6706+ LangXSL LanguageKind = "xsl"
6707+ LangYAML LanguageKind = "yaml"
6708+ // Describes the content type that a client supports in various
6709+ // result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
6710+ //
6711+ // Please note that `MarkupKinds` must not start with a `$`. This kinds
6712+ // are reserved for internal usage.
6713+ // Plain text is supported as a content format
6714+ PlainText MarkupKind = "plaintext"
6715+ // Markdown is supported as a content format
6716+ Markdown MarkupKind = "markdown"
6717+ // The message type
6718+ // An error message.
6719+ Error MessageType = 1
6720+ // A warning message.
6721+ Warning MessageType = 2
6722+ // An information message.
6723+ Info MessageType = 3
6724+ // A log message.
6725+ Log MessageType = 4
6726+ // A debug message.
6727+ //
6728+ // @since 3.18.0
6729+ // @proposed
6730+ Debug MessageType = 5
6731+ // The moniker kind.
6732+ //
6733+ // @since 3.16.0
6734+ // The moniker represent a symbol that is imported into a project
6735+ Import MonikerKind = "import"
6736+ // The moniker represents a symbol that is exported from a project
6737+ Export MonikerKind = "export"
6738+ // The moniker represents a symbol that is local to a project (e.g. a local
6739+ // variable of a function, a class not visible outside the project, ...)
6740+ Local MonikerKind = "local"
6741+ // A notebook cell kind.
6742+ //
6743+ // @since 3.17.0
6744+ // A markup-cell is formatted source that is used for display.
6745+ Markup NotebookCellKind = 1
6746+ // A code-cell is source code.
6747+ Code NotebookCellKind = 2
6748+ // A set of predefined position encoding kinds.
6749+ //
6750+ // @since 3.17.0
6751+ // Character offsets count UTF-8 code units (e.g. bytes).
6752+ UTF8 PositionEncodingKind = "utf-8"
6753+ // Character offsets count UTF-16 code units.
6754+ //
6755+ // This is the default and must always be supported
6756+ // by servers
6757+ UTF16 PositionEncodingKind = "utf-16"
6758+ // Character offsets count UTF-32 code units.
6759+ //
6760+ // Implementation note: these are the same as Unicode codepoints,
6761+ // so this `PositionEncodingKind` may also be used for an
6762+ // encoding-agnostic representation of character offsets.
6763+ UTF32 PositionEncodingKind = "utf-32"
6764+ // The client's default behavior is to select the identifier
6765+ // according the to language's syntax rule.
6766+ Identifier PrepareSupportDefaultBehavior = 1
6767+ // Supports creating new files and folders.
6768+ Create ResourceOperationKind = "create"
6769+ // Supports renaming existing files and folders.
6770+ Rename ResourceOperationKind = "rename"
6771+ // Supports deleting existing files and folders.
6772+ Delete ResourceOperationKind = "delete"
6773+ // A set of predefined token modifiers. This set is not fixed
6774+ // an clients can specify additional token types via the
6775+ // corresponding client capabilities.
6776+ //
6777+ // @since 3.16.0
6778+ ModDeclaration SemanticTokenModifiers = "declaration"
6779+ ModDefinition SemanticTokenModifiers = "definition"
6780+ ModReadonly SemanticTokenModifiers = "readonly"
6781+ ModStatic SemanticTokenModifiers = "static"
6782+ ModDeprecated SemanticTokenModifiers = "deprecated"
6783+ ModAbstract SemanticTokenModifiers = "abstract"
6784+ ModAsync SemanticTokenModifiers = "async"
6785+ ModModification SemanticTokenModifiers = "modification"
6786+ ModDocumentation SemanticTokenModifiers = "documentation"
6787+ ModDefaultLibrary SemanticTokenModifiers = "defaultLibrary"
6788+ // A set of predefined token types. This set is not fixed
6789+ // an clients can specify additional token types via the
6790+ // corresponding client capabilities.
6791+ //
6792+ // @since 3.16.0
6793+ NamespaceType SemanticTokenTypes = "namespace"
6794+ // Represents a generic type. Acts as a fallback for types which can't be mapped to
6795+ // a specific type like class or enum.
6796+ TypeType SemanticTokenTypes = "type"
6797+ ClassType SemanticTokenTypes = "class"
6798+ EnumType SemanticTokenTypes = "enum"
6799+ InterfaceType SemanticTokenTypes = "interface"
6800+ StructType SemanticTokenTypes = "struct"
6801+ TypeParameterType SemanticTokenTypes = "typeParameter"
6802+ ParameterType SemanticTokenTypes = "parameter"
6803+ VariableType SemanticTokenTypes = "variable"
6804+ PropertyType SemanticTokenTypes = "property"
6805+ EnumMemberType SemanticTokenTypes = "enumMember"
6806+ EventType SemanticTokenTypes = "event"
6807+ FunctionType SemanticTokenTypes = "function"
6808+ MethodType SemanticTokenTypes = "method"
6809+ MacroType SemanticTokenTypes = "macro"
6810+ KeywordType SemanticTokenTypes = "keyword"
6811+ ModifierType SemanticTokenTypes = "modifier"
6812+ CommentType SemanticTokenTypes = "comment"
6813+ StringType SemanticTokenTypes = "string"
6814+ NumberType SemanticTokenTypes = "number"
6815+ RegexpType SemanticTokenTypes = "regexp"
6816+ OperatorType SemanticTokenTypes = "operator"
6817+ // @since 3.17.0
6818+ DecoratorType SemanticTokenTypes = "decorator"
6819+ // @since 3.18.0
6820+ LabelType SemanticTokenTypes = "label"
6821+ // How a signature help was triggered.
6822+ //
6823+ // @since 3.15.0
6824+ // Signature help was invoked manually by the user or by a command.
6825+ SigInvoked SignatureHelpTriggerKind = 1
6826+ // Signature help was triggered by a trigger character.
6827+ SigTriggerCharacter SignatureHelpTriggerKind = 2
6828+ // Signature help was triggered by the cursor moving or by the document content changing.
6829+ SigContentChange SignatureHelpTriggerKind = 3
6830+ // A symbol kind.
6831+ File SymbolKind = 1
6832+ Module SymbolKind = 2
6833+ Namespace SymbolKind = 3
6834+ Package SymbolKind = 4
6835+ Class SymbolKind = 5
6836+ Method SymbolKind = 6
6837+ Property SymbolKind = 7
6838+ Field SymbolKind = 8
6839+ Constructor SymbolKind = 9
6840+ Enum SymbolKind = 10
6841+ Interface SymbolKind = 11
6842+ Function SymbolKind = 12
6843+ Variable SymbolKind = 13
6844+ Constant SymbolKind = 14
6845+ String SymbolKind = 15
6846+ Number SymbolKind = 16
6847+ Boolean SymbolKind = 17
6848+ Array SymbolKind = 18
6849+ Object SymbolKind = 19
6850+ Key SymbolKind = 20
6851+ Null SymbolKind = 21
6852+ EnumMember SymbolKind = 22
6853+ Struct SymbolKind = 23
6854+ Event SymbolKind = 24
6855+ Operator SymbolKind = 25
6856+ TypeParameter SymbolKind = 26
6857+ // Symbol tags are extra annotations that tweak the rendering of a symbol.
6858+ //
6859+ // @since 3.16
6860+ // Render a symbol as obsolete, usually using a strike-out.
6861+ DeprecatedSymbol SymbolTag = 1
6862+ // Represents reasons why a text document is saved.
6863+ // Manually triggered, e.g. by the user pressing save, by starting debugging,
6864+ // or by an API call.
6865+ Manual TextDocumentSaveReason = 1
6866+ // Automatic after a delay.
6867+ AfterDelay TextDocumentSaveReason = 2
6868+ // When the editor lost focus.
6869+ FocusOut TextDocumentSaveReason = 3
6870+ // Defines how the host (editor) should sync
6871+ // document changes to the language server.
6872+ // Documents should not be synced at all.
6873+ None TextDocumentSyncKind = 0
6874+ // Documents are synced by always sending the full content
6875+ // of the document.
6876+ Full TextDocumentSyncKind = 1
6877+ // Documents are synced by sending the full content on open.
6878+ // After that only incremental updates to the document are
6879+ // send.
6880+ Incremental TextDocumentSyncKind = 2
6881+ Relative TokenFormat = "relative"
6882+ // Turn tracing off.
6883+ Off TraceValue = "off"
6884+ // Trace messages only.
6885+ Messages TraceValue = "messages"
6886+ // Verbose message tracing.
6887+ Verbose TraceValue = "verbose"
6888+ // Moniker uniqueness level to define scope of the moniker.
6889+ //
6890+ // @since 3.16.0
6891+ // The moniker is only unique inside a document
6892+ Document UniquenessLevel = "document"
6893+ // The moniker is unique inside a project for which a dump got created
6894+ Project UniquenessLevel = "project"
6895+ // The moniker is unique inside the group to which a project belongs
6896+ Group UniquenessLevel = "group"
6897+ // The moniker is unique inside the moniker scheme.
6898+ Scheme UniquenessLevel = "scheme"
6899+ // The moniker is globally unique
6900+ Global UniquenessLevel = "global"
6901+ // Interested in create events.
6902+ WatchCreate WatchKind = 1
6903+ // Interested in change events
6904+ WatchChange WatchKind = 2
6905+ // Interested in delete events
6906+ WatchDelete WatchKind = 4
6907+)
internal/lsp/protocol/uri.gonew file+218
@@ -0,0 +1,218 @@
1+// Copyright 2023 The Go Authors. All rights reserved.
2+// Use of this source code is governed by a BSD-style
3+// license that can be found in the LICENSE file.
4+
5+package protocol
6+
7+// This file declares URI, DocumentUri, and its methods.
8+//
9+// For the LSP definition of these types, see
10+// https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#uri
11+
12+import (
13+ "fmt"
14+ "net/url"
15+ "path/filepath"
16+ "strings"
17+ "unicode"
18+)
19+
20+// A DocumentUri is the URI of a client editor document.
21+//
22+// According to the LSP specification:
23+//
24+// Care should be taken to handle encoding in URIs. For
25+// example, some clients (such as VS Code) may encode colons
26+// in drive letters while others do not. The URIs below are
27+// both valid, but clients and servers should be consistent
28+// with the form they use themselves to ensure the other party
29+// doesn’t interpret them as distinct URIs. Clients and
30+// servers should not assume that each other are encoding the
31+// same way (for example a client encoding colons in drive
32+// letters cannot assume server responses will have encoded
33+// colons). The same applies to casing of drive letters - one
34+// party should not assume the other party will return paths
35+// with drive letters cased the same as it.
36+//
37+// file:///c:/project/readme.md
38+// file:///C%3A/project/readme.md
39+//
40+// This is done during JSON unmarshalling;
41+// see [DocumentUri.UnmarshalText] for details.
42+type DocumentUri string
43+
44+// A URI is an arbitrary URL (e.g. https), not necessarily a file.
45+type URI = string
46+
47+// UnmarshalText implements decoding of DocumentUri values.
48+//
49+// In particular, it implements a systematic correction of various odd
50+// features of the definition of DocumentUri in the LSP spec that
51+// appear to be workarounds for bugs in VS Code. For example, it may
52+// URI-encode the URI itself, so that colon becomes %3A, and it may
53+// send file://foo.go URIs that have two slashes (not three) and no
54+// hostname.
55+//
56+// We use UnmarshalText, not UnmarshalJSON, because it is called even
57+// for non-addressable values such as keys and values of map[K]V,
58+// where there is no pointer of type *K or *V on which to call
59+// UnmarshalJSON. (See Go issue #28189 for more detail.)
60+//
61+// Non-empty DocumentUris are valid "file"-scheme URIs.
62+// The empty DocumentUri is valid.
63+func (uri *DocumentUri) UnmarshalText(data []byte) (err error) {
64+ *uri, err = ParseDocumentUri(string(data))
65+ return
66+}
67+
68+// Path returns the file path for the given URI.
69+//
70+// DocumentUri("").Path() returns the empty string.
71+//
72+// Path panics if called on a URI that is not a valid filename.
73+func (uri DocumentUri) Path() string {
74+ filename, err := filename(uri)
75+ if err != nil {
76+ // e.g. ParseRequestURI failed.
77+ //
78+ // This can only affect DocumentUris created by
79+ // direct string manipulation; all DocumentUris
80+ // received from the client pass through
81+ // ParseRequestURI, which ensures validity.
82+ panic(err)
83+ }
84+ return filepath.FromSlash(filename)
85+}
86+
87+// Dir returns the URI for the directory containing the receiver.
88+func (uri DocumentUri) Dir() DocumentUri {
89+ // This function could be more efficiently implemented by avoiding any call
90+ // to Path(), but at least consolidates URI manipulation.
91+ return URIFromPath(uri.DirPath())
92+}
93+
94+// DirPath returns the file path to the directory containing this URI, which
95+// must be a file URI.
96+func (uri DocumentUri) DirPath() string {
97+ return filepath.Dir(uri.Path())
98+}
99+
100+func filename(uri DocumentUri) (string, error) {
101+ if uri == "" {
102+ return "", nil
103+ }
104+
105+ // This conservative check for the common case
106+ // of a simple non-empty absolute POSIX filename
107+ // avoids the allocation of a net.URL.
108+ if strings.HasPrefix(string(uri), "file:///") {
109+ rest := string(uri)[len("file://"):] // leave one slash
110+ for i := range len(rest) {
111+ b := rest[i]
112+ // Reject these cases:
113+ if b < ' ' || b == 0x7f || // control character
114+ b == '%' || b == '+' || // URI escape
115+ b == ':' || // Windows drive letter
116+ b == '@' || b == '&' || b == '?' { // authority or query
117+ goto slow
118+ }
119+ }
120+ return rest, nil
121+ }
122+slow:
123+
124+ u, err := url.ParseRequestURI(string(uri))
125+ if err != nil {
126+ return "", err
127+ }
128+ if u.Scheme != fileScheme {
129+ return "", fmt.Errorf("only file URIs are supported, got %q from %q", u.Scheme, uri)
130+ }
131+ // If the URI is a Windows URI, we trim the leading "/" and uppercase
132+ // the drive letter, which will never be case sensitive.
133+ if isWindowsDriveURIPath(u.Path) {
134+ u.Path = strings.ToUpper(string(u.Path[1])) + u.Path[2:]
135+ }
136+
137+ return u.Path, nil
138+}
139+
140+// ParseDocumentUri interprets a string as a DocumentUri, applying VS
141+// Code workarounds; see [DocumentUri.UnmarshalText] for details.
142+func ParseDocumentUri(s string) (DocumentUri, error) {
143+ if s == "" {
144+ return "", nil
145+ }
146+
147+ if !strings.HasPrefix(s, "file://") {
148+ return "", fmt.Errorf("DocumentUri scheme is not 'file': %s", s)
149+ }
150+
151+ // VS Code sends URLs with only two slashes,
152+ // which are invalid. golang/go#39789.
153+ if !strings.HasPrefix(s, "file:///") {
154+ s = "file:///" + s[len("file://"):]
155+ }
156+
157+ // Even though the input is a URI, it may not be in canonical form. VS Code
158+ // in particular over-escapes :, @, etc. Unescape and re-encode to canonicalize.
159+ path, err := url.PathUnescape(s[len("file://"):])
160+ if err != nil {
161+ return "", err
162+ }
163+
164+ // File URIs from Windows may have lowercase drive letters.
165+ // Since drive letters are guaranteed to be case insensitive,
166+ // we change them to uppercase to remain consistent.
167+ // For example, file:///c:/x/y/z becomes file:///C:/x/y/z.
168+ if isWindowsDriveURIPath(path) {
169+ path = path[:1] + strings.ToUpper(string(path[1])) + path[2:]
170+ }
171+ u := url.URL{Scheme: fileScheme, Path: path}
172+ return DocumentUri(u.String()), nil
173+}
174+
175+// URIFromPath returns DocumentUri for the supplied file path.
176+// Given "", it returns "".
177+func URIFromPath(path string) DocumentUri {
178+ if path == "" {
179+ return ""
180+ }
181+ if !isWindowsDrivePath(path) {
182+ if abs, err := filepath.Abs(path); err == nil {
183+ path = abs
184+ }
185+ }
186+ // Check the file path again, in case it became absolute.
187+ if isWindowsDrivePath(path) {
188+ path = "/" + strings.ToUpper(string(path[0])) + path[1:]
189+ }
190+ path = filepath.ToSlash(path)
191+ u := url.URL{
192+ Scheme: fileScheme,
193+ Path: path,
194+ }
195+ return DocumentUri(u.String())
196+}
197+
198+const fileScheme = "file"
199+
200+// isWindowsDrivePath returns true if the file path is of the form used by
201+// Windows. We check if the path begins with a drive letter, followed by a ":".
202+// For example: C:/x/y/z.
203+func isWindowsDrivePath(path string) bool {
204+ if len(path) < 3 {
205+ return false
206+ }
207+ return unicode.IsLetter(rune(path[0])) && path[1] == ':'
208+}
209+
210+// isWindowsDriveURIPath returns true if the file URI is of the format used by
211+// Windows URIs. The url.Parse package does not specially handle Windows paths
212+// (see golang/go#6027), so we check if the URI path has a drive prefix (e.g. "/C:").
213+func isWindowsDriveURIPath(uri string) bool {
214+ if len(uri) < 4 {
215+ return false
216+ }
217+ return uri[0] == '/' && unicode.IsLetter(rune(uri[1])) && uri[2] == ':'
218+}
internal/lsp/transport.gonew file+269
@@ -0,0 +1,269 @@
1+package lsp
2+
3+import (
4+ "bufio"
5+ "context"
6+ "encoding/json"
7+ "fmt"
8+ "io"
9+ "log"
10+ "os"
11+ "strings"
12+)
13+
14+var debug = os.Getenv("DEBUG") != ""
15+
16+// Write writes an LSP message to the given writer
17+func WriteMessage(w io.Writer, msg *Message) error {
18+ data, err := json.Marshal(msg)
19+ if err != nil {
20+ return fmt.Errorf("failed to marshal message: %w", err)
21+ }
22+
23+ if debug {
24+ log.Printf("%v", msg.Method)
25+ log.Printf("-> Sending: %s", string(data))
26+ }
27+
28+ _, err = fmt.Fprintf(w, "Content-Length: %d\r\n\r\n", len(data))
29+ if err != nil {
30+ return fmt.Errorf("failed to write header: %w", err)
31+ }
32+
33+ _, err = w.Write(data)
34+ if err != nil {
35+ return fmt.Errorf("failed to write message: %w", err)
36+ }
37+
38+ return nil
39+}
40+
41+// ReadMessage reads a single LSP message from the given reader
42+func ReadMessage(r *bufio.Reader) (*Message, error) {
43+ // Read headers
44+ var contentLength int
45+ for {
46+ line, err := r.ReadString('\n')
47+ if err != nil {
48+ return nil, fmt.Errorf("failed to read header: %w", err)
49+ }
50+ line = strings.TrimSpace(line)
51+
52+ if debug {
53+ log.Printf("<- Header: %s", line)
54+ }
55+
56+ if line == "" {
57+ break // End of headers
58+ }
59+
60+ if strings.HasPrefix(line, "Content-Length: ") {
61+ _, err := fmt.Sscanf(line, "Content-Length: %d", &contentLength)
62+ if err != nil {
63+ return nil, fmt.Errorf("invalid Content-Length: %w", err)
64+ }
65+ }
66+ }
67+
68+ if debug {
69+ log.Printf("<- Reading content with length: %d", contentLength)
70+ }
71+
72+ // Read content
73+ content := make([]byte, contentLength)
74+ _, err := io.ReadFull(r, content)
75+ if err != nil {
76+ return nil, fmt.Errorf("failed to read content: %w", err)
77+ }
78+
79+ if debug {
80+ log.Printf("<- Received: %s", string(content))
81+ }
82+
83+ // Parse message
84+ var msg Message
85+ if err := json.Unmarshal(content, &msg); err != nil {
86+ return nil, fmt.Errorf("failed to unmarshal message: %w", err)
87+ }
88+
89+ return &msg, nil
90+}
91+
92+// handleMessages reads and dispatches messages in a loop
93+func (c *Client) handleMessages() {
94+ for {
95+ msg, err := ReadMessage(c.stdout)
96+ if err != nil {
97+ if debug {
98+ log.Printf("Error reading message: %v", err)
99+ }
100+ return
101+ }
102+
103+ // Handle server->client request (has both Method and ID)
104+ if msg.Method != "" && msg.ID != 0 {
105+ if debug {
106+ log.Printf("Received request from server: method=%s id=%d", msg.Method, msg.ID)
107+ }
108+
109+ response := &Message{
110+ JSONRPC: "2.0",
111+ ID: msg.ID,
112+ }
113+
114+ // Look up handler for this method
115+ c.serverHandlersMu.RLock()
116+ handler, ok := c.serverRequestHandlers[msg.Method]
117+ c.serverHandlersMu.RUnlock()
118+
119+ if ok {
120+ result, err := handler(msg.Params)
121+ if err != nil {
122+ response.Error = &ResponseError{
123+ Code: -32603,
124+ Message: err.Error(),
125+ }
126+ } else {
127+ rawJSON, err := json.Marshal(result)
128+ if err != nil {
129+ response.Error = &ResponseError{
130+ Code: -32603,
131+ Message: fmt.Sprintf("failed to marshal response: %v", err),
132+ }
133+ } else {
134+ response.Result = rawJSON
135+ }
136+ }
137+ } else {
138+ response.Error = &ResponseError{
139+ Code: -32601,
140+ Message: fmt.Sprintf("method not found: %s", msg.Method),
141+ }
142+ }
143+
144+ // Send response back to server
145+ if err := WriteMessage(c.stdin, response); err != nil {
146+ log.Printf("Error sending response to server: %v", err)
147+ }
148+
149+ continue
150+ }
151+
152+ // Handle notification (has Method but no ID)
153+ if msg.Method != "" && msg.ID == 0 {
154+ c.notificationMu.RLock()
155+ handler, ok := c.notificationHandlers[msg.Method]
156+ c.notificationMu.RUnlock()
157+
158+ if ok {
159+ if debug {
160+ log.Printf("Handling notification: %s", msg.Method)
161+ }
162+ go handler(msg.Params)
163+ } else if debug {
164+ log.Printf("No handler for notification: %s", msg.Method)
165+ }
166+ continue
167+ }
168+
169+ // Handle response to our request (has ID but no Method)
170+ if msg.ID != 0 && msg.Method == "" {
171+ c.handlersMu.RLock()
172+ ch, ok := c.handlers[msg.ID]
173+ c.handlersMu.RUnlock()
174+
175+ if ok {
176+ if debug {
177+ log.Printf("Sending response for ID %d to handler", msg.ID)
178+ }
179+ ch <- msg
180+ close(ch)
181+ } else if debug {
182+ log.Printf("No handler for response ID: %d", msg.ID)
183+ }
184+ }
185+ }
186+}
187+
188+// Call makes a request and waits for the response
189+func (c *Client) Call(ctx context.Context, method string, params any, result any) error {
190+ id := c.nextID.Add(1)
191+
192+ if debug {
193+ log.Printf("Making call: method=%s id=%d", method, id)
194+ }
195+
196+ msg, err := NewRequest(id, method, params)
197+ if err != nil {
198+ return fmt.Errorf("failed to create request: %w", err)
199+ }
200+
201+ // Create response channel
202+ ch := make(chan *Message, 1)
203+ c.handlersMu.Lock()
204+ c.handlers[id] = ch
205+ c.handlersMu.Unlock()
206+
207+ defer func() {
208+ c.handlersMu.Lock()
209+ delete(c.handlers, id)
210+ c.handlersMu.Unlock()
211+ }()
212+
213+ // Send request
214+ if err := WriteMessage(c.stdin, msg); err != nil {
215+ return fmt.Errorf("failed to send request: %w", err)
216+ }
217+
218+ if debug {
219+ log.Printf("Waiting for response to request ID: %d", id)
220+ }
221+
222+ // Wait for response
223+ resp := <-ch
224+
225+ if debug {
226+ log.Printf("Received response for request ID: %d", id)
227+ }
228+
229+ if resp.Error != nil {
230+ return fmt.Errorf("request failed: %s (code: %d)", resp.Error.Message, resp.Error.Code)
231+ }
232+
233+ if result != nil {
234+ // If result is a json.RawMessage, just copy the raw bytes
235+ if rawMsg, ok := result.(*json.RawMessage); ok {
236+ *rawMsg = resp.Result
237+ return nil
238+ }
239+ // Otherwise unmarshal into the provided type
240+ if err := json.Unmarshal(resp.Result, result); err != nil {
241+ return fmt.Errorf("failed to unmarshal result: %w", err)
242+ }
243+ }
244+
245+ return nil
246+}
247+
248+// Notify sends a notification (a request without an ID that doesn't expect a response)
249+func (c *Client) Notify(ctx context.Context, method string, params any) error {
250+ if debug {
251+ log.Printf("Sending notification: method=%s", method)
252+ }
253+
254+ msg, err := NewNotification(method, params)
255+ if err != nil {
256+ return fmt.Errorf("failed to create notification: %w", err)
257+ }
258+
259+ if err := WriteMessage(c.stdin, msg); err != nil {
260+ return fmt.Errorf("failed to send notification: %w", err)
261+ }
262+
263+ return nil
264+}
265+
266+type (
267+ NotificationHandler func(params json.RawMessage)
268+ ServerRequestHandler func(params json.RawMessage) (any, error)
269+)
internal/lsp/util/edit.gonew file+239
@@ -0,0 +1,239 @@
1+package util
2+
3+import (
4+ "bytes"
5+ "fmt"
6+ "os"
7+ "sort"
8+ "strings"
9+
10+ "github.com/kujtimiihoxha/termai/internal/lsp/protocol"
11+)
12+
13+func applyTextEdits(uri protocol.DocumentUri, edits []protocol.TextEdit) error {
14+ path := strings.TrimPrefix(string(uri), "file://")
15+
16+ // Read the file content
17+ content, err := os.ReadFile(path)
18+ if err != nil {
19+ return fmt.Errorf("failed to read file: %w", err)
20+ }
21+
22+ // Detect line ending style
23+ var lineEnding string
24+ if bytes.Contains(content, []byte("\r\n")) {
25+ lineEnding = "\r\n"
26+ } else {
27+ lineEnding = "\n"
28+ }
29+
30+ // Track if file ends with a newline
31+ endsWithNewline := len(content) > 0 && bytes.HasSuffix(content, []byte(lineEnding))
32+
33+ // Split into lines without the endings
34+ lines := strings.Split(string(content), lineEnding)
35+
36+ // Check for overlapping edits
37+ for i := 0; i < len(edits); i++ {
38+ for j := i + 1; j < len(edits); j++ {
39+ if rangesOverlap(edits[i].Range, edits[j].Range) {
40+ return fmt.Errorf("overlapping edits detected between edit %d and %d", i, j)
41+ }
42+ }
43+ }
44+
45+ // Sort edits in reverse order
46+ sortedEdits := make([]protocol.TextEdit, len(edits))
47+ copy(sortedEdits, edits)
48+ sort.Slice(sortedEdits, func(i, j int) bool {
49+ if sortedEdits[i].Range.Start.Line != sortedEdits[j].Range.Start.Line {
50+ return sortedEdits[i].Range.Start.Line > sortedEdits[j].Range.Start.Line
51+ }
52+ return sortedEdits[i].Range.Start.Character > sortedEdits[j].Range.Start.Character
53+ })
54+
55+ // Apply each edit
56+ for _, edit := range sortedEdits {
57+ newLines, err := applyTextEdit(lines, edit, lineEnding)
58+ if err != nil {
59+ return fmt.Errorf("failed to apply edit: %w", err)
60+ }
61+ lines = newLines
62+ }
63+
64+ // Join lines with proper line endings
65+ var newContent strings.Builder
66+ for i, line := range lines {
67+ if i > 0 {
68+ newContent.WriteString(lineEnding)
69+ }
70+ newContent.WriteString(line)
71+ }
72+
73+ // Only add a newline if the original file had one and we haven't already added it
74+ if endsWithNewline && !strings.HasSuffix(newContent.String(), lineEnding) {
75+ newContent.WriteString(lineEnding)
76+ }
77+
78+ if err := os.WriteFile(path, []byte(newContent.String()), 0o644); err != nil {
79+ return fmt.Errorf("failed to write file: %w", err)
80+ }
81+
82+ return nil
83+}
84+
85+func applyTextEdit(lines []string, edit protocol.TextEdit, lineEnding string) ([]string, error) {
86+ startLine := int(edit.Range.Start.Line)
87+ endLine := int(edit.Range.End.Line)
88+ startChar := int(edit.Range.Start.Character)
89+ endChar := int(edit.Range.End.Character)
90+
91+ // Validate positions
92+ if startLine < 0 || startLine >= len(lines) {
93+ return nil, fmt.Errorf("invalid start line: %d", startLine)
94+ }
95+ if endLine < 0 || endLine >= len(lines) {
96+ endLine = len(lines) - 1
97+ }
98+
99+ // Create result slice with initial capacity
100+ result := make([]string, 0, len(lines))
101+
102+ // Copy lines before edit
103+ result = append(result, lines[:startLine]...)
104+
105+ // Get the prefix of the start line
106+ startLineContent := lines[startLine]
107+ if startChar < 0 || startChar > len(startLineContent) {
108+ startChar = len(startLineContent)
109+ }
110+ prefix := startLineContent[:startChar]
111+
112+ // Get the suffix of the end line
113+ endLineContent := lines[endLine]
114+ if endChar < 0 || endChar > len(endLineContent) {
115+ endChar = len(endLineContent)
116+ }
117+ suffix := endLineContent[endChar:]
118+
119+ // Handle the edit
120+ if edit.NewText == "" {
121+ if prefix+suffix != "" {
122+ result = append(result, prefix+suffix)
123+ }
124+ } else {
125+ // Split new text into lines, being careful not to add extra newlines
126+ // newLines := strings.Split(strings.TrimRight(edit.NewText, "\n"), "\n")
127+ newLines := strings.Split(edit.NewText, "\n")
128+
129+ if len(newLines) == 1 {
130+ // Single line change
131+ result = append(result, prefix+newLines[0]+suffix)
132+ } else {
133+ // Multi-line change
134+ result = append(result, prefix+newLines[0])
135+ result = append(result, newLines[1:len(newLines)-1]...)
136+ result = append(result, newLines[len(newLines)-1]+suffix)
137+ }
138+ }
139+
140+ // Add remaining lines
141+ if endLine+1 < len(lines) {
142+ result = append(result, lines[endLine+1:]...)
143+ }
144+
145+ return result, nil
146+}
147+
148+// applyDocumentChange applies a DocumentChange (create/rename/delete operations)
149+func applyDocumentChange(change protocol.DocumentChange) error {
150+ if change.CreateFile != nil {
151+ path := strings.TrimPrefix(string(change.CreateFile.URI), "file://")
152+ if change.CreateFile.Options != nil {
153+ if change.CreateFile.Options.Overwrite {
154+ // Proceed with overwrite
155+ } else if change.CreateFile.Options.IgnoreIfExists {
156+ if _, err := os.Stat(path); err == nil {
157+ return nil // File exists and we're ignoring it
158+ }
159+ }
160+ }
161+ if err := os.WriteFile(path, []byte(""), 0o644); err != nil {
162+ return fmt.Errorf("failed to create file: %w", err)
163+ }
164+ }
165+
166+ if change.DeleteFile != nil {
167+ path := strings.TrimPrefix(string(change.DeleteFile.URI), "file://")
168+ if change.DeleteFile.Options != nil && change.DeleteFile.Options.Recursive {
169+ if err := os.RemoveAll(path); err != nil {
170+ return fmt.Errorf("failed to delete directory recursively: %w", err)
171+ }
172+ } else {
173+ if err := os.Remove(path); err != nil {
174+ return fmt.Errorf("failed to delete file: %w", err)
175+ }
176+ }
177+ }
178+
179+ if change.RenameFile != nil {
180+ oldPath := strings.TrimPrefix(string(change.RenameFile.OldURI), "file://")
181+ newPath := strings.TrimPrefix(string(change.RenameFile.NewURI), "file://")
182+ if change.RenameFile.Options != nil {
183+ if !change.RenameFile.Options.Overwrite {
184+ if _, err := os.Stat(newPath); err == nil {
185+ return fmt.Errorf("target file already exists and overwrite is not allowed: %s", newPath)
186+ }
187+ }
188+ }
189+ if err := os.Rename(oldPath, newPath); err != nil {
190+ return fmt.Errorf("failed to rename file: %w", err)
191+ }
192+ }
193+
194+ if change.TextDocumentEdit != nil {
195+ textEdits := make([]protocol.TextEdit, len(change.TextDocumentEdit.Edits))
196+ for i, edit := range change.TextDocumentEdit.Edits {
197+ var err error
198+ textEdits[i], err = edit.AsTextEdit()
199+ if err != nil {
200+ return fmt.Errorf("invalid edit type: %w", err)
201+ }
202+ }
203+ return applyTextEdits(change.TextDocumentEdit.TextDocument.URI, textEdits)
204+ }
205+
206+ return nil
207+}
208+
209+// ApplyWorkspaceEdit applies the given WorkspaceEdit to the filesystem
210+func ApplyWorkspaceEdit(edit protocol.WorkspaceEdit) error {
211+ // Handle Changes field
212+ for uri, textEdits := range edit.Changes {
213+ if err := applyTextEdits(uri, textEdits); err != nil {
214+ return fmt.Errorf("failed to apply text edits: %w", err)
215+ }
216+ }
217+
218+ // Handle DocumentChanges field
219+ for _, change := range edit.DocumentChanges {
220+ if err := applyDocumentChange(change); err != nil {
221+ return fmt.Errorf("failed to apply document change: %w", err)
222+ }
223+ }
224+
225+ return nil
226+}
227+
228+func rangesOverlap(r1, r2 protocol.Range) bool {
229+ if r1.Start.Line > r2.End.Line || r2.Start.Line > r1.End.Line {
230+ return false
231+ }
232+ if r1.Start.Line == r2.End.Line && r1.Start.Character > r2.End.Character {
233+ return false
234+ }
235+ if r2.Start.Line == r1.End.Line && r2.Start.Character > r1.End.Character {
236+ return false
237+ }
238+ return true
239+}
internal/lsp/watcher/watcher.gonew file+633
@@ -0,0 +1,633 @@
1+package watcher
2+
3+import (
4+ "context"
5+ "fmt"
6+ "log"
7+ "os"
8+ "path/filepath"
9+ "strings"
10+ "sync"
11+ "time"
12+
13+ "github.com/fsnotify/fsnotify"
14+ "github.com/kujtimiihoxha/termai/internal/lsp"
15+ "github.com/kujtimiihoxha/termai/internal/lsp/protocol"
16+)
17+
18+var debug = false // Force debug logging on
19+
20+// WorkspaceWatcher manages LSP file watching
21+type WorkspaceWatcher struct {
22+ client *lsp.Client
23+ workspacePath string
24+
25+ debounceTime time.Duration
26+ debounceMap map[string]*time.Timer
27+ debounceMu sync.Mutex
28+
29+ // File watchers registered by the server
30+ registrations []protocol.FileSystemWatcher
31+ registrationMu sync.RWMutex
32+}
33+
34+// NewWorkspaceWatcher creates a new workspace watcher
35+func NewWorkspaceWatcher(client *lsp.Client) *WorkspaceWatcher {
36+ return &WorkspaceWatcher{
37+ client: client,
38+ debounceTime: 300 * time.Millisecond,
39+ debounceMap: make(map[string]*time.Timer),
40+ registrations: []protocol.FileSystemWatcher{},
41+ }
42+}
43+
44+// AddRegistrations adds file watchers to track
45+func (w *WorkspaceWatcher) AddRegistrations(ctx context.Context, id string, watchers []protocol.FileSystemWatcher) {
46+ w.registrationMu.Lock()
47+ defer w.registrationMu.Unlock()
48+
49+ // Add new watchers
50+ w.registrations = append(w.registrations, watchers...)
51+
52+ // Print detailed registration information for debugging
53+ if debug {
54+ log.Printf("Added %d file watcher registrations (id: %s), total: %d",
55+ len(watchers), id, len(w.registrations))
56+
57+ for i, watcher := range watchers {
58+ log.Printf("Registration #%d raw data:", i+1)
59+
60+ // Log the GlobPattern
61+ switch v := watcher.GlobPattern.Value.(type) {
62+ case string:
63+ log.Printf(" GlobPattern: string pattern '%s'", v)
64+ case protocol.RelativePattern:
65+ log.Printf(" GlobPattern: RelativePattern with pattern '%s'", v.Pattern)
66+
67+ // Log BaseURI details
68+ switch u := v.BaseURI.Value.(type) {
69+ case string:
70+ log.Printf(" BaseURI: string '%s'", u)
71+ case protocol.DocumentUri:
72+ log.Printf(" BaseURI: DocumentUri '%s'", u)
73+ default:
74+ log.Printf(" BaseURI: unknown type %T", u)
75+ }
76+ default:
77+ log.Printf(" GlobPattern: unknown type %T", v)
78+ }
79+
80+ // Log WatchKind
81+ watchKind := protocol.WatchKind(protocol.WatchChange | protocol.WatchCreate | protocol.WatchDelete)
82+ if watcher.Kind != nil {
83+ watchKind = *watcher.Kind
84+ }
85+ log.Printf(" WatchKind: %d (Create:%v, Change:%v, Delete:%v)",
86+ watchKind,
87+ watchKind&protocol.WatchCreate != 0,
88+ watchKind&protocol.WatchChange != 0,
89+ watchKind&protocol.WatchDelete != 0)
90+
91+ // Test match against some example paths
92+ testPaths := []string{
93+ "/Users/phil/dev/mcp-language-server/internal/watcher/watcher.go",
94+ "/Users/phil/dev/mcp-language-server/go.mod",
95+ }
96+
97+ for _, testPath := range testPaths {
98+ isMatch := w.matchesPattern(testPath, watcher.GlobPattern)
99+ log.Printf(" Test path '%s': %v", testPath, isMatch)
100+ }
101+ }
102+ }
103+
104+ // Find and open all existing files that match the newly registered patterns
105+ // TODO: not all language servers require this, but typescript does. Make this configurable
106+ go func() {
107+ startTime := time.Now()
108+ filesOpened := 0
109+
110+ err := filepath.WalkDir(w.workspacePath, func(path string, d os.DirEntry, err error) error {
111+ if err != nil {
112+ return err
113+ }
114+
115+ // Skip directories that should be excluded
116+ if d.IsDir() {
117+ log.Println(path)
118+ if path != w.workspacePath && shouldExcludeDir(path) {
119+ if debug {
120+ log.Printf("Skipping excluded directory!!: %s", path)
121+ }
122+ return filepath.SkipDir
123+ }
124+ } else {
125+ // Process files
126+ w.openMatchingFile(ctx, path)
127+ filesOpened++
128+
129+ // Add a small delay after every 100 files to prevent overwhelming the server
130+ if filesOpened%100 == 0 {
131+ time.Sleep(10 * time.Millisecond)
132+ }
133+ }
134+
135+ return nil
136+ })
137+
138+ elapsedTime := time.Since(startTime)
139+ if debug {
140+ log.Printf("Workspace scan complete: processed %d files in %.2f seconds", filesOpened, elapsedTime.Seconds())
141+ }
142+
143+ if err != nil && debug {
144+ log.Printf("Error scanning workspace for files to open: %v", err)
145+ }
146+ }()
147+}
148+
149+// WatchWorkspace sets up file watching for a workspace
150+func (w *WorkspaceWatcher) WatchWorkspace(ctx context.Context, workspacePath string) {
151+ w.workspacePath = workspacePath
152+
153+ // Register handler for file watcher registrations from the server
154+ lsp.RegisterFileWatchHandler(func(id string, watchers []protocol.FileSystemWatcher) {
155+ w.AddRegistrations(ctx, id, watchers)
156+ })
157+
158+ watcher, err := fsnotify.NewWatcher()
159+ if err != nil {
160+ log.Fatalf("Error creating watcher: %v", err)
161+ }
162+ defer watcher.Close()
163+
164+ // Watch the workspace recursively
165+ err = filepath.WalkDir(workspacePath, func(path string, d os.DirEntry, err error) error {
166+ if err != nil {
167+ return err
168+ }
169+
170+ // Skip excluded directories (except workspace root)
171+ if d.IsDir() && path != workspacePath {
172+ if shouldExcludeDir(path) {
173+ if debug {
174+ log.Printf("Skipping watching excluded directory: %s", path)
175+ }
176+ return filepath.SkipDir
177+ }
178+ }
179+
180+ // Add directories to watcher
181+ if d.IsDir() {
182+ err = watcher.Add(path)
183+ if err != nil {
184+ log.Printf("Error watching path %s: %v", path, err)
185+ }
186+ }
187+
188+ return nil
189+ })
190+ if err != nil {
191+ log.Fatalf("Error walking workspace: %v", err)
192+ }
193+
194+ // Event loop
195+ for {
196+ select {
197+ case <-ctx.Done():
198+ return
199+ case event, ok := <-watcher.Events:
200+ if !ok {
201+ return
202+ }
203+
204+ uri := fmt.Sprintf("file://%s", event.Name)
205+
206+ // Add new directories to the watcher
207+ if event.Op&fsnotify.Create != 0 {
208+ if info, err := os.Stat(event.Name); err == nil {
209+ if info.IsDir() {
210+ // Skip excluded directories
211+ if !shouldExcludeDir(event.Name) {
212+ if err := watcher.Add(event.Name); err != nil {
213+ log.Printf("Error watching new directory: %v", err)
214+ }
215+ }
216+ } else {
217+ // For newly created files
218+ if !shouldExcludeFile(event.Name) {
219+ w.openMatchingFile(ctx, event.Name)
220+ }
221+ }
222+ }
223+ }
224+
225+ // Debug logging
226+ if debug {
227+ matched, kind := w.isPathWatched(event.Name)
228+ log.Printf("Event: %s, Op: %s, Watched: %v, Kind: %d",
229+ event.Name, event.Op.String(), matched, kind)
230+ }
231+
232+ // Check if this path should be watched according to server registrations
233+ if watched, watchKind := w.isPathWatched(event.Name); watched {
234+ switch {
235+ case event.Op&fsnotify.Write != 0:
236+ if watchKind&protocol.WatchChange != 0 {
237+ w.debounceHandleFileEvent(ctx, uri, protocol.FileChangeType(protocol.Changed))
238+ }
239+ case event.Op&fsnotify.Create != 0:
240+ // Already handled earlier in the event loop
241+ // Just send the notification if needed
242+ info, _ := os.Stat(event.Name)
243+ if !info.IsDir() && watchKind&protocol.WatchCreate != 0 {
244+ w.debounceHandleFileEvent(ctx, uri, protocol.FileChangeType(protocol.Created))
245+ }
246+ case event.Op&fsnotify.Remove != 0:
247+ if watchKind&protocol.WatchDelete != 0 {
248+ w.handleFileEvent(ctx, uri, protocol.FileChangeType(protocol.Deleted))
249+ }
250+ case event.Op&fsnotify.Rename != 0:
251+ // For renames, first delete
252+ if watchKind&protocol.WatchDelete != 0 {
253+ w.handleFileEvent(ctx, uri, protocol.FileChangeType(protocol.Deleted))
254+ }
255+
256+ // Then check if the new file exists and create an event
257+ if info, err := os.Stat(event.Name); err == nil && !info.IsDir() {
258+ if watchKind&protocol.WatchCreate != 0 {
259+ w.debounceHandleFileEvent(ctx, uri, protocol.FileChangeType(protocol.Created))
260+ }
261+ }
262+ }
263+ }
264+ case err, ok := <-watcher.Errors:
265+ if !ok {
266+ return
267+ }
268+ log.Printf("Watcher error: %v\n", err)
269+ }
270+ }
271+}
272+
273+// isPathWatched checks if a path should be watched based on server registrations
274+func (w *WorkspaceWatcher) isPathWatched(path string) (bool, protocol.WatchKind) {
275+ w.registrationMu.RLock()
276+ defer w.registrationMu.RUnlock()
277+
278+ // If no explicit registrations, watch everything
279+ if len(w.registrations) == 0 {
280+ return true, protocol.WatchKind(protocol.WatchChange | protocol.WatchCreate | protocol.WatchDelete)
281+ }
282+
283+ // Check each registration
284+ for _, reg := range w.registrations {
285+ isMatch := w.matchesPattern(path, reg.GlobPattern)
286+ if isMatch {
287+ kind := protocol.WatchKind(protocol.WatchChange | protocol.WatchCreate | protocol.WatchDelete)
288+ if reg.Kind != nil {
289+ kind = *reg.Kind
290+ }
291+ return true, kind
292+ }
293+ }
294+
295+ return false, 0
296+}
297+
298+// matchesGlob handles advanced glob patterns including ** and alternatives
299+func matchesGlob(pattern, path string) bool {
300+ // Handle file extension patterns with braces like *.{go,mod,sum}
301+ if strings.Contains(pattern, "{") && strings.Contains(pattern, "}") {
302+ // Extract extensions from pattern like "*.{go,mod,sum}"
303+ parts := strings.SplitN(pattern, "{", 2)
304+ if len(parts) == 2 {
305+ prefix := parts[0]
306+ extPart := strings.SplitN(parts[1], "}", 2)
307+ if len(extPart) == 2 {
308+ extensions := strings.Split(extPart[0], ",")
309+ suffix := extPart[1]
310+
311+ // Check if the path matches any of the extensions
312+ for _, ext := range extensions {
313+ extPattern := prefix + ext + suffix
314+ isMatch := matchesSimpleGlob(extPattern, path)
315+ if isMatch {
316+ return true
317+ }
318+ }
319+ return false
320+ }
321+ }
322+ }
323+
324+ return matchesSimpleGlob(pattern, path)
325+}
326+
327+// matchesSimpleGlob handles glob patterns with ** wildcards
328+func matchesSimpleGlob(pattern, path string) bool {
329+ // Handle special case for **/*.ext pattern (common in LSP)
330+ if strings.HasPrefix(pattern, "**/") {
331+ rest := strings.TrimPrefix(pattern, "**/")
332+
333+ // If the rest is a simple file extension pattern like *.go
334+ if strings.HasPrefix(rest, "*.") {
335+ ext := strings.TrimPrefix(rest, "*")
336+ isMatch := strings.HasSuffix(path, ext)
337+ return isMatch
338+ }
339+
340+ // Otherwise, try to check if the path ends with the rest part
341+ isMatch := strings.HasSuffix(path, rest)
342+
343+ // If it matches directly, great!
344+ if isMatch {
345+ return true
346+ }
347+
348+ // Otherwise, check if any path component matches
349+ pathComponents := strings.Split(path, "/")
350+ for i := 0; i < len(pathComponents); i++ {
351+ subPath := strings.Join(pathComponents[i:], "/")
352+ if strings.HasSuffix(subPath, rest) {
353+ return true
354+ }
355+ }
356+
357+ return false
358+ }
359+
360+ // Handle other ** wildcard pattern cases
361+ if strings.Contains(pattern, "**") {
362+ parts := strings.Split(pattern, "**")
363+
364+ // Validate the path starts with the first part
365+ if !strings.HasPrefix(path, parts[0]) && parts[0] != "" {
366+ return false
367+ }
368+
369+ // For patterns like "**/*.go", just check the suffix
370+ if len(parts) == 2 && parts[0] == "" {
371+ isMatch := strings.HasSuffix(path, parts[1])
372+ return isMatch
373+ }
374+
375+ // For other patterns, handle middle part
376+ remaining := strings.TrimPrefix(path, parts[0])
377+ if len(parts) == 2 {
378+ isMatch := strings.HasSuffix(remaining, parts[1])
379+ return isMatch
380+ }
381+ }
382+
383+ // Handle simple * wildcard for file extension patterns (*.go, *.sum, etc)
384+ if strings.HasPrefix(pattern, "*.") {
385+ ext := strings.TrimPrefix(pattern, "*")
386+ isMatch := strings.HasSuffix(path, ext)
387+ return isMatch
388+ }
389+
390+ // Fall back to simple matching for simpler patterns
391+ matched, err := filepath.Match(pattern, path)
392+ if err != nil {
393+ log.Printf("Error matching pattern %s: %v", pattern, err)
394+ return false
395+ }
396+
397+ return matched
398+}
399+
400+// matchesPattern checks if a path matches the glob pattern
401+func (w *WorkspaceWatcher) matchesPattern(path string, pattern protocol.GlobPattern) bool {
402+ patternInfo, err := pattern.AsPattern()
403+ if err != nil {
404+ log.Printf("Error parsing pattern: %v", err)
405+ return false
406+ }
407+
408+ basePath := patternInfo.GetBasePath()
409+ patternText := patternInfo.GetPattern()
410+
411+ path = filepath.ToSlash(path)
412+
413+ // For simple patterns without base path
414+ if basePath == "" {
415+ // Check if the pattern matches the full path or just the file extension
416+ fullPathMatch := matchesGlob(patternText, path)
417+ baseNameMatch := matchesGlob(patternText, filepath.Base(path))
418+
419+ return fullPathMatch || baseNameMatch
420+ }
421+
422+ // For relative patterns
423+ basePath = strings.TrimPrefix(basePath, "file://")
424+ basePath = filepath.ToSlash(basePath)
425+
426+ // Make path relative to basePath for matching
427+ relPath, err := filepath.Rel(basePath, path)
428+ if err != nil {
429+ log.Printf("Error getting relative path for %s: %v", path, err)
430+ return false
431+ }
432+ relPath = filepath.ToSlash(relPath)
433+
434+ isMatch := matchesGlob(patternText, relPath)
435+
436+ return isMatch
437+}
438+
439+// debounceHandleFileEvent handles file events with debouncing to reduce notifications
440+func (w *WorkspaceWatcher) debounceHandleFileEvent(ctx context.Context, uri string, changeType protocol.FileChangeType) {
441+ w.debounceMu.Lock()
442+ defer w.debounceMu.Unlock()
443+
444+ // Create a unique key based on URI and change type
445+ key := fmt.Sprintf("%s:%d", uri, changeType)
446+
447+ // Cancel existing timer if any
448+ if timer, exists := w.debounceMap[key]; exists {
449+ timer.Stop()
450+ }
451+
452+ // Create new timer
453+ w.debounceMap[key] = time.AfterFunc(w.debounceTime, func() {
454+ w.handleFileEvent(ctx, uri, changeType)
455+
456+ // Cleanup timer after execution
457+ w.debounceMu.Lock()
458+ delete(w.debounceMap, key)
459+ w.debounceMu.Unlock()
460+ })
461+}
462+
463+// handleFileEvent sends file change notifications
464+func (w *WorkspaceWatcher) handleFileEvent(ctx context.Context, uri string, changeType protocol.FileChangeType) {
465+ // If the file is open and it's a change event, use didChange notification
466+ filePath := uri[7:] // Remove "file://" prefix
467+ if changeType == protocol.FileChangeType(protocol.Changed) && w.client.IsFileOpen(filePath) {
468+ err := w.client.NotifyChange(ctx, filePath)
469+ if err != nil {
470+ log.Printf("Error notifying change: %v", err)
471+ }
472+ return
473+ }
474+
475+ // Notify LSP server about the file event using didChangeWatchedFiles
476+ if err := w.notifyFileEvent(ctx, uri, changeType); err != nil {
477+ log.Printf("Error notifying LSP server about file event: %v", err)
478+ }
479+}
480+
481+// notifyFileEvent sends a didChangeWatchedFiles notification for a file event
482+func (w *WorkspaceWatcher) notifyFileEvent(ctx context.Context, uri string, changeType protocol.FileChangeType) error {
483+ if debug {
484+ log.Printf("Notifying file event: %s (type: %d)", uri, changeType)
485+ }
486+
487+ params := protocol.DidChangeWatchedFilesParams{
488+ Changes: []protocol.FileEvent{
489+ {
490+ URI: protocol.DocumentUri(uri),
491+ Type: changeType,
492+ },
493+ },
494+ }
495+
496+ return w.client.DidChangeWatchedFiles(ctx, params)
497+}
498+
499+// Common patterns for directories and files to exclude
500+// TODO: make configurable
501+var (
502+ excludedDirNames = map[string]bool{
503+ ".git": true,
504+ "node_modules": true,
505+ "dist": true,
506+ "build": true,
507+ "out": true,
508+ "bin": true,
509+ ".idea": true,
510+ ".vscode": true,
511+ ".cache": true,
512+ "coverage": true,
513+ "target": true, // Rust build output
514+ "vendor": true, // Go vendor directory
515+ }
516+
517+ excludedFileExtensions = map[string]bool{
518+ ".swp": true,
519+ ".swo": true,
520+ ".tmp": true,
521+ ".temp": true,
522+ ".bak": true,
523+ ".log": true,
524+ ".o": true, // Object files
525+ ".so": true, // Shared libraries
526+ ".dylib": true, // macOS shared libraries
527+ ".dll": true, // Windows shared libraries
528+ ".a": true, // Static libraries
529+ ".exe": true, // Windows executables
530+ ".lock": true, // Lock files
531+ }
532+
533+ // Large binary files that shouldn't be opened
534+ largeBinaryExtensions = map[string]bool{
535+ ".png": true,
536+ ".jpg": true,
537+ ".jpeg": true,
538+ ".gif": true,
539+ ".bmp": true,
540+ ".ico": true,
541+ ".zip": true,
542+ ".tar": true,
543+ ".gz": true,
544+ ".rar": true,
545+ ".7z": true,
546+ ".pdf": true,
547+ ".mp3": true,
548+ ".mp4": true,
549+ ".mov": true,
550+ ".wav": true,
551+ ".wasm": true,
552+ }
553+
554+ // Maximum file size to open (5MB)
555+ maxFileSize int64 = 5 * 1024 * 1024
556+)
557+
558+// shouldExcludeDir returns true if the directory should be excluded from watching/opening
559+func shouldExcludeDir(dirPath string) bool {
560+ dirName := filepath.Base(dirPath)
561+
562+ // Skip dot directories
563+ if strings.HasPrefix(dirName, ".") {
564+ return true
565+ }
566+
567+ // Skip common excluded directories
568+ if excludedDirNames[dirName] {
569+ return true
570+ }
571+
572+ return false
573+}
574+
575+// shouldExcludeFile returns true if the file should be excluded from opening
576+func shouldExcludeFile(filePath string) bool {
577+ fileName := filepath.Base(filePath)
578+
579+ // Skip dot files
580+ if strings.HasPrefix(fileName, ".") {
581+ return true
582+ }
583+
584+ // Check file extension
585+ ext := strings.ToLower(filepath.Ext(filePath))
586+ if excludedFileExtensions[ext] || largeBinaryExtensions[ext] {
587+ return true
588+ }
589+
590+ // Skip temporary files
591+ if strings.HasSuffix(filePath, "~") {
592+ return true
593+ }
594+
595+ // Check file size
596+ info, err := os.Stat(filePath)
597+ if err != nil {
598+ // If we can't stat the file, skip it
599+ return true
600+ }
601+
602+ // Skip large files
603+ if info.Size() > maxFileSize {
604+ if debug {
605+ log.Printf("Skipping large file: %s (%.2f MB)", filePath, float64(info.Size())/(1024*1024))
606+ }
607+ return true
608+ }
609+
610+ return false
611+}
612+
613+// openMatchingFile opens a file if it matches any of the registered patterns
614+func (w *WorkspaceWatcher) openMatchingFile(ctx context.Context, path string) {
615+ // Skip directories
616+ info, err := os.Stat(path)
617+ if err != nil || info.IsDir() {
618+ return
619+ }
620+
621+ // Skip excluded files
622+ if shouldExcludeFile(path) {
623+ return
624+ }
625+
626+ // Check if this path should be watched according to server registrations
627+ if watched, _ := w.isPathWatched(path); watched {
628+ // Don't need to check if it's already open - the client.OpenFile handles that
629+ if err := w.client.OpenFile(ctx, path); err != nil && debug {
630+ log.Printf("Error opening file %s: %v", path, err)
631+ }
632+ }
633+}
internal/message/content.gonew file+244
@@ -0,0 +1,244 @@
1+package message
2+
3+import (
4+ "encoding/base64"
5+)
6+
7+type MessageRole string
8+
9+const (
10+ Assistant MessageRole = "assistant"
11+ User MessageRole = "user"
12+ System MessageRole = "system"
13+ Tool MessageRole = "tool"
14+)
15+
16+type ContentPart interface {
17+ isPart()
18+}
19+
20+type ReasoningContent struct {
21+ Thinking string `json:"thinking"`
22+}
23+
24+func (tc ReasoningContent) String() string {
25+ return tc.Thinking
26+}
27+func (ReasoningContent) isPart() {}
28+
29+type TextContent struct {
30+ Text string `json:"text"`
31+}
32+
33+func (tc TextContent) String() string {
34+ return tc.Text
35+}
36+
37+func (TextContent) isPart() {}
38+
39+type ImageURLContent struct {
40+ URL string `json:"url"`
41+ Detail string `json:"detail,omitempty"`
42+}
43+
44+func (iuc ImageURLContent) String() string {
45+ return iuc.URL
46+}
47+
48+func (ImageURLContent) isPart() {}
49+
50+type BinaryContent struct {
51+ MIMEType string
52+ Data []byte
53+}
54+
55+func (bc BinaryContent) String() string {
56+ base64Encoded := base64.StdEncoding.EncodeToString(bc.Data)
57+ return "data:" + bc.MIMEType + ";base64," + base64Encoded
58+}
59+
60+func (BinaryContent) isPart() {}
61+
62+type ToolCall struct {
63+ ID string `json:"id"`
64+ Name string `json:"name"`
65+ Input string `json:"input"`
66+ Type string `json:"type"`
67+ Finished bool `json:"finished"`
68+}
69+
70+func (ToolCall) isPart() {}
71+
72+type ToolResult struct {
73+ ToolCallID string `json:"tool_call_id"`
74+ Name string `json:"name"`
75+ Content string `json:"content"`
76+ IsError bool `json:"is_error"`
77+}
78+
79+func (ToolResult) isPart() {}
80+
81+type Finish struct {
82+ Reason string `json:"reason"`
83+}
84+
85+func (Finish) isPart() {}
86+
87+type Message struct {
88+ ID string
89+ Role MessageRole
90+ SessionID string
91+ Parts []ContentPart
92+
93+ CreatedAt int64
94+ UpdatedAt int64
95+}
96+
97+func (m *Message) Content() TextContent {
98+ for _, part := range m.Parts {
99+ if c, ok := part.(TextContent); ok {
100+ return c
101+ }
102+ }
103+ return TextContent{}
104+}
105+
106+func (m *Message) ReasoningContent() ReasoningContent {
107+ for _, part := range m.Parts {
108+ if c, ok := part.(ReasoningContent); ok {
109+ return c
110+ }
111+ }
112+ return ReasoningContent{}
113+}
114+
115+func (m *Message) ImageURLContent() []ImageURLContent {
116+ imageURLContents := make([]ImageURLContent, 0)
117+ for _, part := range m.Parts {
118+ if c, ok := part.(ImageURLContent); ok {
119+ imageURLContents = append(imageURLContents, c)
120+ }
121+ }
122+ return imageURLContents
123+}
124+
125+func (m *Message) BinaryContent() []BinaryContent {
126+ binaryContents := make([]BinaryContent, 0)
127+ for _, part := range m.Parts {
128+ if c, ok := part.(BinaryContent); ok {
129+ binaryContents = append(binaryContents, c)
130+ }
131+ }
132+ return binaryContents
133+}
134+
135+func (m *Message) ToolCalls() []ToolCall {
136+ toolCalls := make([]ToolCall, 0)
137+ for _, part := range m.Parts {
138+ if c, ok := part.(ToolCall); ok {
139+ toolCalls = append(toolCalls, c)
140+ }
141+ }
142+ return toolCalls
143+}
144+
145+func (m *Message) ToolResults() []ToolResult {
146+ toolResults := make([]ToolResult, 0)
147+ for _, part := range m.Parts {
148+ if c, ok := part.(ToolResult); ok {
149+ toolResults = append(toolResults, c)
150+ }
151+ }
152+ return toolResults
153+}
154+
155+func (m *Message) IsFinished() bool {
156+ for _, part := range m.Parts {
157+ if _, ok := part.(Finish); ok {
158+ return true
159+ }
160+ }
161+ return false
162+}
163+
164+func (m *Message) FinishReason() string {
165+ for _, part := range m.Parts {
166+ if c, ok := part.(Finish); ok {
167+ return c.Reason
168+ }
169+ }
170+ return ""
171+}
172+
173+func (m *Message) IsThinking() bool {
174+ if m.ReasoningContent().Thinking != "" && m.Content().Text == "" && !m.IsFinished() {
175+ return true
176+ }
177+ return false
178+}
179+
180+func (m *Message) AppendContent(delta string) {
181+ found := false
182+ for i, part := range m.Parts {
183+ if c, ok := part.(TextContent); ok {
184+ m.Parts[i] = TextContent{Text: c.Text + delta}
185+ found = true
186+ }
187+ }
188+ if !found {
189+ m.Parts = append(m.Parts, TextContent{Text: delta})
190+ }
191+}
192+
193+func (m *Message) AppendReasoningContent(delta string) {
194+ found := false
195+ for i, part := range m.Parts {
196+ if c, ok := part.(ReasoningContent); ok {
197+ m.Parts[i] = ReasoningContent{Thinking: c.Thinking + delta}
198+ found = true
199+ }
200+ }
201+ if !found {
202+ m.Parts = append(m.Parts, ReasoningContent{Thinking: delta})
203+ }
204+}
205+
206+func (m *Message) AddToolCall(tc ToolCall) {
207+ for i, part := range m.Parts {
208+ if c, ok := part.(ToolCall); ok {
209+ if c.ID == tc.ID {
210+ m.Parts[i] = tc
211+ return
212+ }
213+ }
214+ }
215+ m.Parts = append(m.Parts, tc)
216+}
217+
218+func (m *Message) SetToolCalls(tc []ToolCall) {
219+ for _, toolCall := range tc {
220+ m.Parts = append(m.Parts, toolCall)
221+ }
222+}
223+
224+func (m *Message) AddToolResult(tr ToolResult) {
225+ m.Parts = append(m.Parts, tr)
226+}
227+
228+func (m *Message) SetToolResults(tr []ToolResult) {
229+ for _, toolResult := range tr {
230+ m.Parts = append(m.Parts, toolResult)
231+ }
232+}
233+
234+func (m *Message) AddFinish(reason string) {
235+ m.Parts = append(m.Parts, Finish{Reason: reason})
236+}
237+
238+func (m *Message) AddImageURL(url, detail string) {
239+ m.Parts = append(m.Parts, ImageURLContent{URL: url, Detail: detail})
240+}
241+
242+func (m *Message) AddBinary(mimeType string, data []byte) {
243+ m.Parts = append(m.Parts, BinaryContent{MIMEType: mimeType, Data: data})
244+}
internal/message/message.go+149−96
@@ -2,59 +2,17 @@ package message
22
33import (
44 "context"
5− "database/sql"
65 "encoding/json"
6+ "fmt"
77
88 "github.com/google/uuid"
99 "github.com/kujtimiihoxha/termai/internal/db"
1010 "github.com/kujtimiihoxha/termai/internal/pubsub"
1111)
1212
13−type MessageRole string
14−
15−const (
16− Assistant MessageRole = "assistant"
17− User MessageRole = "user"
18− System MessageRole = "system"
19− Tool MessageRole = "tool"
20−)
21−
22−type ToolResult struct {
23− ToolCallID string
24− Content string
25− IsError bool
26− // TODO: support for images
27−}
28−
29−type ToolCall struct {
30− ID string
31− Name string
32− Input string
33− Type string
34−}
35−
36−type Message struct {
37− ID string
38− SessionID string
39−
40− // NEW
41− Role MessageRole
42− Content string
43− Thinking string
44−
45− Finished bool
46−
47− ToolResults []ToolResult
48− ToolCalls []ToolCall
49− CreatedAt int64
50− UpdatedAt int64
51−}
52−
5313type CreateMessageParams struct {
54− Role MessageRole
55− Content string
56− ToolCalls []ToolCall
57− ToolResults []ToolResult
14+ Role MessageRole
15+ Parts []ContentPart
5816}
5917
6018type Service interface {
@@ -73,6 +31,14 @@ type service struct {
7331 ctx context.Context
7432}
7533
34+func NewService(ctx context.Context, q db.Querier) Service {
35+ return &service{
36+ Broker: pubsub.NewBroker[Message](),
37+ q: q,
38+ ctx: ctx,
39+ }
40+}
41+
7642func (s *service) Delete(id string) error {
7743 message, err := s.Get(id)
7844 if err != nil {
@@ -87,22 +53,21 @@ func (s *service) Delete(id string) error {
8753}
8854
8955func (s *service) Create(sessionID string, params CreateMessageParams) (Message, error) {
90− toolCallsStr, err := json.Marshal(params.ToolCalls)
91− if err != nil {
92− return Message{}, err
56+ if params.Role != Assistant {
57+ params.Parts = append(params.Parts, Finish{
58+ Reason: "stop",
59+ })
9360 }
94− toolResultsStr, err := json.Marshal(params.ToolResults)
61+ partsJSON, err := marshallParts(params.Parts)
9562 if err != nil {
9663 return Message{}, err
9764 }
65+
9866 dbMessage, err := s.q.CreateMessage(s.ctx, db.CreateMessageParams{
99− ID: uuid.New().String(),
100− SessionID: sessionID,
101− Role: string(params.Role),
102− Finished: params.Role != Assistant,
103− Content: params.Content,
104− ToolCalls: sql.NullString{String: string(toolCallsStr), Valid: true},
105− ToolResults: sql.NullString{String: string(toolResultsStr), Valid: true},
67+ ID: uuid.New().String(),
68+ SessionID: sessionID,
69+ Role: string(params.Role),
70+ Parts: string(partsJSON),
10671 })
10772 if err != nil {
10873 return Message{}, err
@@ -132,21 +97,13 @@ func (s *service) DeleteSessionMessages(sessionID string) error {
13297}
13398
13499func (s *service) Update(message Message) error {
135− toolCallsStr, err := json.Marshal(message.ToolCalls)
136− if err != nil {
137− return err
138− }
139− toolResultsStr, err := json.Marshal(message.ToolResults)
100+ parts, err := marshallParts(message.Parts)
140101 if err != nil {
141102 return err
142103 }
143104 err = s.q.UpdateMessage(s.ctx, db.UpdateMessageParams{
144− ID: message.ID,
145− Content: message.Content,
146− Thinking: message.Thinking,
147− Finished: message.Finished,
148− ToolCalls: sql.NullString{String: string(toolCallsStr), Valid: true},
149− ToolResults: sql.NullString{String: string(toolResultsStr), Valid: true},
105+ ID: message.ID,
106+ Parts: string(parts),
150107 })
151108 if err != nil {
152109 return err
@@ -179,40 +136,136 @@ func (s *service) List(sessionID string) ([]Message, error) {
179136}
180137
181138func (s *service) fromDBItem(item db.Message) (Message, error) {
182− toolCalls := make([]ToolCall, 0)
183− if item.ToolCalls.Valid {
184− err := json.Unmarshal([]byte(item.ToolCalls.String), &toolCalls)
185− if err != nil {
186− return Message{}, err
187− }
139+ parts, err := unmarshallParts([]byte(item.Parts))
140+ if err != nil {
141+ return Message{}, err
188142 }
143+ return Message{
144+ ID: item.ID,
145+ SessionID: item.SessionID,
146+ Role: MessageRole(item.Role),
147+ Parts: parts,
148+ CreatedAt: item.CreatedAt,
149+ UpdatedAt: item.UpdatedAt,
150+ }, nil
151+}
189152
190− toolResults := make([]ToolResult, 0)
191− if item.ToolResults.Valid {
192− err := json.Unmarshal([]byte(item.ToolResults.String), &toolResults)
193− if err != nil {
194− return Message{}, err
153+type partType string
154+
155+const (
156+ reasoningType partType = "reasoning"
157+ textType partType = "text"
158+ imageURLType partType = "image_url"
159+ binaryType partType = "binary"
160+ toolCallType partType = "tool_call"
161+ toolResultType partType = "tool_result"
162+ finishType partType = "finish"
163+)
164+
165+type partWrapper struct {
166+ Type partType `json:"type"`
167+ Data ContentPart `json:"data"`
168+}
169+
170+func marshallParts(parts []ContentPart) ([]byte, error) {
171+ wrappedParts := make([]partWrapper, len(parts))
172+
173+ for i, part := range parts {
174+ var typ partType
175+
176+ switch part.(type) {
177+ case ReasoningContent:
178+ typ = reasoningType
179+ case TextContent:
180+ typ = textType
181+ case ImageURLContent:
182+ typ = imageURLType
183+ case BinaryContent:
184+ typ = binaryType
185+ case ToolCall:
186+ typ = toolCallType
187+ case ToolResult:
188+ typ = toolResultType
189+ case Finish:
190+ typ = finishType
191+ default:
192+ return nil, fmt.Errorf("unknown part type: %T", part)
195193 }
196− }
197194
198− return Message{
199− ID: item.ID,
200− SessionID: item.SessionID,
201− Role: MessageRole(item.Role),
202− Content: item.Content,
203− Thinking: item.Thinking,
204− Finished: item.Finished,
205− ToolCalls: toolCalls,
206− ToolResults: toolResults,
207− CreatedAt: item.CreatedAt,
208− UpdatedAt: item.UpdatedAt,
209− }, nil
195+ wrappedParts[i] = partWrapper{
196+ Type: typ,
197+ Data: part,
198+ }
199+ }
200+ return json.Marshal(wrappedParts)
210201}
211202
212−func NewService(ctx context.Context, q db.Querier) Service {
213− return &service{
214− Broker: pubsub.NewBroker[Message](),
215− q: q,
216− ctx: ctx,
203+func unmarshallParts(data []byte) ([]ContentPart, error) {
204+ temp := []json.RawMessage{}
205+
206+ if err := json.Unmarshal(data, &temp); err != nil {
207+ return nil, err
217208 }
209+
210+ parts := make([]ContentPart, 0)
211+
212+ for _, rawPart := range temp {
213+ var wrapper struct {
214+ Type partType `json:"type"`
215+ Data json.RawMessage `json:"data"`
216+ }
217+
218+ if err := json.Unmarshal(rawPart, &wrapper); err != nil {
219+ return nil, err
220+ }
221+
222+ switch wrapper.Type {
223+ case reasoningType:
224+ part := ReasoningContent{}
225+ if err := json.Unmarshal(wrapper.Data, &part); err != nil {
226+ return nil, err
227+ }
228+ parts = append(parts, part)
229+ case textType:
230+ part := TextContent{}
231+ if err := json.Unmarshal(wrapper.Data, &part); err != nil {
232+ return nil, err
233+ }
234+ parts = append(parts, part)
235+ case imageURLType:
236+ part := ImageURLContent{}
237+ if err := json.Unmarshal(wrapper.Data, &part); err != nil {
238+ return nil, err
239+ }
240+ case binaryType:
241+ part := BinaryContent{}
242+ if err := json.Unmarshal(wrapper.Data, &part); err != nil {
243+ return nil, err
244+ }
245+ parts = append(parts, part)
246+ case toolCallType:
247+ part := ToolCall{}
248+ if err := json.Unmarshal(wrapper.Data, &part); err != nil {
249+ return nil, err
250+ }
251+ parts = append(parts, part)
252+ case toolResultType:
253+ part := ToolResult{}
254+ if err := json.Unmarshal(wrapper.Data, &part); err != nil {
255+ return nil, err
256+ }
257+ parts = append(parts, part)
258+ case finishType:
259+ part := Finish{}
260+ if err := json.Unmarshal(wrapper.Data, &part); err != nil {
261+ return nil, err
262+ }
263+ parts = append(parts, part)
264+ default:
265+ return nil, fmt.Errorf("unknown part type: %s", wrapper.Type)
266+ }
267+
268+ }
269+
270+ return parts, nil
218271}
internal/tui/components/repl/messages.go+70−15
@@ -5,6 +5,7 @@ import (
55 "fmt"
66 "sort"
77 "strings"
8+ "time"
89
910 "github.com/charmbracelet/bubbles/key"
1011 "github.com/charmbracelet/bubbles/viewport"
@@ -13,6 +14,7 @@ import (
1314 "github.com/charmbracelet/lipgloss"
1415 "github.com/kujtimiihoxha/termai/internal/app"
1516 "github.com/kujtimiihoxha/termai/internal/llm/agent"
17+ "github.com/kujtimiihoxha/termai/internal/lsp/protocol"
1618 "github.com/kujtimiihoxha/termai/internal/message"
1719 "github.com/kujtimiihoxha/termai/internal/pubsub"
1820 "github.com/kujtimiihoxha/termai/internal/session"
@@ -39,6 +41,7 @@ type messagesCmp struct {
3941 height int
4042 focused bool
4143 cachedView string
44+ timeLoaded time.Time
4245}
4346
4447func (m *messagesCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
@@ -51,7 +54,8 @@ func (m *messagesCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
5154 m.viewport.GotoBottom()
5255 }
5356 for _, v := range m.messages {
54− for _, c := range v.ToolCalls {
57+ for _, c := range v.ToolCalls() {
58+ // the message is being added to the session of a tool called
5559 if c.ID == msg.Payload.SessionID {
5660 m.renderView()
5761 m.viewport.GotoBottom()
@@ -130,12 +134,11 @@ func hasUnfinishedMessages(messages []message.Message) bool {
130134 return false
131135 }
132136 for _, msg := range messages {
133− if !msg.Finished {
137+ if !msg.IsFinished() {
134138 return true
135139 }
136140 }
137− lastMessage := messages[len(messages)-1]
138− return lastMessage.Role != message.Assistant
141+ return false
139142}
140143
141144func (m *messagesCmp) renderMessageWithToolCall(content string, tools []message.ToolCall, futureMessages []message.Message) string {
@@ -205,7 +208,7 @@ func (m *messagesCmp) renderMessageWithToolCall(content string, tools []message.
205208 findToolResult := func(toolCallID string, messages []message.Message) *message.ToolResult {
206209 for _, msg := range messages {
207210 if msg.Role == message.Tool {
208− for _, result := range msg.ToolResults {
211+ for _, result := range msg.ToolResults() {
209212 if result.ToolCallID == toolCallID {
210213 return &result
211214 }
@@ -257,7 +260,7 @@ func (m *messagesCmp) renderMessageWithToolCall(content string, tools []message.
257260 taskSessionMessages, _ := m.app.Messages.List(toolCall.ID)
258261 for _, msg := range taskSessionMessages {
259262 if msg.Role == message.Assistant {
260− for _, toolCall := range msg.ToolCalls {
263+ for _, toolCall := range msg.ToolCalls() {
261264 toolHeader := lipgloss.NewStyle().
262265 Bold(true).
263266 Foreground(styles.Blue).
@@ -304,11 +307,11 @@ func (m *messagesCmp) renderMessageWithToolCall(content string, tools []message.
304307 }
305308
306309 for _, msg := range futureMessages {
307− if msg.Content != "" {
310+ if msg.Content().String() != "" {
308311 break
309312 }
310313
311− for _, toolCall := range msg.ToolCalls {
314+ for _, toolCall := range msg.ToolCalls() {
312315 toolOutput := renderTool(toolCall)
313316 allParts = append(allParts, " "+strings.ReplaceAll(toolOutput, "\n", "\n "))
314317
@@ -339,10 +342,10 @@ func (m *messagesCmp) renderView() {
339342
340343 prevMessageWasUser := false
341344 for inx, msg := range m.messages {
342− content := msg.Content
345+ content := msg.Content().String()
343346 if content != "" || prevMessageWasUser {
344− if msg.Thinking != "" && content == "" {
345− content = msg.Thinking
347+ if msg.ReasoningContent().String() != "" && content == "" {
348+ content = msg.ReasoningContent().String()
346349 } else if content == "" {
347350 content = "..."
348351 }
@@ -367,14 +370,14 @@ func (m *messagesCmp) renderView() {
367370 EmbeddedText: borderText(msg.Role, currentMessage),
368371 },
369372 )
370− if len(msg.ToolCalls) > 0 {
371− content = m.renderMessageWithToolCall(content, msg.ToolCalls, m.messages[inx+1:])
373+ if len(msg.ToolCalls()) > 0 {
374+ content = m.renderMessageWithToolCall(content, msg.ToolCalls(), m.messages[inx+1:])
372375 }
373376 stringMessages = append(stringMessages, content)
374377 currentMessage++
375378 displayedMsgCount++
376379 }
377− if msg.Role == message.User && msg.Content != "" {
380+ if msg.Role == message.User && msg.Content().String() != "" {
378381 prevMessageWasUser = true
379382 } else {
380383 prevMessageWasUser = false
@@ -398,6 +401,57 @@ func (m *messagesCmp) Blur() tea.Cmd {
398401 return nil
399402}
400403
404+func (m *messagesCmp) projectDiagnostics() string {
405+ errorDiagnostics := []protocol.Diagnostic{}
406+ warnDiagnostics := []protocol.Diagnostic{}
407+ hintDiagnostics := []protocol.Diagnostic{}
408+ infoDiagnostics := []protocol.Diagnostic{}
409+ for _, client := range m.app.LSPClients {
410+ for _, d := range client.GetDiagnostics() {
411+ for _, diag := range d {
412+ switch diag.Severity {
413+ case protocol.SeverityError:
414+ errorDiagnostics = append(errorDiagnostics, diag)
415+ case protocol.SeverityWarning:
416+ warnDiagnostics = append(warnDiagnostics, diag)
417+ case protocol.SeverityHint:
418+ hintDiagnostics = append(hintDiagnostics, diag)
419+ case protocol.SeverityInformation:
420+ infoDiagnostics = append(infoDiagnostics, diag)
421+ }
422+ }
423+ }
424+ }
425+
426+ if len(errorDiagnostics) == 0 && len(warnDiagnostics) == 0 && len(hintDiagnostics) == 0 && len(infoDiagnostics) == 0 {
427+ if time.Since(m.timeLoaded) < time.Second*10 {
428+ return "Loading diagnostics..."
429+ }
430+ return "No diagnostics"
431+ }
432+
433+ diagnostics := []string{}
434+
435+ if len(errorDiagnostics) > 0 {
436+ errStr := lipgloss.NewStyle().Foreground(styles.Error).Render(fmt.Sprintf("%s %d", styles.ErrorIcon, len(errorDiagnostics)))
437+ diagnostics = append(diagnostics, errStr)
438+ }
439+ if len(warnDiagnostics) > 0 {
440+ warnStr := lipgloss.NewStyle().Foreground(styles.Warning).Render(fmt.Sprintf("%s %d", styles.WarningIcon, len(warnDiagnostics)))
441+ diagnostics = append(diagnostics, warnStr)
442+ }
443+ if len(hintDiagnostics) > 0 {
444+ hintStr := lipgloss.NewStyle().Foreground(styles.Text).Render(fmt.Sprintf("%s %d", styles.HintIcon, len(hintDiagnostics)))
445+ diagnostics = append(diagnostics, hintStr)
446+ }
447+ if len(infoDiagnostics) > 0 {
448+ infoStr := lipgloss.NewStyle().Foreground(styles.Peach).Render(fmt.Sprintf("%s %d", styles.InfoIcon, len(infoDiagnostics)))
449+ diagnostics = append(diagnostics, infoStr)
450+ }
451+
452+ return strings.Join(diagnostics, " ")
453+}
454+
401455func (m *messagesCmp) BorderText() map[layout.BorderPosition]string {
402456 title := m.session.Title
403457 titleWidth := m.width / 2
@@ -409,7 +463,7 @@ func (m *messagesCmp) BorderText() map[layout.BorderPosition]string {
409463 }
410464 borderTest := map[layout.BorderPosition]string{
411465 layout.TopLeftBorder: title,
412− layout.BottomRightBorder: formatTokensAndCost(m.session.CompletionTokens+m.session.PromptTokens, m.session.Cost),
466+ layout.BottomRightBorder: m.projectDiagnostics(),
413467 }
414468 if hasUnfinishedMessages(m.messages) {
415469 borderTest[layout.BottomLeftBorder] = lipgloss.NewStyle().Foreground(styles.Peach).Render("Thinking...")
@@ -442,6 +496,7 @@ func (m *messagesCmp) SetSize(width int, height int) {
442496}
443497
444498func (m *messagesCmp) Init() tea.Cmd {
499+ m.timeLoaded = time.Now()
445500 return nil
446501}
447502
internal/tui/components/repl/sessions.go−1
@@ -245,4 +245,3 @@ func NewSessionsCmp(app *app.App) SessionsCmp {
245245 focused: false,
246246 }
247247}
248−
internal/tui/styles/icons.go+6−3
@@ -9,8 +9,11 @@ const (
99 UserIcon string = ""
1010
1111 CheckIcon string = "✓"
12− ErrorIcon string = "✗"
12+ ErrorIcon string = ""
13+ WarningIcon string = ""
14+ InfoIcon string = ""
15+ HintIcon string = ""
1316 SpinnerIcon string = "..."
14−
15− SleepIcon string = "󰒲"
17+ BugIcon string = ""
18+ SleepIcon string = "󰒲"
1619)
main.go+2−4
@@ -1,6 +1,3 @@
1−/*
2−Copyright © 2025 NAME HERE <EMAIL ADDRESS>
3−*/
41package main
52
63import (
@@ -11,7 +8,8 @@ import (
118)
129
1310func main() {
14− // Create a log file and make that the log output
11+ // Create a log file and make that the log output DEBUG
12+ // TODO: remove this on release
1513 logfile, err := os.OpenFile("debug.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0o666)
1614 if err != nil {
1715 panic(err)