on main help sign in
feat: LSP implementation using x/powernap (#1011)

* feat: LSP implementation using x/powernap Replace custom LSP client implementation with the `charmbracelet/x/powernap` library, significantly reducing codebase complexity by removing ~12,000 lines of custom LSP protocol handling code. This migration introduces: - **Simplified client architecture**: Replace custom LSP transport, protocol, and method handling with powernap's battle-tested implementation - **Enhanced workspace support**: Add workspace markers and inactive LSP server detection capabilities from powernap - **Improved configuration**: Integrate powernap's default LSP server configurations and settings - **Reduced maintenance burden**: Remove custom protocol definitions, JSON marshaling, and transport layer code - **More features**: e.g. workspace root markers, starting LSP servers only where these files exist The refactor maintains existing functionality while leveraging powernap's robust LSP client foundation, making the codebase more maintainable and feature-rich. Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> chore: updates Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> * fix: code review Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> * revert: unwanted change Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> * fix: improve code Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> * fix: schema Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> * fix: improve merge Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> * fix: unneeded changes Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> * fix: cleanup Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> * fix: several fixes Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> * fix: cleanup Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> * fix: more cleanup Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> * fix: use csync Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> * fix: did close Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> * fix: remove unused code Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> * fix: cleanup Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> * fix: cleanup Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> * fix: clean Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> * fix: cleanup Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> * test: fix Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> * refactor: improve func Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> * fix: http client debug Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> --------- Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> Co-authored-by: Andrey Nering <andreynering@users.noreply.github.com>

commitb00ffcc671ae0cd06d3b1baf5e8c537634e46ccd authorCarlos Alexandro Becker <caarlos0@users.noreply.github.com> dateWed 17 Sep 2025, 14:07 (1 year ago) parent898f1ee
32 files changed+517−12315
go.mod+3 go.sum+7 internal/app/app.go+1−1 internal/app/lsp.go+15−4 internal/config/config.go+8−6 internal/config/load.go+28−29 internal/config/lsp_defaults_test.go+35 internal/llm/tools/diagnostics.go+96−108 internal/log/http.go−4 internal/lsp/caps.go−112 internal/lsp/client.go+182−464 internal/lsp/client_test.go+43−82 internal/lsp/handlers.go+31−24 internal/lsp/language.go+1−1 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−73 internal/lsp/protocol/tables.go−30 internal/lsp/protocol/tsdocument-changes.go−81 internal/lsp/protocol/tsjson.go−3073 internal/lsp/protocol/tsprotocol.go−6952 internal/lsp/protocol/uri.go−229 internal/lsp/rootmarkers_test.go+37 internal/lsp/transport.go−284 internal/lsp/util/edit.go+1−1 internal/lsp/watcher/global_watcher.go+1−1 internal/lsp/watcher/watcher.go+1−2 internal/tui/components/chat/header/header.go+1−1 internal/tui/components/lsp/lsp.go+5−3 schema.json+21−4
go.mod+3
@@ -76,6 +76,7 @@ require (
7676 github.com/charmbracelet/ultraviolet v0.0.0-20250912143111-9785ff826cbf
7777 github.com/charmbracelet/x/cellbuf v0.0.14-0.20250811133356-e0c5dbe5ea4a // indirect
7878 github.com/charmbracelet/x/exp/slice v0.0.0-20250829135019-44e44e21330d
79+ github.com/charmbracelet/x/powernap v0.0.0-20250911135559-c589b77c25e6
7980 github.com/charmbracelet/x/term v0.2.1
8081 github.com/charmbracelet/x/termios v0.1.1 // indirect
8182 github.com/charmbracelet/x/windows v0.2.2 // indirect
@@ -104,6 +105,7 @@ require (
104105 github.com/mattn/go-runewidth v0.0.16 // indirect
105106 github.com/mfridman/interpolate v0.0.2 // indirect
106107 github.com/microcosm-cc/bluemonday v1.0.27 // indirect
108+ github.com/mitchellh/mapstructure v1.5.0 // indirect
107109 github.com/muesli/cancelreader v0.2.2 // indirect
108110 github.com/muesli/mango v0.1.0 // indirect
109111 github.com/muesli/mango-cobra v1.2.0 // indirect
@@ -116,6 +118,7 @@ require (
116118 github.com/rivo/uniseg v0.4.7
117119 github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
118120 github.com/sethvargo/go-retry v0.3.0 // indirect
121+ github.com/sourcegraph/jsonrpc2 v0.2.1 // indirect
119122 github.com/spf13/cast v1.7.1 // indirect
120123 github.com/spf13/pflag v1.0.7 // indirect
121124 github.com/tetratelabs/wazero v1.9.0 // indirect
go.sum+7
@@ -104,6 +104,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20250207160936-21c02780d27a h1:FsHE
104104github.com/charmbracelet/x/exp/golden v0.0.0-20250207160936-21c02780d27a/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U=
105105github.com/charmbracelet/x/exp/slice v0.0.0-20250829135019-44e44e21330d h1:H2oh4WlSsXy8qwLd7I3eAvPd/X3S40aM9l+h47WF1eA=
106106github.com/charmbracelet/x/exp/slice v0.0.0-20250829135019-44e44e21330d/go.mod h1:vI5nDVMWi6veaYH+0Fmvpbe/+cv/iJfMntdh+N0+Tms=
107+github.com/charmbracelet/x/powernap v0.0.0-20250911135559-c589b77c25e6 h1:8XaGEZ453uu9IUBlEWu1I9U+Z7GmdwIzFFzBasRzDEk=
108+github.com/charmbracelet/x/powernap v0.0.0-20250911135559-c589b77c25e6/go.mod h1:cmdl5zlP5mR8TF2Y68UKc7hdGUDiSJ2+4hk0h04Hsx4=
107109github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ=
108110github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg=
109111github.com/charmbracelet/x/termios v0.1.1 h1:o3Q2bT8eqzGnGPOYheoYS8eEleT5ZVNYNy8JawjaNZY=
@@ -157,6 +159,7 @@ github.com/googleapis/gax-go/v2 v2.14.1 h1:hb0FFeiPaQskmvakKu5EbCbpntQn48jyHuvrk
157159github.com/googleapis/gax-go/v2 v2.14.1/go.mod h1:Hb/NubMaVM88SrNkvl8X/o8XWwDJEPqouaLeN2IUxoA=
158160github.com/gorilla/css v1.0.1 h1:ntNaBIghp6JmvWnxbZKANoLyuXTPZ4cAMlo6RyhlbO8=
159161github.com/gorilla/css v1.0.1/go.mod h1:BvnYkspnSzMmwRK+b8/xgNPLiIuNZr6vbZBTPQ2A3b0=
162+github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
160163github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
161164github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
162165github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
@@ -197,6 +200,8 @@ github.com/mfridman/interpolate v0.0.2 h1:pnuTK7MQIxxFz1Gr+rjSIx9u7qVjf5VOoM/u6B
197200github.com/mfridman/interpolate v0.0.2/go.mod h1:p+7uk6oE07mpE/Ik1b8EckO0O4ZXiGAfshKBWLUM9Xg=
198201github.com/microcosm-cc/bluemonday v1.0.27 h1:MpEUotklkwCSLeH+Qdx1VJgNqLlpY2KXwXFM08ygZfk=
199202github.com/microcosm-cc/bluemonday v1.0.27/go.mod h1:jFi9vgW+H7c3V0lb6nR74Ib/DIB5OBs92Dimizgw2cA=
203+github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
204+github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
200205github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA=
201206github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo=
202207github.com/muesli/mango v0.1.0 h1:DZQK45d2gGbql1arsYA4vfg4d7I9Hfx5rX/GCmzsAvI=
@@ -254,6 +259,8 @@ github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN
254259github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
255260github.com/sethvargo/go-retry v0.3.0 h1:EEt31A35QhrcRZtrYFDTBg91cqZVnFL2navjDrah2SE=
256261github.com/sethvargo/go-retry v0.3.0/go.mod h1:mNX17F0C/HguQMyMyJxcnU471gOZGxCLyYaFyAZraas=
262+github.com/sourcegraph/jsonrpc2 v0.2.1 h1:2GtljixMQYUYCmIg7W9aF2dFmniq/mOr2T9tFRh6zSQ=
263+github.com/sourcegraph/jsonrpc2 v0.2.1/go.mod h1:ZafdZgk/axhT1cvZAPOhw+95nz2I/Ra5qMlU4gTRwIo=
257264github.com/spf13/cast v1.7.1 h1:cuNEagBQEHWN1FnbGEjCXL2szYEXqfJPbP2HNUaca9Y=
258265github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
259266github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
internal/app/app.go+1−1
@@ -368,7 +368,7 @@ func (app *App) Shutdown() {
368368 // Shutdown all LSP clients.
369369 for name, client := range clients {
370370 shutdownCtx, cancel := context.WithTimeout(app.globalCtx, 5*time.Second)
371− if err := client.Shutdown(shutdownCtx); err != nil {
371+ if err := client.Close(shutdownCtx); err != nil {
372372 slog.Error("Failed to shutdown LSP client", "name", name, "error", err)
373373 }
374374 cancel()
internal/app/lsp.go+15−4
@@ -14,6 +14,10 @@ import (
1414// initLSPClients initializes LSP clients.
1515func (app *App) initLSPClients(ctx context.Context) {
1616 for name, clientConfig := range app.config.LSP {
17+ if clientConfig.Disabled {
18+ slog.Info("Skipping disabled LSP client", "name", name)
19+ continue
20+ }
1721 go app.createAndStartLSPClient(ctx, name, clientConfig)
1822 }
1923 slog.Info("LSP clients initialization started in background")
@@ -23,11 +27,18 @@ func (app *App) initLSPClients(ctx context.Context) {
2327func (app *App) createAndStartLSPClient(ctx context.Context, name string, config config.LSPConfig) {
2428 slog.Info("Creating LSP client", "name", name, "command", config.Command, "fileTypes", config.FileTypes, "args", config.Args)
2529
30+ // Check if any root markers exist in the working directory (config now has defaults)
31+ if !lsp.HasRootMarkers(app.config.WorkingDir(), config.RootMarkers) {
32+ slog.Info("Skipping LSP client - no root markers found", "name", name, "rootMarkers", config.RootMarkers)
33+ updateLSPState(name, lsp.StateDisabled, nil, nil, 0)
34+ return
35+ }
36+
2637 // Update state to starting
2738 updateLSPState(name, lsp.StateStarting, nil, nil, 0)
2839
2940 // Create LSP client.
30− lspClient, err := lsp.NewClient(ctx, name, config)
41+ lspClient, err := lsp.New(ctx, name, config)
3142 if err != nil {
3243 slog.Error("Failed to create LSP client for", name, err)
3344 updateLSPState(name, lsp.StateError, err, nil, 0)
@@ -42,11 +53,11 @@ func (app *App) createAndStartLSPClient(ctx context.Context, name string, config
4253 defer cancel()
4354
4455 // Initialize LSP client.
45− _, err = lspClient.InitializeLSPClient(initCtx, app.config.WorkingDir())
56+ _, err = lspClient.Initialize(initCtx, app.config.WorkingDir())
4657 if err != nil {
4758 slog.Error("Initialize failed", "name", name, "error", err)
4859 updateLSPState(name, lsp.StateError, err, lspClient, 0)
49− lspClient.Close()
60+ lspClient.Close(ctx)
5061 return
5162 }
5263
@@ -119,7 +130,7 @@ func (app *App) restartLSPClient(ctx context.Context, name string) {
119130 if exists && oldClient != nil {
120131 // Try to shut down client gracefully, but don't block on errors.
121132 shutdownCtx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
122− _ = oldClient.Shutdown(shutdownCtx)
133+ _ = oldClient.Close(shutdownCtx)
123134 cancel()
124135 }
125136
internal/config/config.go+8−6
@@ -117,12 +117,14 @@ type MCPConfig struct {
117117}
118118
119119type LSPConfig struct {
120− Disabled bool `json:"enabled,omitempty" jsonschema:"description=Whether this LSP server is disabled,default=false"`
121− Command string `json:"command" jsonschema:"required,description=Command to execute for the LSP server,example=gopls"`
122− Args []string `json:"args,omitempty" jsonschema:"description=Arguments to pass to the LSP server command"`
123− Env map[string]string `json:"env,omitempty" jsonschema:"description=Environment variables to set to the LSP server command"`
124− Options any `json:"options,omitempty" jsonschema:"description=LSP server-specific configuration options"`
125− FileTypes []string `json:"filetypes,omitempty" jsonschema:"description=File types this LSP server handles,example=go,example=mod,example=rs,example=c,example=js,example=ts"`
120+ Disabled bool `json:"disabled,omitempty" jsonschema:"description=Whether this LSP server is disabled,default=false"`
121+ Command string `json:"command" jsonschema:"required,description=Command to execute for the LSP server,example=gopls"`
122+ Args []string `json:"args,omitempty" jsonschema:"description=Arguments to pass to the LSP server command"`
123+ Env map[string]string `json:"env,omitempty" jsonschema:"description=Environment variables to set to the LSP server command"`
124+ FileTypes []string `json:"filetypes,omitempty" jsonschema:"description=File types this LSP server handles,example=go,example=mod,example=rs,example=c,example=js,example=ts"`
125+ RootMarkers []string `json:"root_markers,omitempty" jsonschema:"description=Files or directories that indicate the project root,example=go.mod,example=package.json,example=Cargo.toml"`
126+ InitOptions map[string]any `json:"init_options,omitempty" jsonschema:"description=Initialization options passed to the LSP server during initialize request"`
127+ Options map[string]any `json:"options,omitempty" jsonschema:"description=LSP server-specific settings passed during initialization"`
126128}
127129
128130type TUIOptions struct {
internal/config/load.go+28−29
@@ -19,6 +19,7 @@ import (
1919 "github.com/charmbracelet/crush/internal/fsext"
2020 "github.com/charmbracelet/crush/internal/home"
2121 "github.com/charmbracelet/crush/internal/log"
22+ powernapConfig "github.com/charmbracelet/x/powernap/pkg/config"
2223)
2324
2425const defaultCatwalkURL = "https://catwalk.charm.sh"
@@ -334,8 +335,8 @@ func (c *Config) setDefaults(workingDir, dataDir string) {
334335 c.LSP = make(map[string]LSPConfig)
335336 }
336337
337− // Apply default file types for known LSP servers if not specified
338− applyDefaultLSPFileTypes(c.LSP)
338+ // Apply defaults to LSP configurations
339+ c.applyLSPDefaults()
339340
340341 // Add the default context paths if they are not already present
341342 c.Options.ContextPaths = append(defaultContextPaths, c.Options.ContextPaths...)
@@ -347,35 +348,33 @@ func (c *Config) setDefaults(workingDir, dataDir string) {
347348 }
348349}
349350
350−var defaultLSPFileTypes = map[string][]string{
351− "gopls": {"go", "mod", "sum", "work"},
352− "typescript-language-server": {"ts", "tsx", "js", "jsx", "mjs", "cjs"},
353− "vtsls": {"ts", "tsx", "js", "jsx", "mjs", "cjs"},
354− "bash-language-server": {"sh", "bash", "zsh", "ksh"},
355− "rust-analyzer": {"rs"},
356− "pyright": {"py", "pyi"},
357− "pylsp": {"py", "pyi"},
358− "clangd": {"c", "cpp", "cc", "cxx", "h", "hpp"},
359− "jdtls": {"java"},
360− "vscode-html-languageserver": {"html", "htm"},
361− "vscode-css-languageserver": {"css", "scss", "sass", "less"},
362− "vscode-json-languageserver": {"json", "jsonc"},
363− "yaml-language-server": {"yaml", "yml"},
364− "lua-language-server": {"lua"},
365− "solargraph": {"rb"},
366− "elixir-ls": {"ex", "exs"},
367− "zls": {"zig"},
368−}
369−
370−// applyDefaultLSPFileTypes sets default file types for known LSP servers
371−func applyDefaultLSPFileTypes(lspConfigs map[string]LSPConfig) {
372− for name, config := range lspConfigs {
373− if len(config.FileTypes) != 0 {
351+// applyLSPDefaults applies default values from powernap to LSP configurations
352+func (c *Config) applyLSPDefaults() {
353+ // Get powernap's default configuration
354+ configManager := powernapConfig.NewManager()
355+ configManager.LoadDefaults()
356+
357+ // Apply defaults to each LSP configuration
358+ for name, cfg := range c.LSP {
359+ // Try to get defaults from powernap based on command name
360+ base, ok := configManager.GetServer(cfg.Command)
361+ if !ok {
374362 continue
375363 }
376− bin := strings.ToLower(filepath.Base(config.Command))
377− config.FileTypes = defaultLSPFileTypes[bin]
378− lspConfigs[name] = config
364+ if cfg.Options == nil {
365+ cfg.Options = base.Settings
366+ }
367+ if cfg.InitOptions == nil {
368+ cfg.InitOptions = base.InitOptions
369+ }
370+ if len(cfg.FileTypes) == 0 {
371+ cfg.FileTypes = base.FileTypes
372+ }
373+ if len(cfg.RootMarkers) == 0 {
374+ cfg.RootMarkers = base.RootMarkers
375+ }
376+ // Update the config in the map
377+ c.LSP[name] = cfg
379378 }
380379}
381380
internal/config/lsp_defaults_test.gonew file+35
@@ -0,0 +1,35 @@
1+package config
2+
3+import (
4+ "testing"
5+
6+ "github.com/stretchr/testify/require"
7+)
8+
9+func TestApplyLSPDefaults(t *testing.T) {
10+ t.Parallel()
11+
12+ // Create a config with an LSP that should get defaults
13+ config := &Config{
14+ LSP: map[string]LSPConfig{
15+ "gopls": {
16+ Command: "gopls", // This should get defaults from powernap
17+ },
18+ "custom": {
19+ Command: "custom-lsp",
20+ RootMarkers: []string{"custom.toml"}, // This should keep its explicit config
21+ },
22+ },
23+ }
24+
25+ // Apply defaults
26+ config.applyLSPDefaults()
27+
28+ // Check that gopls got defaults (it should have some root markers now)
29+ goplsConfig := config.LSP["gopls"]
30+ require.NotEmpty(t, goplsConfig.RootMarkers, "gopls should have received default root markers")
31+
32+ // Check that custom LSP kept its explicit config
33+ customConfig := config.LSP["custom"]
34+ require.Equal(t, []string{"custom.toml"}, customConfig.RootMarkers, "custom LSP should keep its explicit root markers")
35+}
internal/llm/tools/diagnostics.go+96−108
@@ -10,7 +10,7 @@ import (
1010 "time"
1111
1212 "github.com/charmbracelet/crush/internal/lsp"
13− "github.com/charmbracelet/crush/internal/lsp/protocol"
13+ "github.com/charmbracelet/x/powernap/pkg/lsp/protocol"
1414)
1515
1616type DiagnosticsParams struct {
@@ -110,7 +110,7 @@ func waitForLspDiagnostics(ctx context.Context, filePath string, lsps map[string
110110 for _, client := range lsps {
111111 originalDiags := client.GetDiagnostics()
112112
113− handler := func(params json.RawMessage) {
113+ handler := func(_ context.Context, _ string, params json.RawMessage) {
114114 lsp.HandleDiagnostics(client, params)
115115 var diagParams protocol.PublishDiagnosticsParams
116116 if err := json.Unmarshal(params, &diagParams); err != nil {
@@ -167,135 +167,123 @@ func getDiagnostics(filePath string, lsps map[string]*lsp.Client) string {
167167 fileDiagnostics := []string{}
168168 projectDiagnostics := []string{}
169169
170− formatDiagnostic := func(pth string, diagnostic protocol.Diagnostic, source string) string {
171− severity := "Info"
172− switch diagnostic.Severity {
173− case protocol.SeverityError:
174− severity = "Error"
175− case protocol.SeverityWarning:
176− severity = "Warn"
177− case protocol.SeverityHint:
178− severity = "Hint"
170+ for lspName, client := range lsps {
171+ for location, diags := range client.GetDiagnostics() {
172+ path, err := location.Path()
173+ if err != nil {
174+ slog.Error("Failed to convert diagnostic location URI to path", "uri", location, "error", err)
175+ continue
176+ }
177+ isCurrentFile := path == filePath
178+ for _, diag := range diags {
179+ formattedDiag := formatDiagnostic(path, diag, lspName)
180+ if isCurrentFile {
181+ fileDiagnostics = append(fileDiagnostics, formattedDiag)
182+ } else {
183+ projectDiagnostics = append(projectDiagnostics, formattedDiag)
184+ }
185+ }
179186 }
187+ }
180188
181− location := fmt.Sprintf("%s:%d:%d", pth, diagnostic.Range.Start.Line+1, diagnostic.Range.Start.Character+1)
189+ sortDiagnostics(fileDiagnostics)
190+ sortDiagnostics(projectDiagnostics)
182191
183− sourceInfo := ""
184− if diagnostic.Source != "" {
185− sourceInfo = diagnostic.Source
186− } else if source != "" {
187− sourceInfo = source
188− }
189−
190− codeInfo := ""
191− if diagnostic.Code != nil {
192− codeInfo = fmt.Sprintf("[%v]", diagnostic.Code)
193− }
192+ var output strings.Builder
193+ writeDiagnostics(&output, "file_diagnostics", fileDiagnostics)
194+ writeDiagnostics(&output, "project_diagnostics", projectDiagnostics)
194195
195− tagsInfo := ""
196− if len(diagnostic.Tags) > 0 {
197− tags := []string{}
198− for _, tag := range diagnostic.Tags {
199− switch tag {
200− case protocol.Unnecessary:
201− tags = append(tags, "unnecessary")
202− case protocol.Deprecated:
203− tags = append(tags, "deprecated")
204− }
205− }
206− if len(tags) > 0 {
207− tagsInfo = fmt.Sprintf(" (%s)", strings.Join(tags, ", "))
208− }
209− }
196+ if len(fileDiagnostics) > 0 || len(projectDiagnostics) > 0 {
197+ fileErrors := countSeverity(fileDiagnostics, "Error")
198+ fileWarnings := countSeverity(fileDiagnostics, "Warn")
199+ projectErrors := countSeverity(projectDiagnostics, "Error")
200+ projectWarnings := countSeverity(projectDiagnostics, "Warn")
210201
211− return fmt.Sprintf("%s: %s [%s]%s%s %s",
212− severity,
213− location,
214− sourceInfo,
215− codeInfo,
216− tagsInfo,
217− diagnostic.Message)
202+ output.WriteString("\n<diagnostic_summary>\n")
203+ fmt.Fprintf(&output, "Current file: %d errors, %d warnings\n", fileErrors, fileWarnings)
204+ fmt.Fprintf(&output, "Project: %d errors, %d warnings\n", projectErrors, projectWarnings)
205+ output.WriteString("</diagnostic_summary>\n")
218206 }
219207
220− for lspName, client := range lsps {
221− diagnostics := client.GetDiagnostics()
222− if len(diagnostics) > 0 {
223− for location, diags := range diagnostics {
224− path, err := location.Path()
225− if err != nil {
226− slog.Error("Failed to convert diagnostic location URI to path", "uri", location, "error", err)
227− continue
228− }
229− isCurrentFile := path == filePath
230−
231− for _, diag := range diags {
232− formattedDiag := formatDiagnostic(path, diag, lspName)
208+ out := output.String()
209+ slog.Info("Diagnostics", "output", fmt.Sprintf("%q", out))
210+ return out
211+}
233212
234− if isCurrentFile {
235− fileDiagnostics = append(fileDiagnostics, formattedDiag)
236− } else {
237− projectDiagnostics = append(projectDiagnostics, formattedDiag)
238− }
239− }
240− }
241− }
213+func writeDiagnostics(output *strings.Builder, tag string, in []string) {
214+ if len(in) == 0 {
215+ return
216+ }
217+ output.WriteString("\n<" + tag + ">\n")
218+ if len(in) > 10 {
219+ output.WriteString(strings.Join(in[:10], "\n"))
220+ fmt.Fprintf(output, "\n... and %d more diagnostics", len(in)-10)
221+ } else {
222+ output.WriteString(strings.Join(in, "\n"))
242223 }
224+ output.WriteString("\n</" + tag + ">\n")
225+}
243226
244− sort.Slice(fileDiagnostics, func(i, j int) bool {
245− iIsError := strings.HasPrefix(fileDiagnostics[i], "Error")
246− jIsError := strings.HasPrefix(fileDiagnostics[j], "Error")
227+func sortDiagnostics(in []string) []string {
228+ sort.Slice(in, func(i, j int) bool {
229+ iIsError := strings.HasPrefix(in[i], "Error")
230+ jIsError := strings.HasPrefix(in[j], "Error")
247231 if iIsError != jIsError {
248232 return iIsError // Errors come first
249233 }
250− return fileDiagnostics[i] < fileDiagnostics[j] // Then alphabetically
234+ return in[i] < in[j] // Then alphabetically
251235 })
236+ return in
237+}
252238
253− sort.Slice(projectDiagnostics, func(i, j int) bool {
254− iIsError := strings.HasPrefix(projectDiagnostics[i], "Error")
255− jIsError := strings.HasPrefix(projectDiagnostics[j], "Error")
256− if iIsError != jIsError {
257− return iIsError
258− }
259− return projectDiagnostics[i] < projectDiagnostics[j]
260− })
239+func formatDiagnostic(pth string, diagnostic protocol.Diagnostic, source string) string {
240+ severity := "Info"
241+ switch diagnostic.Severity {
242+ case protocol.SeverityError:
243+ severity = "Error"
244+ case protocol.SeverityWarning:
245+ severity = "Warn"
246+ case protocol.SeverityHint:
247+ severity = "Hint"
248+ }
261249
262− var output strings.Builder
250+ location := fmt.Sprintf("%s:%d:%d", pth, diagnostic.Range.Start.Line+1, diagnostic.Range.Start.Character+1)
263251
264− if len(fileDiagnostics) > 0 {
265− output.WriteString("\n<file_diagnostics>\n")
266− if len(fileDiagnostics) > 10 {
267− output.WriteString(strings.Join(fileDiagnostics[:10], "\n"))
268− fmt.Fprintf(&output, "\n... and %d more diagnostics", len(fileDiagnostics)-10)
269− } else {
270− output.WriteString(strings.Join(fileDiagnostics, "\n"))
271− }
272− output.WriteString("\n</file_diagnostics>\n")
252+ sourceInfo := ""
253+ if diagnostic.Source != "" {
254+ sourceInfo = diagnostic.Source
255+ } else if source != "" {
256+ sourceInfo = source
273257 }
274258
275− if len(projectDiagnostics) > 0 {
276− output.WriteString("\n<project_diagnostics>\n")
277− if len(projectDiagnostics) > 10 {
278− output.WriteString(strings.Join(projectDiagnostics[:10], "\n"))
279− fmt.Fprintf(&output, "\n... and %d more diagnostics", len(projectDiagnostics)-10)
280− } else {
281− output.WriteString(strings.Join(projectDiagnostics, "\n"))
282− }
283− output.WriteString("\n</project_diagnostics>\n")
259+ codeInfo := ""
260+ if diagnostic.Code != nil {
261+ codeInfo = fmt.Sprintf("[%v]", diagnostic.Code)
284262 }
285263
286− if len(fileDiagnostics) > 0 || len(projectDiagnostics) > 0 {
287− fileErrors := countSeverity(fileDiagnostics, "Error")
288− fileWarnings := countSeverity(fileDiagnostics, "Warn")
289− projectErrors := countSeverity(projectDiagnostics, "Error")
290− projectWarnings := countSeverity(projectDiagnostics, "Warn")
291−
292− output.WriteString("\n<diagnostic_summary>\n")
293− fmt.Fprintf(&output, "Current file: %d errors, %d warnings\n", fileErrors, fileWarnings)
294− fmt.Fprintf(&output, "Project: %d errors, %d warnings\n", projectErrors, projectWarnings)
295− output.WriteString("</diagnostic_summary>\n")
264+ tagsInfo := ""
265+ if len(diagnostic.Tags) > 0 {
266+ tags := []string{}
267+ for _, tag := range diagnostic.Tags {
268+ switch tag {
269+ case protocol.Unnecessary:
270+ tags = append(tags, "unnecessary")
271+ case protocol.Deprecated:
272+ tags = append(tags, "deprecated")
273+ }
274+ }
275+ if len(tags) > 0 {
276+ tagsInfo = fmt.Sprintf(" (%s)", strings.Join(tags, ", "))
277+ }
296278 }
297279
298− return output.String()
280+ return fmt.Sprintf("%s: %s [%s]%s%s %s",
281+ severity,
282+ location,
283+ sourceInfo,
284+ codeInfo,
285+ tagsInfo,
286+ diagnostic.Message)
299287}
300288
301289func countSeverity(diagnostics []string, severity string) int {
internal/log/http.go−4
@@ -2,7 +2,6 @@ package log
22
33import (
44 "bytes"
5− "context"
65 "encoding/json"
76 "io"
87 "log/slog"
@@ -13,9 +12,6 @@ import (
1312
1413// NewHTTPClient creates an HTTP client with debug logging enabled when debug mode is on.
1514func NewHTTPClient() *http.Client {
16− if !slog.Default().Enabled(context.TODO(), slog.LevelDebug) {
17− return http.DefaultClient
18− }
1915 return &http.Client{
2016 Transport: &HTTPRoundTripLogger{
2117 Transport: http.DefaultTransport,
internal/lsp/caps.godeleted−112
@@ -1,112 +0,0 @@
1−package lsp
2−
3−import "github.com/charmbracelet/crush/internal/lsp/protocol"
4−
5−func (c *Client) setCapabilities(caps protocol.ServerCapabilities) {
6− c.capsMu.Lock()
7− defer c.capsMu.Unlock()
8− c.caps = caps
9− c.capsSet.Store(true)
10−}
11−
12−func (c *Client) getCapabilities() (protocol.ServerCapabilities, bool) {
13− c.capsMu.RLock()
14− defer c.capsMu.RUnlock()
15− return c.caps, c.capsSet.Load()
16−}
17−
18−func (c *Client) IsMethodSupported(method string) bool {
19− // Always allow core lifecycle and generic methods
20− switch method {
21− case "initialize", "shutdown", "exit", "$/cancelRequest":
22− return true
23− }
24−
25− caps, ok := c.getCapabilities()
26− if !ok {
27− // caps not set yet, be permissive
28− return true
29− }
30−
31− switch method {
32− case "textDocument/hover":
33− return caps.HoverProvider != nil
34− case "textDocument/definition":
35− return caps.DefinitionProvider != nil
36− case "textDocument/references":
37− return caps.ReferencesProvider != nil
38− case "textDocument/implementation":
39− return caps.ImplementationProvider != nil
40− case "textDocument/typeDefinition":
41− return caps.TypeDefinitionProvider != nil
42− case "textDocument/documentColor", "textDocument/colorPresentation":
43− return caps.ColorProvider != nil
44− case "textDocument/foldingRange":
45− return caps.FoldingRangeProvider != nil
46− case "textDocument/declaration":
47− return caps.DeclarationProvider != nil
48− case "textDocument/selectionRange":
49− return caps.SelectionRangeProvider != nil
50− case "textDocument/prepareCallHierarchy", "callHierarchy/incomingCalls", "callHierarchy/outgoingCalls":
51− return caps.CallHierarchyProvider != nil
52− case "textDocument/semanticTokens/full", "textDocument/semanticTokens/full/delta", "textDocument/semanticTokens/range":
53− return caps.SemanticTokensProvider != nil
54− case "textDocument/linkedEditingRange":
55− return caps.LinkedEditingRangeProvider != nil
56− case "workspace/willCreateFiles":
57− return caps.Workspace != nil && caps.Workspace.FileOperations != nil && caps.Workspace.FileOperations.WillCreate != nil
58− case "workspace/willRenameFiles":
59− return caps.Workspace != nil && caps.Workspace.FileOperations != nil && caps.Workspace.FileOperations.WillRename != nil
60− case "workspace/willDeleteFiles":
61− return caps.Workspace != nil && caps.Workspace.FileOperations != nil && caps.Workspace.FileOperations.WillDelete != nil
62− case "textDocument/moniker":
63− return caps.MonikerProvider != nil
64− case "textDocument/prepareTypeHierarchy", "typeHierarchy/supertypes", "typeHierarchy/subtypes":
65− return caps.TypeHierarchyProvider != nil
66− case "textDocument/inlineValue":
67− return caps.InlineValueProvider != nil
68− case "textDocument/inlayHint", "inlayHint/resolve":
69− return caps.InlayHintProvider != nil
70− case "textDocument/diagnostic", "workspace/diagnostic":
71− return caps.DiagnosticProvider != nil
72− case "textDocument/inlineCompletion":
73− return caps.InlineCompletionProvider != nil
74− case "workspace/textDocumentContent":
75− return caps.Workspace != nil && caps.Workspace.TextDocumentContent != nil
76− case "textDocument/willSaveWaitUntil":
77− if caps.TextDocumentSync == nil {
78− return false
79− }
80− return true
81− case "textDocument/completion", "completionItem/resolve":
82− return caps.CompletionProvider != nil
83− case "textDocument/signatureHelp":
84− return caps.SignatureHelpProvider != nil
85− case "textDocument/documentHighlight":
86− return caps.DocumentHighlightProvider != nil
87− case "textDocument/documentSymbol":
88− return caps.DocumentSymbolProvider != nil
89− case "textDocument/codeAction", "codeAction/resolve":
90− return caps.CodeActionProvider != nil
91− case "workspace/symbol", "workspaceSymbol/resolve":
92− return caps.WorkspaceSymbolProvider != nil
93− case "textDocument/codeLens", "codeLens/resolve":
94− return caps.CodeLensProvider != nil
95− case "textDocument/documentLink", "documentLink/resolve":
96− return caps.DocumentLinkProvider != nil
97− case "textDocument/formatting":
98− return caps.DocumentFormattingProvider != nil
99− case "textDocument/rangeFormatting":
100− return caps.DocumentRangeFormattingProvider != nil
101− case "textDocument/rangesFormatting":
102− return caps.DocumentRangeFormattingProvider != nil
103− case "textDocument/onTypeFormatting":
104− return caps.DocumentOnTypeFormattingProvider != nil
105− case "textDocument/rename", "textDocument/prepareRename":
106− return caps.RenameProvider != nil
107− case "workspace/executeCommand":
108− return caps.ExecuteCommandProvider != nil
109− default:
110− return true
111− }
112−}
internal/lsp/client.go+182−464
@@ -1,291 +1,160 @@
11package lsp
22
33import (
4− "bufio"
54 "context"
65 "encoding/json"
76 "fmt"
8− "io"
97 "log/slog"
108 "maps"
119 "os"
12− "os/exec"
1310 "path/filepath"
14− "slices"
1511 "strings"
16− "sync"
1712 "sync/atomic"
1813 "time"
1914
2015 "github.com/charmbracelet/crush/internal/config"
21− "github.com/charmbracelet/crush/internal/log"
22− "github.com/charmbracelet/crush/internal/lsp/protocol"
16+ "github.com/charmbracelet/crush/internal/csync"
17+ "github.com/charmbracelet/crush/internal/fsext"
18+ powernap "github.com/charmbracelet/x/powernap/pkg/lsp"
19+ "github.com/charmbracelet/x/powernap/pkg/lsp/protocol"
20+ "github.com/charmbracelet/x/powernap/pkg/transport"
2321)
2422
2523type Client struct {
26− Cmd *exec.Cmd
27− stdin io.WriteCloser
28− stdout *bufio.Reader
29− stderr io.ReadCloser
30−
31− // Client name for identification
32− name string
24+ client *powernap.Client
25+ name string
3326
3427 // File types this LSP server handles (e.g., .go, .rs, .py)
3528 fileTypes []string
3629
30+ // Configuration for this LSP client
31+ config config.LSPConfig
32+
3733 // Diagnostic change callback
3834 onDiagnosticsChanged func(name string, count int)
3935
40− // Request ID counter
41− nextID atomic.Int32
42−
43− // Response handlers
44− handlers map[int32]chan *Message
45− handlersMu sync.RWMutex
46−
47− // Server request handlers
48− serverRequestHandlers map[string]ServerRequestHandler
49− serverHandlersMu sync.RWMutex
50−
51− // Notification handlers
52− notificationHandlers map[string]NotificationHandler
53− notificationMu sync.RWMutex
54−
5536 // Diagnostic cache
56− diagnostics map[protocol.DocumentURI][]protocol.Diagnostic
57− diagnosticsMu sync.RWMutex
37+ diagnostics *csync.Map[protocol.DocumentURI, []protocol.Diagnostic]
5838
5939 // Files are currently opened by the LSP
60− openFiles map[string]*OpenFileInfo
61− openFilesMu sync.RWMutex
40+ openFiles *csync.Map[string, *OpenFileInfo]
6241
6342 // Server state
6443 serverState atomic.Value
65−
66− // Server capabilities as returned by initialize
67− caps protocol.ServerCapabilities
68− capsMu sync.RWMutex
69− capsSet atomic.Bool
7044}
7145
72−// NewClient creates a new LSP client.
73−func NewClient(ctx context.Context, name string, config config.LSPConfig) (*Client, error) {
74− cmd := exec.CommandContext(ctx, config.Command, config.Args...)
75−
76− // Copy env
77− cmd.Env = slices.Concat(os.Environ(), config.ResolvedEnv())
78−
79− stdin, err := cmd.StdinPipe()
80− if err != nil {
81− return nil, fmt.Errorf("failed to create stdin pipe: %w", err)
82− }
83−
84− stdout, err := cmd.StdoutPipe()
46+// New creates a new LSP client using the powernap implementation.
47+func New(ctx context.Context, name string, config config.LSPConfig) (*Client, error) {
48+ // Convert working directory to file URI
49+ workDir, err := os.Getwd()
8550 if err != nil {
86− return nil, fmt.Errorf("failed to create stdout pipe: %w", err)
51+ return nil, fmt.Errorf("failed to get working directory: %w", err)
52+ }
53+
54+ rootURI := string(protocol.URIFromPath(workDir))
55+
56+ // Create powernap client config
57+ clientConfig := powernap.ClientConfig{
58+ Command: config.Command,
59+ Args: config.Args,
60+ RootURI: rootURI,
61+ Environment: func() map[string]string {
62+ env := make(map[string]string)
63+ maps.Copy(env, config.Env)
64+ return env
65+ }(),
66+ Settings: config.Options,
67+ InitOptions: config.InitOptions,
68+ WorkspaceFolders: []protocol.WorkspaceFolder{
69+ {
70+ URI: rootURI,
71+ Name: filepath.Base(workDir),
72+ },
73+ },
8774 }
8875
89− stderr, err := cmd.StderrPipe()
76+ // Create the powernap client
77+ powernapClient, err := powernap.NewClient(clientConfig)
9078 if err != nil {
91− return nil, fmt.Errorf("failed to create stderr pipe: %w", err)
79+ return nil, fmt.Errorf("failed to create powernap client: %w", err)
9280 }
9381
9482 client := &Client{
95− Cmd: cmd,
96− name: name,
97− fileTypes: config.FileTypes,
98− stdin: stdin,
99− stdout: bufio.NewReader(stdout),
100− stderr: stderr,
101− handlers: make(map[int32]chan *Message),
102− notificationHandlers: make(map[string]NotificationHandler),
103− serverRequestHandlers: make(map[string]ServerRequestHandler),
104− diagnostics: make(map[protocol.DocumentURI][]protocol.Diagnostic),
105− openFiles: make(map[string]*OpenFileInfo),
83+ client: powernapClient,
84+ name: name,
85+ fileTypes: config.FileTypes,
86+ diagnostics: csync.NewMap[protocol.DocumentURI, []protocol.Diagnostic](),
87+ openFiles: csync.NewMap[string, *OpenFileInfo](),
88+ config: config,
10689 }
10790
10891 // Initialize server state
10992 client.serverState.Store(StateStarting)
11093
111− // Start the LSP server process
112− if err := cmd.Start(); err != nil {
113− return nil, fmt.Errorf("failed to start LSP server: %w", err)
114− }
115−
116− // Handle stderr in a separate goroutine
117− go func() {
118− scanner := bufio.NewScanner(stderr)
119− for scanner.Scan() {
120− slog.Error("LSP Server", "err", scanner.Text())
121− }
122− if err := scanner.Err(); err != nil {
123− slog.Error("Error reading", "err", err)
124− }
125− }()
126−
127− // Start message handling loop
128− go func() {
129− defer log.RecoverPanic("LSP-message-handler", func() {
130− slog.Error("LSP message handler crashed, LSP functionality may be impaired")
131− })
132− client.handleMessages()
133− }()
134−
13594 return client, nil
13695}
13796
138−func (c *Client) RegisterNotificationHandler(method string, handler NotificationHandler) {
139− c.notificationMu.Lock()
140− defer c.notificationMu.Unlock()
141− c.notificationHandlers[method] = handler
142−}
143−
144−func (c *Client) RegisterServerRequestHandler(method string, handler ServerRequestHandler) {
145− c.serverHandlersMu.Lock()
146− defer c.serverHandlersMu.Unlock()
147− c.serverRequestHandlers[method] = handler
148−}
149−
150−func (c *Client) InitializeLSPClient(ctx context.Context, workspaceDir string) (*protocol.InitializeResult, error) {
151− initParams := protocol.ParamInitialize{
152− WorkspaceFoldersInitializeParams: protocol.WorkspaceFoldersInitializeParams{
153− WorkspaceFolders: []protocol.WorkspaceFolder{
154− {
155− URI: protocol.URI(protocol.URIFromPath(workspaceDir)),
156− Name: workspaceDir,
157− },
158− },
159− },
160−
161− XInitializeParams: protocol.XInitializeParams{
162− ProcessID: int32(os.Getpid()),
163− ClientInfo: &protocol.ClientInfo{
164− Name: "mcp-language-server",
165− Version: "0.1.0",
166− },
167− RootPath: workspaceDir,
168− RootURI: protocol.URIFromPath(workspaceDir),
169− Capabilities: protocol.ClientCapabilities{
170− Workspace: protocol.WorkspaceClientCapabilities{
171− Configuration: true,
172− DidChangeConfiguration: protocol.DidChangeConfigurationClientCapabilities{
173− DynamicRegistration: true,
174− },
175− DidChangeWatchedFiles: protocol.DidChangeWatchedFilesClientCapabilities{
176− DynamicRegistration: true,
177− RelativePatternSupport: true,
178− },
179− },
180− TextDocument: protocol.TextDocumentClientCapabilities{
181− Synchronization: &protocol.TextDocumentSyncClientCapabilities{
182− DynamicRegistration: true,
183− DidSave: true,
184− },
185− Completion: protocol.CompletionClientCapabilities{
186− CompletionItem: protocol.ClientCompletionItemOptions{},
187− },
188− CodeLens: &protocol.CodeLensClientCapabilities{
189− DynamicRegistration: true,
190− },
191− DocumentSymbol: protocol.DocumentSymbolClientCapabilities{},
192− CodeAction: protocol.CodeActionClientCapabilities{
193− CodeActionLiteralSupport: protocol.ClientCodeActionLiteralOptions{
194− CodeActionKind: protocol.ClientCodeActionKindOptions{
195− ValueSet: []protocol.CodeActionKind{},
196− },
197− },
198− },
199− PublishDiagnostics: protocol.PublishDiagnosticsClientCapabilities{
200− VersionSupport: true,
201− },
202− SemanticTokens: protocol.SemanticTokensClientCapabilities{
203− Requests: protocol.ClientSemanticTokensRequestOptions{
204− Range: &protocol.Or_ClientSemanticTokensRequestOptions_range{},
205− Full: &protocol.Or_ClientSemanticTokensRequestOptions_full{},
206− },
207− TokenTypes: []string{},
208− TokenModifiers: []string{},
209− Formats: []protocol.TokenFormat{},
210− },
211− },
212− Window: protocol.WindowClientCapabilities{},
213− },
214− InitializationOptions: map[string]any{
215− "codelenses": map[string]bool{
216− "generate": true,
217− "regenerate_cgo": true,
218− "test": true,
219− "tidy": true,
220− "upgrade_dependency": true,
221− "vendor": true,
222− "vulncheck": false,
223− },
224− },
225− },
226− }
227−
228− result, err := c.Initialize(ctx, initParams)
229− if err != nil {
230− return nil, fmt.Errorf("initialize failed: %w", err)
97+// Initialize initializes the LSP client and returns the server capabilities.
98+func (c *Client) Initialize(ctx context.Context, workspaceDir string) (*protocol.InitializeResult, error) {
99+ if err := c.client.Initialize(ctx, false); err != nil {
100+ return nil, fmt.Errorf("failed to initialize powernap client: %w", err)
101+ }
102+
103+ // Convert powernap capabilities to protocol capabilities
104+ caps := c.client.GetCapabilities()
105+ protocolCaps := protocol.ServerCapabilities{
106+ TextDocumentSync: caps.TextDocumentSync,
107+ CompletionProvider: func() *protocol.CompletionOptions {
108+ if caps.CompletionProvider != nil {
109+ return &protocol.CompletionOptions{
110+ TriggerCharacters: caps.CompletionProvider.TriggerCharacters,
111+ AllCommitCharacters: caps.CompletionProvider.AllCommitCharacters,
112+ ResolveProvider: caps.CompletionProvider.ResolveProvider,
113+ }
114+ }
115+ return nil
116+ }(),
231117 }
232118
233− c.setCapabilities(result.Capabilities)
234−
235− if err := c.Initialized(ctx, protocol.InitializedParams{}); err != nil {
236− return nil, fmt.Errorf("initialized notification failed: %w", err)
119+ result := &protocol.InitializeResult{
120+ Capabilities: protocolCaps,
237121 }
238122
239− // Register handlers
240123 c.RegisterServerRequestHandler("workspace/applyEdit", HandleApplyEdit)
241124 c.RegisterServerRequestHandler("workspace/configuration", HandleWorkspaceConfiguration)
242125 c.RegisterServerRequestHandler("client/registerCapability", HandleRegisterCapability)
243126 c.RegisterNotificationHandler("window/showMessage", HandleServerMessage)
244− c.RegisterNotificationHandler("textDocument/publishDiagnostics", func(params json.RawMessage) {
127+ c.RegisterNotificationHandler("textDocument/publishDiagnostics", func(_ context.Context, _ string, params json.RawMessage) {
245128 HandleDiagnostics(c, params)
246129 })
247130
248− return &result, nil
131+ return result, nil
249132}
250133
251−func (c *Client) Close() error {
134+// Close closes the LSP client.
135+func (c *Client) Close(ctx context.Context) error {
252136 // Try to close all open files first
253− ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
137+ ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
254138 defer cancel()
255139
256− // Attempt to close files but continue shutdown regardless
257140 c.CloseAllFiles(ctx)
258141
259− // Close stdin to signal the server
260− if err := c.stdin.Close(); err != nil {
261− return fmt.Errorf("failed to close stdin: %w", err)
142+ // Shutdown and exit the client
143+ if err := c.client.Shutdown(ctx); err != nil {
144+ slog.Warn("Failed to shutdown LSP client", "error", err)
262145 }
263146
264− // Use a channel to handle the Wait with timeout
265− done := make(chan error, 1)
266− go func() {
267− done <- c.Cmd.Wait()
268− }()
269−
270− // Wait for process to exit with timeout
271− select {
272− case err := <-done:
273− return err
274− case <-time.After(2 * time.Second):
275− // If we timeout, try to kill the process
276− if err := c.Cmd.Process.Kill(); err != nil {
277− return fmt.Errorf("failed to kill process: %w", err)
278− }
279− return fmt.Errorf("process killed after timeout")
280− }
147+ return c.client.Exit()
281148}
282149
150+// ServerState represents the state of an LSP server
283151type ServerState int
284152
285153const (
286154 StateStarting ServerState = iota
287155 StateReady
288156 StateError
157+ StateDisabled
289158)
290159
291160// GetServerState returns the current state of the LSP server
@@ -311,8 +180,7 @@ func (c *Client) SetDiagnosticsCallback(callback func(name string, count int)) {
311180 c.onDiagnosticsChanged = callback
312181}
313182
314−// WaitForServerReady waits for the server to be ready by polling the server
315−// with a simple request until it responds successfully or times out
183+// WaitForServerReady waits for the server to be ready
316184func (c *Client) WaitForServerReady(ctx context.Context) error {
317185 cfg := config.Get()
318186
@@ -327,7 +195,7 @@ func (c *Client) WaitForServerReady(ctx context.Context) error {
327195 ticker := time.NewTicker(500 * time.Millisecond)
328196 defer ticker.Stop()
329197
330− if cfg.Options.DebugLSP {
198+ if cfg != nil && cfg.Options.DebugLSP {
331199 slog.Debug("Waiting for LSP server to be ready...")
332200 }
333201
@@ -339,17 +207,17 @@ func (c *Client) WaitForServerReady(ctx context.Context) error {
339207 c.SetServerState(StateError)
340208 return fmt.Errorf("timeout waiting for LSP server to be ready")
341209 case <-ticker.C:
342− // Try a ping method appropriate for this server type
343− if err := c.ping(ctx); err != nil {
344− if cfg.Options.DebugLSP {
345− slog.Debug("LSP server not ready yet", "error", err, "server", c.name)
210+ // Check if client is running
211+ if !c.client.IsRunning() {
212+ if cfg != nil && cfg.Options.DebugLSP {
213+ slog.Debug("LSP server not ready yet", "server", c.name)
346214 }
347215 continue
348216 }
349217
350− // Server responded successfully
218+ // Server is ready
351219 c.SetServerState(StateReady)
352− if cfg.Options.DebugLSP {
220+ if cfg != nil && cfg.Options.DebugLSP {
353221 slog.Debug("LSP server is ready")
354222 }
355223 return nil
@@ -357,171 +225,13 @@ func (c *Client) WaitForServerReady(ctx context.Context) error {
357225 }
358226}
359227
360−// ServerType represents the type of LSP server
361−type ServerType int
362−
363−const (
364− ServerTypeUnknown ServerType = iota
365− ServerTypeGo
366− ServerTypeTypeScript
367− ServerTypeRust
368− ServerTypePython
369− ServerTypeGeneric
370−)
371−
372−// detectServerType tries to determine what type of LSP server we're dealing with
373−func (c *Client) detectServerType() ServerType {
374− if c.Cmd == nil {
375− return ServerTypeUnknown
376− }
377−
378− cmdPath := strings.ToLower(c.Cmd.Path)
379−
380− switch {
381− case strings.Contains(cmdPath, "gopls"):
382− return ServerTypeGo
383− case strings.Contains(cmdPath, "typescript") || strings.Contains(cmdPath, "vtsls") || strings.Contains(cmdPath, "tsserver"):
384− return ServerTypeTypeScript
385− case strings.Contains(cmdPath, "rust-analyzer"):
386− return ServerTypeRust
387− case strings.Contains(cmdPath, "pyright") || strings.Contains(cmdPath, "pylsp") || strings.Contains(cmdPath, "python"):
388− return ServerTypePython
389− default:
390− return ServerTypeGeneric
391− }
392−}
393−
394−// openKeyConfigFiles opens important configuration files that help initialize the server
395−func (c *Client) openKeyConfigFiles(ctx context.Context) {
396− workDir := config.Get().WorkingDir()
397− serverType := c.detectServerType()
398−
399− var filesToOpen []string
400−
401− switch serverType {
402− case ServerTypeTypeScript:
403− // TypeScript servers need these config files to properly initialize
404− filesToOpen = []string{
405− filepath.Join(workDir, "tsconfig.json"),
406− filepath.Join(workDir, "package.json"),
407− filepath.Join(workDir, "jsconfig.json"),
408− }
409−
410− // Also find and open a few TypeScript files to help the server initialize
411− c.openTypeScriptFiles(ctx, workDir)
412− case ServerTypeGo:
413− filesToOpen = []string{
414− filepath.Join(workDir, "go.mod"),
415− filepath.Join(workDir, "go.sum"),
416− }
417− case ServerTypeRust:
418− filesToOpen = []string{
419− filepath.Join(workDir, "Cargo.toml"),
420− filepath.Join(workDir, "Cargo.lock"),
421− }
422− }
423−
424− // Try to open each file, ignoring errors if they don't exist
425− for _, file := range filesToOpen {
426− if _, err := os.Stat(file); err == nil {
427− // File exists, try to open it
428− if err := c.OpenFile(ctx, file); err != nil {
429− slog.Debug("Failed to open key config file", "file", file, "error", err)
430− } else {
431− slog.Debug("Opened key config file for initialization", "file", file)
432− }
433− }
434− }
435−}
436−
437−// ping sends a ping request...
438−func (c *Client) ping(ctx context.Context) error {
439− if _, err := c.Symbol(ctx, protocol.WorkspaceSymbolParams{}); err == nil {
440− return nil
441− }
442− // This is a very lightweight request that should work for most servers
443− return c.Notify(ctx, "$/cancelRequest", protocol.CancelParams{ID: "1"})
444−}
445−
446−// openTypeScriptFiles finds and opens TypeScript files to help initialize the server
447−func (c *Client) openTypeScriptFiles(ctx context.Context, workDir string) {
448− cfg := config.Get()
449− filesOpened := 0
450− maxFilesToOpen := 5 // Limit to a reasonable number of files
451−
452− // Find and open TypeScript files
453− err := filepath.WalkDir(workDir, func(path string, d os.DirEntry, err error) error {
454− if err != nil {
455− return err
456− }
457−
458− // Skip directories and non-TypeScript files
459− if d.IsDir() {
460− // Skip common directories to avoid wasting time
461− if shouldSkipDir(path) {
462− return filepath.SkipDir
463− }
464− return nil
465− }
466−
467− // Check if we've opened enough files
468− if filesOpened >= maxFilesToOpen {
469− return filepath.SkipAll
470− }
471−
472− // Check file extension
473− ext := filepath.Ext(path)
474− if ext == ".ts" || ext == ".tsx" || ext == ".js" || ext == ".jsx" {
475− // Try to open the file
476− if err := c.OpenFile(ctx, path); err == nil {
477− filesOpened++
478− if cfg.Options.DebugLSP {
479− slog.Debug("Opened TypeScript file for initialization", "file", path)
480− }
481− }
482− }
483−
484− return nil
485− })
486−
487− if err != nil && cfg.Options.DebugLSP {
488− slog.Debug("Error walking directory for TypeScript files", "error", err)
489− }
490−
491− if cfg.Options.DebugLSP {
492− slog.Debug("Opened TypeScript files for initialization", "count", filesOpened)
493− }
494−}
495−
496−// shouldSkipDir returns true if the directory should be skipped during file search
497−func shouldSkipDir(path string) bool {
498− dirName := filepath.Base(path)
499−
500− // Skip hidden directories
501− if strings.HasPrefix(dirName, ".") {
502− return true
503− }
504−
505− // Skip common directories that won't contain relevant source files
506− skipDirs := map[string]bool{
507− "node_modules": true,
508− "dist": true,
509− "build": true,
510− "coverage": true,
511− "vendor": true,
512− "target": true,
513− }
514−
515− return skipDirs[dirName]
516−}
517−
228+// OpenFileInfo contains information about an open file
518229type OpenFileInfo struct {
519230 Version int32
520231 URI protocol.DocumentURI
521232}
522233
523−// HandlesFile checks if this LSP client handles the given file based on its
524−// extension.
234+// HandlesFile checks if this LSP client handles the given file based on its extension.
525235func (c *Client) HandlesFile(path string) bool {
526236 // If no file types are specified, handle all files (backward compatibility)
527237 if len(c.fileTypes) == 0 {
@@ -529,13 +239,13 @@ func (c *Client) HandlesFile(path string) bool {
529239 }
530240
531241 name := strings.ToLower(filepath.Base(path))
532− for _, filetpe := range c.fileTypes {
533− suffix := strings.ToLower(filetpe)
242+ for _, filetype := range c.fileTypes {
243+ suffix := strings.ToLower(filetype)
534244 if !strings.HasPrefix(suffix, ".") {
535245 suffix = "." + suffix
536246 }
537247 if strings.HasSuffix(name, suffix) {
538− slog.Debug("handles file", "name", c.name, "file", name, "filetype", filetpe)
248+ slog.Debug("handles file", "name", c.name, "file", name, "filetype", filetype)
539249 return true
540250 }
541251 }
@@ -543,6 +253,7 @@ func (c *Client) HandlesFile(path string) bool {
543253 return false
544254}
545255
256+// OpenFile opens a file in the LSP server.
546257func (c *Client) OpenFile(ctx context.Context, filepath string) error {
547258 if !c.HandlesFile(filepath) {
548259 return nil
@@ -550,12 +261,9 @@ func (c *Client) OpenFile(ctx context.Context, filepath string) error {
550261
551262 uri := string(protocol.URIFromPath(filepath))
552263
553− c.openFilesMu.Lock()
554− if _, exists := c.openFiles[uri]; exists {
555− c.openFilesMu.Unlock()
264+ if _, exists := c.openFiles.Get(uri); exists {
556265 return nil // Already open
557266 }
558− c.openFilesMu.Unlock()
559267
560268 // Skip files that do not exist or cannot be read
561269 content, err := os.ReadFile(filepath)
@@ -563,29 +271,20 @@ func (c *Client) OpenFile(ctx context.Context, filepath string) error {
563271 return fmt.Errorf("error reading file: %w", err)
564272 }
565273
566− params := protocol.DidOpenTextDocumentParams{
567− TextDocument: protocol.TextDocumentItem{
568− URI: protocol.DocumentURI(uri),
569− LanguageID: DetectLanguageID(uri),
570− Version: 1,
571− Text: string(content),
572− },
573− }
574−
575− if err := c.DidOpen(ctx, params); err != nil {
274+ // Notify the server about the opened document
275+ if err = c.client.NotifyDidOpenTextDocument(ctx, uri, string(DetectLanguageID(uri)), 1, string(content)); err != nil {
576276 return err
577277 }
578278
579− c.openFilesMu.Lock()
580− c.openFiles[uri] = &OpenFileInfo{
279+ c.openFiles.Set(uri, &OpenFileInfo{
581280 Version: 1,
582281 URI: protocol.DocumentURI(uri),
583− }
584− c.openFilesMu.Unlock()
282+ })
585283
586284 return nil
587285}
588286
287+// NotifyChange notifies the server about a file change.
589288func (c *Client) NotifyChange(ctx context.Context, filepath string) error {
590289 uri := string(protocol.URIFromPath(filepath))
591290
@@ -594,84 +293,62 @@ func (c *Client) NotifyChange(ctx context.Context, filepath string) error {
594293 return fmt.Errorf("error reading file: %w", err)
595294 }
596295
597− c.openFilesMu.Lock()
598− fileInfo, isOpen := c.openFiles[uri]
296+ fileInfo, isOpen := c.openFiles.Get(uri)
599297 if !isOpen {
600− c.openFilesMu.Unlock()
601298 return fmt.Errorf("cannot notify change for unopened file: %s", filepath)
602299 }
603300
604301 // Increment version
605302 fileInfo.Version++
606− version := fileInfo.Version
607− c.openFilesMu.Unlock()
608303
609− params := protocol.DidChangeTextDocumentParams{
610− TextDocument: protocol.VersionedTextDocumentIdentifier{
611− TextDocumentIdentifier: protocol.TextDocumentIdentifier{
612− URI: protocol.DocumentURI(uri),
613− },
614− Version: version,
615− },
616− ContentChanges: []protocol.TextDocumentContentChangeEvent{
617− {
618− Value: protocol.TextDocumentContentChangeWholeDocument{
619− Text: string(content),
620− },
304+ // Create change event
305+ changes := []protocol.TextDocumentContentChangeEvent{
306+ {
307+ Value: protocol.TextDocumentContentChangeWholeDocument{
308+ Text: string(content),
621309 },
622310 },
623311 }
624312
625− return c.DidChange(ctx, params)
313+ return c.client.NotifyDidChangeTextDocument(ctx, uri, int(fileInfo.Version), changes)
626314}
627315
316+// CloseFile closes a file in the LSP server.
628317func (c *Client) CloseFile(ctx context.Context, filepath string) error {
629318 cfg := config.Get()
630319 uri := string(protocol.URIFromPath(filepath))
631320
632− c.openFilesMu.Lock()
633− if _, exists := c.openFiles[uri]; !exists {
634− c.openFilesMu.Unlock()
321+ if _, exists := c.openFiles.Get(uri); !exists {
635322 return nil // Already closed
636323 }
637− c.openFilesMu.Unlock()
638−
639− params := protocol.DidCloseTextDocumentParams{
640− TextDocument: protocol.TextDocumentIdentifier{
641− URI: protocol.DocumentURI(uri),
642− },
643− }
644324
645325 if cfg.Options.DebugLSP {
646326 slog.Debug("Closing file", "file", filepath)
647327 }
648− if err := c.DidClose(ctx, params); err != nil {
328+
329+ if err := c.client.NotifyDidCloseTextDocument(ctx, uri); err != nil {
649330 return err
650331 }
651332
652− c.openFilesMu.Lock()
653− delete(c.openFiles, uri)
654− c.openFilesMu.Unlock()
333+ c.openFiles.Del(uri)
655334
656335 return nil
657336}
658337
338+// IsFileOpen checks if a file is currently open.
659339func (c *Client) IsFileOpen(filepath string) bool {
660340 uri := string(protocol.URIFromPath(filepath))
661− c.openFilesMu.RLock()
662− defer c.openFilesMu.RUnlock()
663− _, exists := c.openFiles[uri]
341+ _, exists := c.openFiles.Get(uri)
664342 return exists
665343}
666344
667−// CloseAllFiles closes all currently open files
345+// CloseAllFiles closes all currently open files.
668346func (c *Client) CloseAllFiles(ctx context.Context) {
669347 cfg := config.Get()
670− c.openFilesMu.Lock()
671− filesToClose := make([]string, 0, len(c.openFiles))
348+ filesToClose := make([]string, 0, c.openFiles.Len())
672349
673350 // First collect all URIs that need to be closed
674− for uri := range c.openFiles {
351+ for uri := range c.openFiles.Seq2() {
675352 // Convert URI back to file path using proper URI handling
676353 filePath, err := protocol.DocumentURI(uri).Path()
677354 if err != nil {
@@ -680,38 +357,32 @@ func (c *Client) CloseAllFiles(ctx context.Context) {
680357 }
681358 filesToClose = append(filesToClose, filePath)
682359 }
683− c.openFilesMu.Unlock()
684360
685361 // Then close them all
686362 for _, filePath := range filesToClose {
687363 err := c.CloseFile(ctx, filePath)
688− if err != nil && cfg.Options.DebugLSP {
364+ if err != nil && cfg != nil && cfg.Options.DebugLSP {
689365 slog.Warn("Error closing file", "file", filePath, "error", err)
690366 }
691367 }
692368
693− if cfg.Options.DebugLSP {
369+ if cfg != nil && cfg.Options.DebugLSP {
694370 slog.Debug("Closed all files", "files", filesToClose)
695371 }
696372}
697373
374+// GetFileDiagnostics returns diagnostics for a specific file.
698375func (c *Client) GetFileDiagnostics(uri protocol.DocumentURI) []protocol.Diagnostic {
699− c.diagnosticsMu.RLock()
700− defer c.diagnosticsMu.RUnlock()
701−
702− return c.diagnostics[uri]
376+ diags, _ := c.diagnostics.Get(uri)
377+ return diags
703378}
704379
705−// GetDiagnostics returns all diagnostics for all files
380+// GetDiagnostics returns all diagnostics for all files.
706381func (c *Client) GetDiagnostics() map[protocol.DocumentURI][]protocol.Diagnostic {
707− c.diagnosticsMu.RLock()
708− defer c.diagnosticsMu.RUnlock()
709−
710− return maps.Clone(c.diagnostics)
382+ return maps.Collect(c.diagnostics.Seq2())
711383}
712384
713−// OpenFileOnDemand opens a file only if it's not already open
714−// This is used for lazy-loading files when they're actually needed
385+// OpenFileOnDemand opens a file only if it's not already open.
715386func (c *Client) OpenFileOnDemand(ctx context.Context, filepath string) error {
716387 // Check if the file is already open
717388 if c.IsFileOpen(filepath) {
@@ -722,8 +393,7 @@ func (c *Client) OpenFileOnDemand(ctx context.Context, filepath string) error {
722393 return c.OpenFile(ctx, filepath)
723394}
724395
725−// GetDiagnosticsForFile ensures a file is open and returns its diagnostics
726−// This is useful for on-demand diagnostics when using lazy loading
396+// GetDiagnosticsForFile ensures a file is open and returns its diagnostics.
727397func (c *Client) GetDiagnosticsForFile(ctx context.Context, filepath string) ([]protocol.Diagnostic, error) {
728398 documentURI := protocol.URIFromPath(filepath)
729399
@@ -738,16 +408,64 @@ func (c *Client) GetDiagnosticsForFile(ctx context.Context, filepath string) ([]
738408 }
739409
740410 // Get diagnostics
741− c.diagnosticsMu.RLock()
742− diagnostics := c.diagnostics[documentURI]
743− c.diagnosticsMu.RUnlock()
411+ diagnostics, _ := c.diagnostics.Get(documentURI)
744412
745413 return diagnostics, nil
746414}
747415
748−// ClearDiagnosticsForURI removes diagnostics for a specific URI from the cache
416+// ClearDiagnosticsForURI removes diagnostics for a specific URI from the cache.
749417func (c *Client) ClearDiagnosticsForURI(uri protocol.DocumentURI) {
750− c.diagnosticsMu.Lock()
751− defer c.diagnosticsMu.Unlock()
752− delete(c.diagnostics, uri)
418+ c.diagnostics.Del(uri)
419+}
420+
421+// RegisterNotificationHandler registers a notification handler.
422+func (c *Client) RegisterNotificationHandler(method string, handler transport.NotificationHandler) {
423+ c.client.RegisterNotificationHandler(method, handler)
424+}
425+
426+// RegisterServerRequestHandler handles server requests.
427+func (c *Client) RegisterServerRequestHandler(method string, handler transport.Handler) {
428+ c.client.RegisterHandler(method, handler)
429+}
430+
431+// DidChangeWatchedFiles sends a workspace/didChangeWatchedFiles notification to the server.
432+func (c *Client) DidChangeWatchedFiles(ctx context.Context, params protocol.DidChangeWatchedFilesParams) error {
433+ return c.client.NotifyDidChangeWatchedFiles(ctx, params.Changes)
434+}
435+
436+// openKeyConfigFiles opens important configuration files that help initialize the server.
437+func (c *Client) openKeyConfigFiles(ctx context.Context) {
438+ wd, err := os.Getwd()
439+ if err != nil {
440+ return
441+ }
442+
443+ // Try to open each file, ignoring errors if they don't exist
444+ for _, file := range c.config.RootMarkers {
445+ file = filepath.Join(wd, file)
446+ if _, err := os.Stat(file); err == nil {
447+ // File exists, try to open it
448+ if err := c.OpenFile(ctx, file); err != nil {
449+ slog.Debug("Failed to open key config file", "file", file, "error", err)
450+ } else {
451+ slog.Debug("Opened key config file for initialization", "file", file)
452+ }
453+ }
454+ }
455+}
456+
457+// HasRootMarkers checks if any of the specified root marker patterns exist in the given directory.
458+// Uses glob patterns to match files, allowing for more flexible matching.
459+func HasRootMarkers(dir string, rootMarkers []string) bool {
460+ if len(rootMarkers) == 0 {
461+ return true
462+ }
463+ for _, pattern := range rootMarkers {
464+ // Use fsext.GlobWithDoubleStar to find matches
465+ matches, _, err := fsext.GlobWithDoubleStar(pattern, dir, 1)
466+ if err == nil && len(matches) > 0 {
467+ return true
468+ }
469+ }
470+ return false
753471}
internal/lsp/client_test.go+43−82
@@ -1,93 +1,54 @@
11package lsp
22
33import (
4+ "context"
45 "testing"
56
6− "github.com/stretchr/testify/require"
7+ "github.com/charmbracelet/crush/internal/config"
78)
89
9−func TestHandlesFile(t *testing.T) {
10− tests := []struct {
11− name string
12− fileTypes []string
13− filepath string
14− expected bool
15− }{
16− {
17− name: "no file types specified - handles all files",
18− fileTypes: nil,
19− filepath: "test.go",
20− expected: true,
21− },
22− {
23− name: "empty file types - handles all files",
24− fileTypes: []string{},
25− filepath: "test.go",
26− expected: true,
27− },
28− {
29− name: "matches .go extension",
30− fileTypes: []string{".go"},
31− filepath: "main.go",
32− expected: true,
33− },
34− {
35− name: "matches go extension without dot",
36− fileTypes: []string{"go"},
37− filepath: "main.go",
38− expected: true,
39− },
40− {
41− name: "matches one of multiple extensions",
42− fileTypes: []string{".js", ".ts", ".tsx"},
43− filepath: "component.tsx",
44− expected: true,
45− },
46− {
47− name: "does not match extension",
48− fileTypes: []string{".go", ".rs"},
49− filepath: "script.sh",
50− expected: false,
51− },
52− {
53− name: "matches with full path",
54− fileTypes: []string{".sh"},
55− filepath: "/usr/local/bin/script.sh",
56− expected: true,
57− },
58− {
59− name: "case insensitive matching",
60− fileTypes: []string{".GO"},
61− filepath: "main.go",
62− expected: true,
63− },
64− {
65− name: "bash file types",
66− fileTypes: []string{".sh", ".bash", ".zsh", ".ksh"},
67− filepath: "script.sh",
68− expected: true,
69− },
70− {
71− name: "bash should not handle go files",
72− fileTypes: []string{".sh", ".bash", ".zsh", ".ksh"},
73− filepath: "main.go",
74− expected: false,
75− },
76− {
77− name: "bash should not handle json files",
78− fileTypes: []string{".sh", ".bash", ".zsh", ".ksh"},
79− filepath: "config.json",
80− expected: false,
81− },
10+func TestPowernapClient(t *testing.T) {
11+ ctx := context.Background()
12+
13+ // Create a simple config for testing
14+ cfg := config.LSPConfig{
15+ Command: "echo", // Use echo as a dummy command that won't fail
16+ Args: []string{"hello"},
17+ FileTypes: []string{"go"},
18+ Env: map[string]string{},
19+ }
20+
21+ // Test creating a powernap client - this will likely fail with echo
22+ // but we can still test the basic structure
23+ client, err := New(ctx, "test", cfg)
24+ if err != nil {
25+ // Expected to fail with echo command, skip the rest
26+ t.Skipf("Powernap client creation failed as expected with dummy command: %v", err)
27+ return
28+ }
29+
30+ // If we get here, test basic interface methods
31+ if client.GetName() != "test" {
32+ t.Errorf("Expected name 'test', got '%s'", client.GetName())
33+ }
34+
35+ if !client.HandlesFile("test.go") {
36+ t.Error("Expected client to handle .go files")
37+ }
38+
39+ if client.HandlesFile("test.py") {
40+ t.Error("Expected client to not handle .py files")
41+ }
42+
43+ // Test server state
44+ client.SetServerState(StateReady)
45+ if client.GetServerState() != StateReady {
46+ t.Error("Expected server state to be StateReady")
8247 }
8348
84− for _, tt := range tests {
85− t.Run(tt.name, func(t *testing.T) {
86− client := &Client{
87− fileTypes: tt.fileTypes,
88− }
89− result := client.HandlesFile(tt.filepath)
90− require.Equal(t, tt.expected, result)
91− })
49+ // Clean up - expect this to fail with echo command
50+ if err := client.Close(t.Context()); err != nil {
51+ // Expected to fail with echo command
52+ t.Logf("Close failed as expected with dummy command: %v", err)
9253 }
9354}
internal/lsp/handlers.go+31−24
@@ -1,22 +1,22 @@
11package lsp
22
33import (
4+ "context"
45 "encoding/json"
56 "log/slog"
67
78 "github.com/charmbracelet/crush/internal/config"
8−
9− "github.com/charmbracelet/crush/internal/lsp/protocol"
109 "github.com/charmbracelet/crush/internal/lsp/util"
10+ "github.com/charmbracelet/x/powernap/pkg/lsp/protocol"
1111)
1212
13−// Requests
14−
15−func HandleWorkspaceConfiguration(params json.RawMessage) (any, error) {
13+// HandleWorkspaceConfiguration handles workspace configuration requests
14+func HandleWorkspaceConfiguration(_ context.Context, _ string, params json.RawMessage) (any, error) {
1615 return []map[string]any{{}}, nil
1716}
1817
19−func HandleRegisterCapability(params json.RawMessage) (any, error) {
18+// HandleRegisterCapability handles capability registration requests
19+func HandleRegisterCapability(_ context.Context, _ string, params json.RawMessage) (any, error) {
2020 var registerParams protocol.RegistrationParams
2121 if err := json.Unmarshal(params, &registerParams); err != nil {
2222 slog.Error("Error unmarshaling registration params", "error", err)
@@ -32,22 +32,20 @@ func HandleRegisterCapability(params json.RawMessage) (any, error) {
3232 slog.Error("Error marshaling registration options", "error", err)
3333 continue
3434 }
35−
3635 var options protocol.DidChangeWatchedFilesRegistrationOptions
3736 if err := json.Unmarshal(optionsJSON, &options); err != nil {
3837 slog.Error("Error unmarshaling registration options", "error", err)
3938 continue
4039 }
41−
4240 // Store the file watchers registrations
4341 notifyFileWatchRegistration(reg.ID, options.Watchers)
4442 }
4543 }
46−
4744 return nil, nil
4845}
4946
50−func HandleApplyEdit(params json.RawMessage) (any, error) {
47+// HandleApplyEdit handles workspace edit requests
48+func HandleApplyEdit(_ context.Context, _ string, params json.RawMessage) (any, error) {
5149 var edit protocol.ApplyWorkspaceEditParams
5250 if err := json.Unmarshal(params, &edit); err != nil {
5351 return nil, err
@@ -80,21 +78,32 @@ func notifyFileWatchRegistration(id string, watchers []protocol.FileSystemWatche
8078 }
8179}
8280
83−// Notifications
84−
85−func HandleServerMessage(params json.RawMessage) {
81+// HandleServerMessage handles server messages
82+func HandleServerMessage(_ context.Context, method string, params json.RawMessage) {
8683 cfg := config.Get()
87− var msg struct {
88− Type int `json:"type"`
89− Message string `json:"message"`
84+ if !cfg.Options.DebugLSP {
85+ return
9086 }
91− if err := json.Unmarshal(params, &msg); err == nil {
92− if cfg.Options.DebugLSP {
93− slog.Debug("Server message", "type", msg.Type, "message", msg.Message)
94− }
87+
88+ var msg protocol.ShowMessageParams
89+ if err := json.Unmarshal(params, &msg); err != nil {
90+ slog.Debug("Server message", "type", msg.Type, "message", msg.Message)
91+ return
92+ }
93+
94+ switch msg.Type {
95+ case protocol.Error:
96+ slog.Error("LSP Server", "message", msg.Message)
97+ case protocol.Warning:
98+ slog.Warn("LSP Server", "message", msg.Message)
99+ case protocol.Info:
100+ slog.Info("LSP Server", "message", msg.Message)
101+ case protocol.Log:
102+ slog.Debug("LSP Server", "message", msg.Message)
95103 }
96104}
97105
106+// HandleDiagnostics handles diagnostic notifications from the LSP server
98107func HandleDiagnostics(client *Client, params json.RawMessage) {
99108 var diagParams protocol.PublishDiagnosticsParams
100109 if err := json.Unmarshal(params, &diagParams); err != nil {
@@ -102,15 +111,13 @@ func HandleDiagnostics(client *Client, params json.RawMessage) {
102111 return
103112 }
104113
105− client.diagnosticsMu.Lock()
106− client.diagnostics[diagParams.URI] = diagParams.Diagnostics
114+ client.diagnostics.Set(diagParams.URI, diagParams.Diagnostics)
107115
108116 // Calculate total diagnostic count
109117 totalCount := 0
110− for _, diagnostics := range client.diagnostics {
118+ for _, diagnostics := range client.diagnostics.Seq2() {
111119 totalCount += len(diagnostics)
112120 }
113− client.diagnosticsMu.Unlock()
114121
115122 // Trigger callback if set
116123 if client.onDiagnosticsChanged != nil {
internal/lsp/language.go+1−1
@@ -4,7 +4,7 @@ import (
44 "path/filepath"
55 "strings"
66
7− "github.com/charmbracelet/crush/internal/lsp/protocol"
7+ "github.com/charmbracelet/x/powernap/pkg/lsp/protocol"
88)
99
1010func DetectLanguageID(uri string) protocol.LanguageKind {
internal/lsp/methods.godeleted−554
@@ -1,554 +0,0 @@
1−// Generated code. Do not edit
2−package lsp
3−
4−import (
5− "context"
6−
7− "github.com/charmbracelet/crush/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.godeleted−48
@@ -1,48 +0,0 @@
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/LICENSEdeleted−27
@@ -1,27 +0,0 @@
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.godeleted−117
@@ -1,117 +0,0 @@
1−package protocol
2−
3−import "fmt"
4−
5−// WorkspaceSymbolResult 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−// DocumentSymbolResult 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−// AsTextEdit converts 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.godeleted−73
@@ -1,73 +0,0 @@
1−package protocol
2−
3−import (
4− "fmt"
5− "log/slog"
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− var err error
41−
42− switch v := g.Value.(type) {
43− case string:
44− return StringPattern{Pattern: v}, nil
45−
46− case RelativePattern:
47− // Handle BaseURI which could be string or DocumentUri
48− basePath := ""
49− switch baseURI := v.BaseURI.Value.(type) {
50− case string:
51− basePath, err = DocumentURI(baseURI).Path()
52− if err != nil {
53− slog.Error("Failed to convert URI to path", "uri", baseURI, "error", err)
54− return nil, fmt.Errorf("invalid URI: %s", baseURI)
55− }
56−
57− case DocumentURI:
58− basePath, err = baseURI.Path()
59− if err != nil {
60− slog.Error("Failed to convert DocumentURI to path", "uri", baseURI, "error", err)
61− return nil, fmt.Errorf("invalid DocumentURI: %s", baseURI)
62− }
63−
64− default:
65− return nil, fmt.Errorf("unknown BaseURI type: %T", v.BaseURI.Value)
66− }
67−
68− return RelativePatternInfo{RP: v, BasePath: basePath}, nil
69−
70− default:
71− return nil, fmt.Errorf("unknown pattern type: %T", g.Value)
72− }
73−}
internal/lsp/protocol/tables.godeleted−30
@@ -1,30 +0,0 @@
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.godeleted−81
@@ -1,81 +0,0 @@
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 (d DocumentChange) Valid() bool {
27− n := 0
28− if d.TextDocumentEdit != nil {
29− n++
30− }
31− if d.CreateFile != nil {
32− n++
33− }
34− if d.RenameFile != nil {
35− n++
36− }
37− if d.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.godeleted−3073
@@ -1,3073 +0,0 @@
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 (
14− "bytes"
15− "encoding/json"
16− "fmt"
17−)
18−
19−// UnmarshalError indicates that a JSON value did not conform to
20−// one of the expected cases of an LSP union type.
21−type UnmarshalError struct {
22− msg string
23−}
24−
25−func (e UnmarshalError) Error() string {
26− return e.msg
27−}
28−func (t Or_CancelParams_id) MarshalJSON() ([]byte, error) {
29− switch x := t.Value.(type) {
30− case int32:
31− return json.Marshal(x)
32− case string:
33− return json.Marshal(x)
34− case nil:
35− return []byte("null"), nil
36− }
37− return nil, fmt.Errorf("type %T not one of [int32 string]", t)
38−}
39−
40−func (t *Or_CancelParams_id) UnmarshalJSON(x []byte) error {
41− if string(x) == "null" {
42− t.Value = nil
43− return nil
44− }
45− decoder41 := json.NewDecoder(bytes.NewReader(x))
46− decoder41.DisallowUnknownFields()
47− var int32Val int32
48− if err := decoder41.Decode(&int32Val); err == nil {
49− t.Value = int32Val
50− return nil
51− }
52− decoder42 := json.NewDecoder(bytes.NewReader(x))
53− decoder42.DisallowUnknownFields()
54− var stringVal string
55− if err := decoder42.Decode(&stringVal); err == nil {
56− t.Value = stringVal
57− return nil
58− }
59− return &UnmarshalError{"unmarshal failed to match one of [int32 string]"}
60−}
61−
62−func (t Or_ClientSemanticTokensRequestOptions_full) MarshalJSON() ([]byte, error) {
63− switch x := t.Value.(type) {
64− case ClientSemanticTokensRequestFullDelta:
65− return json.Marshal(x)
66− case bool:
67− return json.Marshal(x)
68− case nil:
69− return []byte("null"), nil
70− }
71− return nil, fmt.Errorf("type %T not one of [ClientSemanticTokensRequestFullDelta bool]", t)
72−}
73−
74−func (t *Or_ClientSemanticTokensRequestOptions_full) UnmarshalJSON(x []byte) error {
75− if string(x) == "null" {
76− t.Value = nil
77− return nil
78− }
79− decoder220 := json.NewDecoder(bytes.NewReader(x))
80− decoder220.DisallowUnknownFields()
81− var boolVal bool
82− if err := decoder220.Decode(&boolVal); err == nil {
83− t.Value = boolVal
84− return nil
85− }
86− decoder221 := json.NewDecoder(bytes.NewReader(x))
87− decoder221.DisallowUnknownFields()
88− var h221 ClientSemanticTokensRequestFullDelta
89− if err := decoder221.Decode(&h221); err == nil {
90− t.Value = h221
91− return nil
92− }
93− return &UnmarshalError{"unmarshal failed to match one of [ClientSemanticTokensRequestFullDelta bool]"}
94−}
95−
96−func (t Or_ClientSemanticTokensRequestOptions_range) MarshalJSON() ([]byte, error) {
97− switch x := t.Value.(type) {
98− case Lit_ClientSemanticTokensRequestOptions_range_Item1:
99− return json.Marshal(x)
100− case bool:
101− return json.Marshal(x)
102− case nil:
103− return []byte("null"), nil
104− }
105− return nil, fmt.Errorf("type %T not one of [Lit_ClientSemanticTokensRequestOptions_range_Item1 bool]", t)
106−}
107−
108−func (t *Or_ClientSemanticTokensRequestOptions_range) UnmarshalJSON(x []byte) error {
109− if string(x) == "null" {
110− t.Value = nil
111− return nil
112− }
113− decoder217 := json.NewDecoder(bytes.NewReader(x))
114− decoder217.DisallowUnknownFields()
115− var boolVal bool
116− if err := decoder217.Decode(&boolVal); err == nil {
117− t.Value = boolVal
118− return nil
119− }
120− decoder218 := json.NewDecoder(bytes.NewReader(x))
121− decoder218.DisallowUnknownFields()
122− var h218 Lit_ClientSemanticTokensRequestOptions_range_Item1
123− if err := decoder218.Decode(&h218); err == nil {
124− t.Value = h218
125− return nil
126− }
127− return &UnmarshalError{"unmarshal failed to match one of [Lit_ClientSemanticTokensRequestOptions_range_Item1 bool]"}
128−}
129−
130−func (t Or_CompletionItemDefaults_editRange) MarshalJSON() ([]byte, error) {
131− switch x := t.Value.(type) {
132− case EditRangeWithInsertReplace:
133− return json.Marshal(x)
134− case Range:
135− return json.Marshal(x)
136− case nil:
137− return []byte("null"), nil
138− }
139− return nil, fmt.Errorf("type %T not one of [EditRangeWithInsertReplace Range]", t)
140−}
141−
142−func (t *Or_CompletionItemDefaults_editRange) UnmarshalJSON(x []byte) error {
143− if string(x) == "null" {
144− t.Value = nil
145− return nil
146− }
147− decoder183 := json.NewDecoder(bytes.NewReader(x))
148− decoder183.DisallowUnknownFields()
149− var h183 EditRangeWithInsertReplace
150− if err := decoder183.Decode(&h183); err == nil {
151− t.Value = h183
152− return nil
153− }
154− decoder184 := json.NewDecoder(bytes.NewReader(x))
155− decoder184.DisallowUnknownFields()
156− var h184 Range
157− if err := decoder184.Decode(&h184); err == nil {
158− t.Value = h184
159− return nil
160− }
161− return &UnmarshalError{"unmarshal failed to match one of [EditRangeWithInsertReplace Range]"}
162−}
163−
164−func (t Or_CompletionItem_documentation) MarshalJSON() ([]byte, error) {
165− switch x := t.Value.(type) {
166− case MarkupContent:
167− return json.Marshal(x)
168− case string:
169− return json.Marshal(x)
170− case nil:
171− return []byte("null"), nil
172− }
173− return nil, fmt.Errorf("type %T not one of [MarkupContent string]", t)
174−}
175−
176−func (t *Or_CompletionItem_documentation) UnmarshalJSON(x []byte) error {
177− if string(x) == "null" {
178− t.Value = nil
179− return nil
180− }
181− decoder25 := json.NewDecoder(bytes.NewReader(x))
182− decoder25.DisallowUnknownFields()
183− var stringVal string
184− if err := decoder25.Decode(&stringVal); err == nil {
185− t.Value = stringVal
186− return nil
187− }
188− decoder26 := json.NewDecoder(bytes.NewReader(x))
189− decoder26.DisallowUnknownFields()
190− var h26 MarkupContent
191− if err := decoder26.Decode(&h26); err == nil {
192− t.Value = h26
193− return nil
194− }
195− return &UnmarshalError{"unmarshal failed to match one of [MarkupContent string]"}
196−}
197−
198−func (t Or_CompletionItem_textEdit) MarshalJSON() ([]byte, error) {
199− switch x := t.Value.(type) {
200− case InsertReplaceEdit:
201− return json.Marshal(x)
202− case TextEdit:
203− return json.Marshal(x)
204− case nil:
205− return []byte("null"), nil
206− }
207− return nil, fmt.Errorf("type %T not one of [InsertReplaceEdit TextEdit]", t)
208−}
209−
210−func (t *Or_CompletionItem_textEdit) UnmarshalJSON(x []byte) error {
211− if string(x) == "null" {
212− t.Value = nil
213− return nil
214− }
215− decoder29 := json.NewDecoder(bytes.NewReader(x))
216− decoder29.DisallowUnknownFields()
217− var h29 InsertReplaceEdit
218− if err := decoder29.Decode(&h29); err == nil {
219− t.Value = h29
220− return nil
221− }
222− decoder30 := json.NewDecoder(bytes.NewReader(x))
223− decoder30.DisallowUnknownFields()
224− var h30 TextEdit
225− if err := decoder30.Decode(&h30); err == nil {
226− t.Value = h30
227− return nil
228− }
229− return &UnmarshalError{"unmarshal failed to match one of [InsertReplaceEdit TextEdit]"}
230−}
231−
232−func (t Or_Declaration) MarshalJSON() ([]byte, error) {
233− switch x := t.Value.(type) {
234− case Location:
235− return json.Marshal(x)
236− case []Location:
237− return json.Marshal(x)
238− case nil:
239− return []byte("null"), nil
240− }
241− return nil, fmt.Errorf("type %T not one of [Location []Location]", t)
242−}
243−
244−func (t *Or_Declaration) UnmarshalJSON(x []byte) error {
245− if string(x) == "null" {
246− t.Value = nil
247− return nil
248− }
249− decoder237 := json.NewDecoder(bytes.NewReader(x))
250− decoder237.DisallowUnknownFields()
251− var h237 Location
252− if err := decoder237.Decode(&h237); err == nil {
253− t.Value = h237
254− return nil
255− }
256− decoder238 := json.NewDecoder(bytes.NewReader(x))
257− decoder238.DisallowUnknownFields()
258− var h238 []Location
259− if err := decoder238.Decode(&h238); err == nil {
260− t.Value = h238
261− return nil
262− }
263− return &UnmarshalError{"unmarshal failed to match one of [Location []Location]"}
264−}
265−
266−func (t Or_Definition) MarshalJSON() ([]byte, error) {
267− switch x := t.Value.(type) {
268− case Location:
269− return json.Marshal(x)
270− case []Location:
271− return json.Marshal(x)
272− case nil:
273− return []byte("null"), nil
274− }
275− return nil, fmt.Errorf("type %T not one of [Location []Location]", t)
276−}
277−
278−func (t *Or_Definition) UnmarshalJSON(x []byte) error {
279− if string(x) == "null" {
280− t.Value = nil
281− return nil
282− }
283− decoder224 := json.NewDecoder(bytes.NewReader(x))
284− decoder224.DisallowUnknownFields()
285− var h224 Location
286− if err := decoder224.Decode(&h224); err == nil {
287− t.Value = h224
288− return nil
289− }
290− decoder225 := json.NewDecoder(bytes.NewReader(x))
291− decoder225.DisallowUnknownFields()
292− var h225 []Location
293− if err := decoder225.Decode(&h225); err == nil {
294− t.Value = h225
295− return nil
296− }
297− return &UnmarshalError{"unmarshal failed to match one of [Location []Location]"}
298−}
299−
300−func (t Or_Diagnostic_code) MarshalJSON() ([]byte, error) {
301− switch x := t.Value.(type) {
302− case int32:
303− return json.Marshal(x)
304− case string:
305− return json.Marshal(x)
306− case nil:
307− return []byte("null"), nil
308− }
309− return nil, fmt.Errorf("type %T not one of [int32 string]", t)
310−}
311−
312−func (t *Or_Diagnostic_code) UnmarshalJSON(x []byte) error {
313− if string(x) == "null" {
314− t.Value = nil
315− return nil
316− }
317− decoder179 := json.NewDecoder(bytes.NewReader(x))
318− decoder179.DisallowUnknownFields()
319− var int32Val int32
320− if err := decoder179.Decode(&int32Val); err == nil {
321− t.Value = int32Val
322− return nil
323− }
324− decoder180 := json.NewDecoder(bytes.NewReader(x))
325− decoder180.DisallowUnknownFields()
326− var stringVal string
327− if err := decoder180.Decode(&stringVal); err == nil {
328− t.Value = stringVal
329− return nil
330− }
331− return &UnmarshalError{"unmarshal failed to match one of [int32 string]"}
332−}
333−
334−func (t Or_DidChangeConfigurationRegistrationOptions_section) MarshalJSON() ([]byte, error) {
335− switch x := t.Value.(type) {
336− case []string:
337− return json.Marshal(x)
338− case string:
339− return json.Marshal(x)
340− case nil:
341− return []byte("null"), nil
342− }
343− return nil, fmt.Errorf("type %T not one of [[]string string]", t)
344−}
345−
346−func (t *Or_DidChangeConfigurationRegistrationOptions_section) UnmarshalJSON(x []byte) error {
347− if string(x) == "null" {
348− t.Value = nil
349− return nil
350− }
351− decoder22 := json.NewDecoder(bytes.NewReader(x))
352− decoder22.DisallowUnknownFields()
353− var stringVal string
354− if err := decoder22.Decode(&stringVal); err == nil {
355− t.Value = stringVal
356− return nil
357− }
358− decoder23 := json.NewDecoder(bytes.NewReader(x))
359− decoder23.DisallowUnknownFields()
360− var h23 []string
361− if err := decoder23.Decode(&h23); err == nil {
362− t.Value = h23
363− return nil
364− }
365− return &UnmarshalError{"unmarshal failed to match one of [[]string string]"}
366−}
367−
368−func (t Or_DocumentDiagnosticReport) MarshalJSON() ([]byte, error) {
369− switch x := t.Value.(type) {
370− case RelatedFullDocumentDiagnosticReport:
371− return json.Marshal(x)
372− case RelatedUnchangedDocumentDiagnosticReport:
373− return json.Marshal(x)
374− case nil:
375− return []byte("null"), nil
376− }
377− return nil, fmt.Errorf("type %T not one of [RelatedFullDocumentDiagnosticReport RelatedUnchangedDocumentDiagnosticReport]", t)
378−}
379−
380−func (t *Or_DocumentDiagnosticReport) UnmarshalJSON(x []byte) error {
381− if string(x) == "null" {
382− t.Value = nil
383− return nil
384− }
385− decoder247 := json.NewDecoder(bytes.NewReader(x))
386− decoder247.DisallowUnknownFields()
387− var h247 RelatedFullDocumentDiagnosticReport
388− if err := decoder247.Decode(&h247); err == nil {
389− t.Value = h247
390− return nil
391− }
392− decoder248 := json.NewDecoder(bytes.NewReader(x))
393− decoder248.DisallowUnknownFields()
394− var h248 RelatedUnchangedDocumentDiagnosticReport
395− if err := decoder248.Decode(&h248); err == nil {
396− t.Value = h248
397− return nil
398− }
399− return &UnmarshalError{"unmarshal failed to match one of [RelatedFullDocumentDiagnosticReport RelatedUnchangedDocumentDiagnosticReport]"}
400−}
401−
402−func (t Or_DocumentDiagnosticReportPartialResult_relatedDocuments_Value) MarshalJSON() ([]byte, error) {
403− switch x := t.Value.(type) {
404− case FullDocumentDiagnosticReport:
405− return json.Marshal(x)
406− case UnchangedDocumentDiagnosticReport:
407− return json.Marshal(x)
408− case nil:
409− return []byte("null"), nil
410− }
411− return nil, fmt.Errorf("type %T not one of [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]", t)
412−}
413−
414−func (t *Or_DocumentDiagnosticReportPartialResult_relatedDocuments_Value) UnmarshalJSON(x []byte) error {
415− if string(x) == "null" {
416− t.Value = nil
417− return nil
418− }
419− decoder16 := json.NewDecoder(bytes.NewReader(x))
420− decoder16.DisallowUnknownFields()
421− var h16 FullDocumentDiagnosticReport
422− if err := decoder16.Decode(&h16); err == nil {
423− t.Value = h16
424− return nil
425− }
426− decoder17 := json.NewDecoder(bytes.NewReader(x))
427− decoder17.DisallowUnknownFields()
428− var h17 UnchangedDocumentDiagnosticReport
429− if err := decoder17.Decode(&h17); err == nil {
430− t.Value = h17
431− return nil
432− }
433− return &UnmarshalError{"unmarshal failed to match one of [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]"}
434−}
435−
436−func (t Or_DocumentFilter) MarshalJSON() ([]byte, error) {
437− switch x := t.Value.(type) {
438− case NotebookCellTextDocumentFilter:
439− return json.Marshal(x)
440− case TextDocumentFilter:
441− return json.Marshal(x)
442− case nil:
443− return []byte("null"), nil
444− }
445− return nil, fmt.Errorf("type %T not one of [NotebookCellTextDocumentFilter TextDocumentFilter]", t)
446−}
447−
448−func (t *Or_DocumentFilter) UnmarshalJSON(x []byte) error {
449− if string(x) == "null" {
450− t.Value = nil
451− return nil
452− }
453− decoder270 := json.NewDecoder(bytes.NewReader(x))
454− decoder270.DisallowUnknownFields()
455− var h270 NotebookCellTextDocumentFilter
456− if err := decoder270.Decode(&h270); err == nil {
457− t.Value = h270
458− return nil
459− }
460− decoder271 := json.NewDecoder(bytes.NewReader(x))
461− decoder271.DisallowUnknownFields()
462− var h271 TextDocumentFilter
463− if err := decoder271.Decode(&h271); err == nil {
464− t.Value = h271
465− return nil
466− }
467− return &UnmarshalError{"unmarshal failed to match one of [NotebookCellTextDocumentFilter TextDocumentFilter]"}
468−}
469−
470−func (t Or_GlobPattern) MarshalJSON() ([]byte, error) {
471− switch x := t.Value.(type) {
472− case Pattern:
473− return json.Marshal(x)
474− case RelativePattern:
475− return json.Marshal(x)
476− case nil:
477− return []byte("null"), nil
478− }
479− return nil, fmt.Errorf("type %T not one of [Pattern RelativePattern]", t)
480−}
481−
482−func (t *Or_GlobPattern) UnmarshalJSON(x []byte) error {
483− if string(x) == "null" {
484− t.Value = nil
485− return nil
486− }
487− decoder274 := json.NewDecoder(bytes.NewReader(x))
488− decoder274.DisallowUnknownFields()
489− var h274 Pattern
490− if err := decoder274.Decode(&h274); err == nil {
491− t.Value = h274
492− return nil
493− }
494− decoder275 := json.NewDecoder(bytes.NewReader(x))
495− decoder275.DisallowUnknownFields()
496− var h275 RelativePattern
497− if err := decoder275.Decode(&h275); err == nil {
498− t.Value = h275
499− return nil
500− }
501− return &UnmarshalError{"unmarshal failed to match one of [Pattern RelativePattern]"}
502−}
503−
504−func (t Or_Hover_contents) MarshalJSON() ([]byte, error) {
505− switch x := t.Value.(type) {
506− case MarkedString:
507− return json.Marshal(x)
508− case MarkupContent:
509− return json.Marshal(x)
510− case []MarkedString:
511− return json.Marshal(x)
512− case nil:
513− return []byte("null"), nil
514− }
515− return nil, fmt.Errorf("type %T not one of [MarkedString MarkupContent []MarkedString]", t)
516−}
517−
518−func (t *Or_Hover_contents) UnmarshalJSON(x []byte) error {
519− if string(x) == "null" {
520− t.Value = nil
521− return nil
522− }
523− decoder34 := json.NewDecoder(bytes.NewReader(x))
524− decoder34.DisallowUnknownFields()
525− var h34 MarkedString
526− if err := decoder34.Decode(&h34); err == nil {
527− t.Value = h34
528− return nil
529− }
530− decoder35 := json.NewDecoder(bytes.NewReader(x))
531− decoder35.DisallowUnknownFields()
532− var h35 MarkupContent
533− if err := decoder35.Decode(&h35); err == nil {
534− t.Value = h35
535− return nil
536− }
537− decoder36 := json.NewDecoder(bytes.NewReader(x))
538− decoder36.DisallowUnknownFields()
539− var h36 []MarkedString
540− if err := decoder36.Decode(&h36); err == nil {
541− t.Value = h36
542− return nil
543− }
544− return &UnmarshalError{"unmarshal failed to match one of [MarkedString MarkupContent []MarkedString]"}
545−}
546−
547−func (t Or_InlayHintLabelPart_tooltip) MarshalJSON() ([]byte, error) {
548− switch x := t.Value.(type) {
549− case MarkupContent:
550− return json.Marshal(x)
551− case string:
552− return json.Marshal(x)
553− case nil:
554− return []byte("null"), nil
555− }
556− return nil, fmt.Errorf("type %T not one of [MarkupContent string]", t)
557−}
558−
559−func (t *Or_InlayHintLabelPart_tooltip) UnmarshalJSON(x []byte) error {
560− if string(x) == "null" {
561− t.Value = nil
562− return nil
563− }
564− decoder56 := json.NewDecoder(bytes.NewReader(x))
565− decoder56.DisallowUnknownFields()
566− var stringVal string
567− if err := decoder56.Decode(&stringVal); err == nil {
568− t.Value = stringVal
569− return nil
570− }
571− decoder57 := json.NewDecoder(bytes.NewReader(x))
572− decoder57.DisallowUnknownFields()
573− var h57 MarkupContent
574− if err := decoder57.Decode(&h57); err == nil {
575− t.Value = h57
576− return nil
577− }
578− return &UnmarshalError{"unmarshal failed to match one of [MarkupContent string]"}
579−}
580−
581−func (t Or_InlayHint_label) MarshalJSON() ([]byte, error) {
582− switch x := t.Value.(type) {
583− case []InlayHintLabelPart:
584− return json.Marshal(x)
585− case string:
586− return json.Marshal(x)
587− case nil:
588− return []byte("null"), nil
589− }
590− return nil, fmt.Errorf("type %T not one of [[]InlayHintLabelPart string]", t)
591−}
592−
593−func (t *Or_InlayHint_label) UnmarshalJSON(x []byte) error {
594− if string(x) == "null" {
595− t.Value = nil
596− return nil
597− }
598− decoder9 := json.NewDecoder(bytes.NewReader(x))
599− decoder9.DisallowUnknownFields()
600− var stringVal string
601− if err := decoder9.Decode(&stringVal); err == nil {
602− t.Value = stringVal
603− return nil
604− }
605− decoder10 := json.NewDecoder(bytes.NewReader(x))
606− decoder10.DisallowUnknownFields()
607− var h10 []InlayHintLabelPart
608− if err := decoder10.Decode(&h10); err == nil {
609− t.Value = h10
610− return nil
611− }
612− return &UnmarshalError{"unmarshal failed to match one of [[]InlayHintLabelPart string]"}
613−}
614−
615−func (t Or_InlayHint_tooltip) MarshalJSON() ([]byte, error) {
616− switch x := t.Value.(type) {
617− case MarkupContent:
618− return json.Marshal(x)
619− case string:
620− return json.Marshal(x)
621− case nil:
622− return []byte("null"), nil
623− }
624− return nil, fmt.Errorf("type %T not one of [MarkupContent string]", t)
625−}
626−
627−func (t *Or_InlayHint_tooltip) UnmarshalJSON(x []byte) error {
628− if string(x) == "null" {
629− t.Value = nil
630− return nil
631− }
632− decoder12 := json.NewDecoder(bytes.NewReader(x))
633− decoder12.DisallowUnknownFields()
634− var stringVal string
635− if err := decoder12.Decode(&stringVal); err == nil {
636− t.Value = stringVal
637− return nil
638− }
639− decoder13 := json.NewDecoder(bytes.NewReader(x))
640− decoder13.DisallowUnknownFields()
641− var h13 MarkupContent
642− if err := decoder13.Decode(&h13); err == nil {
643− t.Value = h13
644− return nil
645− }
646− return &UnmarshalError{"unmarshal failed to match one of [MarkupContent string]"}
647−}
648−
649−func (t Or_InlineCompletionItem_insertText) MarshalJSON() ([]byte, error) {
650− switch x := t.Value.(type) {
651− case StringValue:
652− return json.Marshal(x)
653− case string:
654− return json.Marshal(x)
655− case nil:
656− return []byte("null"), nil
657− }
658− return nil, fmt.Errorf("type %T not one of [StringValue string]", t)
659−}
660−
661−func (t *Or_InlineCompletionItem_insertText) UnmarshalJSON(x []byte) error {
662− if string(x) == "null" {
663− t.Value = nil
664− return nil
665− }
666− decoder19 := json.NewDecoder(bytes.NewReader(x))
667− decoder19.DisallowUnknownFields()
668− var stringVal string
669− if err := decoder19.Decode(&stringVal); err == nil {
670− t.Value = stringVal
671− return nil
672− }
673− decoder20 := json.NewDecoder(bytes.NewReader(x))
674− decoder20.DisallowUnknownFields()
675− var h20 StringValue
676− if err := decoder20.Decode(&h20); err == nil {
677− t.Value = h20
678− return nil
679− }
680− return &UnmarshalError{"unmarshal failed to match one of [StringValue string]"}
681−}
682−
683−func (t Or_InlineValue) MarshalJSON() ([]byte, error) {
684− switch x := t.Value.(type) {
685− case InlineValueEvaluatableExpression:
686− return json.Marshal(x)
687− case InlineValueText:
688− return json.Marshal(x)
689− case InlineValueVariableLookup:
690− return json.Marshal(x)
691− case nil:
692− return []byte("null"), nil
693− }
694− return nil, fmt.Errorf("type %T not one of [InlineValueEvaluatableExpression InlineValueText InlineValueVariableLookup]", t)
695−}
696−
697−func (t *Or_InlineValue) UnmarshalJSON(x []byte) error {
698− if string(x) == "null" {
699− t.Value = nil
700− return nil
701− }
702− decoder242 := json.NewDecoder(bytes.NewReader(x))
703− decoder242.DisallowUnknownFields()
704− var h242 InlineValueEvaluatableExpression
705− if err := decoder242.Decode(&h242); err == nil {
706− t.Value = h242
707− return nil
708− }
709− decoder243 := json.NewDecoder(bytes.NewReader(x))
710− decoder243.DisallowUnknownFields()
711− var h243 InlineValueText
712− if err := decoder243.Decode(&h243); err == nil {
713− t.Value = h243
714− return nil
715− }
716− decoder244 := json.NewDecoder(bytes.NewReader(x))
717− decoder244.DisallowUnknownFields()
718− var h244 InlineValueVariableLookup
719− if err := decoder244.Decode(&h244); err == nil {
720− t.Value = h244
721− return nil
722− }
723− return &UnmarshalError{"unmarshal failed to match one of [InlineValueEvaluatableExpression InlineValueText InlineValueVariableLookup]"}
724−}
725−
726−func (t Or_LSPAny) MarshalJSON() ([]byte, error) {
727− switch x := t.Value.(type) {
728− case LSPArray:
729− return json.Marshal(x)
730− case LSPObject:
731− return json.Marshal(x)
732− case bool:
733− return json.Marshal(x)
734− case float64:
735− return json.Marshal(x)
736− case int32:
737− return json.Marshal(x)
738− case string:
739− return json.Marshal(x)
740− case uint32:
741− return json.Marshal(x)
742− case nil:
743− return []byte("null"), nil
744− }
745− return nil, fmt.Errorf("type %T not one of [LSPArray LSPObject bool float64 int32 string uint32]", t)
746−}
747−
748−func (t *Or_LSPAny) UnmarshalJSON(x []byte) error {
749− if string(x) == "null" {
750− t.Value = nil
751− return nil
752− }
753− decoder228 := json.NewDecoder(bytes.NewReader(x))
754− decoder228.DisallowUnknownFields()
755− var boolVal bool
756− if err := decoder228.Decode(&boolVal); err == nil {
757− t.Value = boolVal
758− return nil
759− }
760− decoder229 := json.NewDecoder(bytes.NewReader(x))
761− decoder229.DisallowUnknownFields()
762− var float64Val float64
763− if err := decoder229.Decode(&float64Val); err == nil {
764− t.Value = float64Val
765− return nil
766− }
767− decoder230 := json.NewDecoder(bytes.NewReader(x))
768− decoder230.DisallowUnknownFields()
769− var int32Val int32
770− if err := decoder230.Decode(&int32Val); err == nil {
771− t.Value = int32Val
772− return nil
773− }
774− decoder231 := json.NewDecoder(bytes.NewReader(x))
775− decoder231.DisallowUnknownFields()
776− var stringVal string
777− if err := decoder231.Decode(&stringVal); err == nil {
778− t.Value = stringVal
779− return nil
780− }
781− decoder232 := json.NewDecoder(bytes.NewReader(x))
782− decoder232.DisallowUnknownFields()
783− var uint32Val uint32
784− if err := decoder232.Decode(&uint32Val); err == nil {
785− t.Value = uint32Val
786− return nil
787− }
788− decoder233 := json.NewDecoder(bytes.NewReader(x))
789− decoder233.DisallowUnknownFields()
790− var h233 LSPArray
791− if err := decoder233.Decode(&h233); err == nil {
792− t.Value = h233
793− return nil
794− }
795− decoder234 := json.NewDecoder(bytes.NewReader(x))
796− decoder234.DisallowUnknownFields()
797− var h234 LSPObject
798− if err := decoder234.Decode(&h234); err == nil {
799− t.Value = h234
800− return nil
801− }
802− return &UnmarshalError{"unmarshal failed to match one of [LSPArray LSPObject bool float64 int32 string uint32]"}
803−}
804−
805−func (t Or_MarkedString) MarshalJSON() ([]byte, error) {
806− switch x := t.Value.(type) {
807− case MarkedStringWithLanguage:
808− return json.Marshal(x)
809− case string:
810− return json.Marshal(x)
811− case nil:
812− return []byte("null"), nil
813− }
814− return nil, fmt.Errorf("type %T not one of [MarkedStringWithLanguage string]", t)
815−}
816−
817−func (t *Or_MarkedString) UnmarshalJSON(x []byte) error {
818− if string(x) == "null" {
819− t.Value = nil
820− return nil
821− }
822− decoder266 := json.NewDecoder(bytes.NewReader(x))
823− decoder266.DisallowUnknownFields()
824− var stringVal string
825− if err := decoder266.Decode(&stringVal); err == nil {
826− t.Value = stringVal
827− return nil
828− }
829− decoder267 := json.NewDecoder(bytes.NewReader(x))
830− decoder267.DisallowUnknownFields()
831− var h267 MarkedStringWithLanguage
832− if err := decoder267.Decode(&h267); err == nil {
833− t.Value = h267
834− return nil
835− }
836− return &UnmarshalError{"unmarshal failed to match one of [MarkedStringWithLanguage string]"}
837−}
838−
839−func (t Or_NotebookCellTextDocumentFilter_notebook) MarshalJSON() ([]byte, error) {
840− switch x := t.Value.(type) {
841− case NotebookDocumentFilter:
842− return json.Marshal(x)
843− case string:
844− return json.Marshal(x)
845− case nil:
846− return []byte("null"), nil
847− }
848− return nil, fmt.Errorf("type %T not one of [NotebookDocumentFilter string]", t)
849−}
850−
851−func (t *Or_NotebookCellTextDocumentFilter_notebook) UnmarshalJSON(x []byte) error {
852− if string(x) == "null" {
853− t.Value = nil
854− return nil
855− }
856− decoder208 := json.NewDecoder(bytes.NewReader(x))
857− decoder208.DisallowUnknownFields()
858− var stringVal string
859− if err := decoder208.Decode(&stringVal); err == nil {
860− t.Value = stringVal
861− return nil
862− }
863− decoder209 := json.NewDecoder(bytes.NewReader(x))
864− decoder209.DisallowUnknownFields()
865− var h209 NotebookDocumentFilter
866− if err := decoder209.Decode(&h209); err == nil {
867− t.Value = h209
868− return nil
869− }
870− return &UnmarshalError{"unmarshal failed to match one of [NotebookDocumentFilter string]"}
871−}
872−
873−func (t Or_NotebookDocumentFilter) MarshalJSON() ([]byte, error) {
874− switch x := t.Value.(type) {
875− case NotebookDocumentFilterNotebookType:
876− return json.Marshal(x)
877− case NotebookDocumentFilterPattern:
878− return json.Marshal(x)
879− case NotebookDocumentFilterScheme:
880− return json.Marshal(x)
881− case nil:
882− return []byte("null"), nil
883− }
884− return nil, fmt.Errorf("type %T not one of [NotebookDocumentFilterNotebookType NotebookDocumentFilterPattern NotebookDocumentFilterScheme]", t)
885−}
886−
887−func (t *Or_NotebookDocumentFilter) UnmarshalJSON(x []byte) error {
888− if string(x) == "null" {
889− t.Value = nil
890− return nil
891− }
892− decoder285 := json.NewDecoder(bytes.NewReader(x))
893− decoder285.DisallowUnknownFields()
894− var h285 NotebookDocumentFilterNotebookType
895− if err := decoder285.Decode(&h285); err == nil {
896− t.Value = h285
897− return nil
898− }
899− decoder286 := json.NewDecoder(bytes.NewReader(x))
900− decoder286.DisallowUnknownFields()
901− var h286 NotebookDocumentFilterPattern
902− if err := decoder286.Decode(&h286); err == nil {
903− t.Value = h286
904− return nil
905− }
906− decoder287 := json.NewDecoder(bytes.NewReader(x))
907− decoder287.DisallowUnknownFields()
908− var h287 NotebookDocumentFilterScheme
909− if err := decoder287.Decode(&h287); err == nil {
910− t.Value = h287
911− return nil
912− }
913− return &UnmarshalError{"unmarshal failed to match one of [NotebookDocumentFilterNotebookType NotebookDocumentFilterPattern NotebookDocumentFilterScheme]"}
914−}
915−
916−func (t Or_NotebookDocumentFilterWithCells_notebook) MarshalJSON() ([]byte, error) {
917− switch x := t.Value.(type) {
918− case NotebookDocumentFilter:
919− return json.Marshal(x)
920− case string:
921− return json.Marshal(x)
922− case nil:
923− return []byte("null"), nil
924− }
925− return nil, fmt.Errorf("type %T not one of [NotebookDocumentFilter string]", t)
926−}
927−
928−func (t *Or_NotebookDocumentFilterWithCells_notebook) UnmarshalJSON(x []byte) error {
929− if string(x) == "null" {
930− t.Value = nil
931− return nil
932− }
933− decoder192 := json.NewDecoder(bytes.NewReader(x))
934− decoder192.DisallowUnknownFields()
935− var stringVal string
936− if err := decoder192.Decode(&stringVal); err == nil {
937− t.Value = stringVal
938− return nil
939− }
940− decoder193 := json.NewDecoder(bytes.NewReader(x))
941− decoder193.DisallowUnknownFields()
942− var h193 NotebookDocumentFilter
943− if err := decoder193.Decode(&h193); err == nil {
944− t.Value = h193
945− return nil
946− }
947− return &UnmarshalError{"unmarshal failed to match one of [NotebookDocumentFilter string]"}
948−}
949−
950−func (t Or_NotebookDocumentFilterWithNotebook_notebook) MarshalJSON() ([]byte, error) {
951− switch x := t.Value.(type) {
952− case NotebookDocumentFilter:
953− return json.Marshal(x)
954− case string:
955− return json.Marshal(x)
956− case nil:
957− return []byte("null"), nil
958− }
959− return nil, fmt.Errorf("type %T not one of [NotebookDocumentFilter string]", t)
960−}
961−
962−func (t *Or_NotebookDocumentFilterWithNotebook_notebook) UnmarshalJSON(x []byte) error {
963− if string(x) == "null" {
964− t.Value = nil
965− return nil
966− }
967− decoder189 := json.NewDecoder(bytes.NewReader(x))
968− decoder189.DisallowUnknownFields()
969− var stringVal string
970− if err := decoder189.Decode(&stringVal); err == nil {
971− t.Value = stringVal
972− return nil
973− }
974− decoder190 := json.NewDecoder(bytes.NewReader(x))
975− decoder190.DisallowUnknownFields()
976− var h190 NotebookDocumentFilter
977− if err := decoder190.Decode(&h190); err == nil {
978− t.Value = h190
979− return nil
980− }
981− return &UnmarshalError{"unmarshal failed to match one of [NotebookDocumentFilter string]"}
982−}
983−
984−func (t Or_NotebookDocumentSyncOptions_notebookSelector_Elem) MarshalJSON() ([]byte, error) {
985− switch x := t.Value.(type) {
986− case NotebookDocumentFilterWithCells:
987− return json.Marshal(x)
988− case NotebookDocumentFilterWithNotebook:
989− return json.Marshal(x)
990− case nil:
991− return []byte("null"), nil
992− }
993− return nil, fmt.Errorf("type %T not one of [NotebookDocumentFilterWithCells NotebookDocumentFilterWithNotebook]", t)
994−}
995−
996−func (t *Or_NotebookDocumentSyncOptions_notebookSelector_Elem) UnmarshalJSON(x []byte) error {
997− if string(x) == "null" {
998− t.Value = nil
999− return nil
1000− }
1001− decoder68 := json.NewDecoder(bytes.NewReader(x))
1002− decoder68.DisallowUnknownFields()
1003− var h68 NotebookDocumentFilterWithCells
1004− if err := decoder68.Decode(&h68); err == nil {
1005− t.Value = h68
1006− return nil
1007− }
1008− decoder69 := json.NewDecoder(bytes.NewReader(x))
1009− decoder69.DisallowUnknownFields()
1010− var h69 NotebookDocumentFilterWithNotebook
1011− if err := decoder69.Decode(&h69); err == nil {
1012− t.Value = h69
1013− return nil
1014− }
1015− return &UnmarshalError{"unmarshal failed to match one of [NotebookDocumentFilterWithCells NotebookDocumentFilterWithNotebook]"}
1016−}
1017−
1018−func (t Or_ParameterInformation_documentation) MarshalJSON() ([]byte, error) {
1019− switch x := t.Value.(type) {
1020− case MarkupContent:
1021− return json.Marshal(x)
1022− case string:
1023− return json.Marshal(x)
1024− case nil:
1025− return []byte("null"), nil
1026− }
1027− return nil, fmt.Errorf("type %T not one of [MarkupContent string]", t)
1028−}
1029−
1030−func (t *Or_ParameterInformation_documentation) UnmarshalJSON(x []byte) error {
1031− if string(x) == "null" {
1032− t.Value = nil
1033− return nil
1034− }
1035− decoder205 := json.NewDecoder(bytes.NewReader(x))
1036− decoder205.DisallowUnknownFields()
1037− var stringVal string
1038− if err := decoder205.Decode(&stringVal); err == nil {
1039− t.Value = stringVal
1040− return nil
1041− }
1042− decoder206 := json.NewDecoder(bytes.NewReader(x))
1043− decoder206.DisallowUnknownFields()
1044− var h206 MarkupContent
1045− if err := decoder206.Decode(&h206); err == nil {
1046− t.Value = h206
1047− return nil
1048− }
1049− return &UnmarshalError{"unmarshal failed to match one of [MarkupContent string]"}
1050−}
1051−
1052−func (t Or_ParameterInformation_label) MarshalJSON() ([]byte, error) {
1053− switch x := t.Value.(type) {
1054− case Tuple_ParameterInformation_label_Item1:
1055− return json.Marshal(x)
1056− case string:
1057− return json.Marshal(x)
1058− case nil:
1059− return []byte("null"), nil
1060− }
1061− return nil, fmt.Errorf("type %T not one of [Tuple_ParameterInformation_label_Item1 string]", t)
1062−}
1063−
1064−func (t *Or_ParameterInformation_label) UnmarshalJSON(x []byte) error {
1065− if string(x) == "null" {
1066− t.Value = nil
1067− return nil
1068− }
1069− decoder202 := json.NewDecoder(bytes.NewReader(x))
1070− decoder202.DisallowUnknownFields()
1071− var stringVal string
1072− if err := decoder202.Decode(&stringVal); err == nil {
1073− t.Value = stringVal
1074− return nil
1075− }
1076− decoder203 := json.NewDecoder(bytes.NewReader(x))
1077− decoder203.DisallowUnknownFields()
1078− var h203 Tuple_ParameterInformation_label_Item1
1079− if err := decoder203.Decode(&h203); err == nil {
1080− t.Value = h203
1081− return nil
1082− }
1083− return &UnmarshalError{"unmarshal failed to match one of [Tuple_ParameterInformation_label_Item1 string]"}
1084−}
1085−
1086−func (t Or_PrepareRenameResult) MarshalJSON() ([]byte, error) {
1087− switch x := t.Value.(type) {
1088− case PrepareRenameDefaultBehavior:
1089− return json.Marshal(x)
1090− case PrepareRenamePlaceholder:
1091− return json.Marshal(x)
1092− case Range:
1093− return json.Marshal(x)
1094− case nil:
1095− return []byte("null"), nil
1096− }
1097− return nil, fmt.Errorf("type %T not one of [PrepareRenameDefaultBehavior PrepareRenamePlaceholder Range]", t)
1098−}
1099−
1100−func (t *Or_PrepareRenameResult) UnmarshalJSON(x []byte) error {
1101− if string(x) == "null" {
1102− t.Value = nil
1103− return nil
1104− }
1105− decoder252 := json.NewDecoder(bytes.NewReader(x))
1106− decoder252.DisallowUnknownFields()
1107− var h252 PrepareRenameDefaultBehavior
1108− if err := decoder252.Decode(&h252); err == nil {
1109− t.Value = h252
1110− return nil
1111− }
1112− decoder253 := json.NewDecoder(bytes.NewReader(x))
1113− decoder253.DisallowUnknownFields()
1114− var h253 PrepareRenamePlaceholder
1115− if err := decoder253.Decode(&h253); err == nil {
1116− t.Value = h253
1117− return nil
1118− }
1119− decoder254 := json.NewDecoder(bytes.NewReader(x))
1120− decoder254.DisallowUnknownFields()
1121− var h254 Range
1122− if err := decoder254.Decode(&h254); err == nil {
1123− t.Value = h254
1124− return nil
1125− }
1126− return &UnmarshalError{"unmarshal failed to match one of [PrepareRenameDefaultBehavior PrepareRenamePlaceholder Range]"}
1127−}
1128−
1129−func (t Or_ProgressToken) MarshalJSON() ([]byte, error) {
1130− switch x := t.Value.(type) {
1131− case int32:
1132− return json.Marshal(x)
1133− case string:
1134− return json.Marshal(x)
1135− case nil:
1136− return []byte("null"), nil
1137− }
1138− return nil, fmt.Errorf("type %T not one of [int32 string]", t)
1139−}
1140−
1141−func (t *Or_ProgressToken) UnmarshalJSON(x []byte) error {
1142− if string(x) == "null" {
1143− t.Value = nil
1144− return nil
1145− }
1146− decoder255 := json.NewDecoder(bytes.NewReader(x))
1147− decoder255.DisallowUnknownFields()
1148− var int32Val int32
1149− if err := decoder255.Decode(&int32Val); err == nil {
1150− t.Value = int32Val
1151− return nil
1152− }
1153− decoder256 := json.NewDecoder(bytes.NewReader(x))
1154− decoder256.DisallowUnknownFields()
1155− var stringVal string
1156− if err := decoder256.Decode(&stringVal); err == nil {
1157− t.Value = stringVal
1158− return nil
1159− }
1160− return &UnmarshalError{"unmarshal failed to match one of [int32 string]"}
1161−}
1162−
1163−func (t Or_RelatedFullDocumentDiagnosticReport_relatedDocuments_Value) MarshalJSON() ([]byte, error) {
1164− switch x := t.Value.(type) {
1165− case FullDocumentDiagnosticReport:
1166− return json.Marshal(x)
1167− case UnchangedDocumentDiagnosticReport:
1168− return json.Marshal(x)
1169− case nil:
1170− return []byte("null"), nil
1171− }
1172− return nil, fmt.Errorf("type %T not one of [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]", t)
1173−}
1174−
1175−func (t *Or_RelatedFullDocumentDiagnosticReport_relatedDocuments_Value) UnmarshalJSON(x []byte) error {
1176− if string(x) == "null" {
1177− t.Value = nil
1178− return nil
1179− }
1180− decoder60 := json.NewDecoder(bytes.NewReader(x))
1181− decoder60.DisallowUnknownFields()
1182− var h60 FullDocumentDiagnosticReport
1183− if err := decoder60.Decode(&h60); err == nil {
1184− t.Value = h60
1185− return nil
1186− }
1187− decoder61 := json.NewDecoder(bytes.NewReader(x))
1188− decoder61.DisallowUnknownFields()
1189− var h61 UnchangedDocumentDiagnosticReport
1190− if err := decoder61.Decode(&h61); err == nil {
1191− t.Value = h61
1192− return nil
1193− }
1194− return &UnmarshalError{"unmarshal failed to match one of [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]"}
1195−}
1196−
1197−func (t Or_RelatedUnchangedDocumentDiagnosticReport_relatedDocuments_Value) MarshalJSON() ([]byte, error) {
1198− switch x := t.Value.(type) {
1199− case FullDocumentDiagnosticReport:
1200− return json.Marshal(x)
1201− case UnchangedDocumentDiagnosticReport:
1202− return json.Marshal(x)
1203− case nil:
1204− return []byte("null"), nil
1205− }
1206− return nil, fmt.Errorf("type %T not one of [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]", t)
1207−}
1208−
1209−func (t *Or_RelatedUnchangedDocumentDiagnosticReport_relatedDocuments_Value) UnmarshalJSON(x []byte) error {
1210− if string(x) == "null" {
1211− t.Value = nil
1212− return nil
1213− }
1214− decoder64 := json.NewDecoder(bytes.NewReader(x))
1215− decoder64.DisallowUnknownFields()
1216− var h64 FullDocumentDiagnosticReport
1217− if err := decoder64.Decode(&h64); err == nil {
1218− t.Value = h64
1219− return nil
1220− }
1221− decoder65 := json.NewDecoder(bytes.NewReader(x))
1222− decoder65.DisallowUnknownFields()
1223− var h65 UnchangedDocumentDiagnosticReport
1224− if err := decoder65.Decode(&h65); err == nil {
1225− t.Value = h65
1226− return nil
1227− }
1228− return &UnmarshalError{"unmarshal failed to match one of [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]"}
1229−}
1230−
1231−func (t Or_RelativePattern_baseUri) MarshalJSON() ([]byte, error) {
1232− switch x := t.Value.(type) {
1233− case URI:
1234− return json.Marshal(x)
1235− case WorkspaceFolder:
1236− return json.Marshal(x)
1237− case nil:
1238− return []byte("null"), nil
1239− }
1240− return nil, fmt.Errorf("type %T not one of [URI WorkspaceFolder]", t)
1241−}
1242−
1243−func (t *Or_RelativePattern_baseUri) UnmarshalJSON(x []byte) error {
1244− if string(x) == "null" {
1245− t.Value = nil
1246− return nil
1247− }
1248− decoder214 := json.NewDecoder(bytes.NewReader(x))
1249− decoder214.DisallowUnknownFields()
1250− var h214 URI
1251− if err := decoder214.Decode(&h214); err == nil {
1252− t.Value = h214
1253− return nil
1254− }
1255− decoder215 := json.NewDecoder(bytes.NewReader(x))
1256− decoder215.DisallowUnknownFields()
1257− var h215 WorkspaceFolder
1258− if err := decoder215.Decode(&h215); err == nil {
1259− t.Value = h215
1260− return nil
1261− }
1262− return &UnmarshalError{"unmarshal failed to match one of [URI WorkspaceFolder]"}
1263−}
1264−
1265−func (t Or_Result_textDocument_codeAction_Item0_Elem) MarshalJSON() ([]byte, error) {
1266− switch x := t.Value.(type) {
1267− case CodeAction:
1268− return json.Marshal(x)
1269− case Command:
1270− return json.Marshal(x)
1271− case nil:
1272− return []byte("null"), nil
1273− }
1274− return nil, fmt.Errorf("type %T not one of [CodeAction Command]", t)
1275−}
1276−
1277−func (t *Or_Result_textDocument_codeAction_Item0_Elem) UnmarshalJSON(x []byte) error {
1278− if string(x) == "null" {
1279− t.Value = nil
1280− return nil
1281− }
1282− decoder322 := json.NewDecoder(bytes.NewReader(x))
1283− decoder322.DisallowUnknownFields()
1284− var h322 CodeAction
1285− if err := decoder322.Decode(&h322); err == nil {
1286− t.Value = h322
1287− return nil
1288− }
1289− decoder323 := json.NewDecoder(bytes.NewReader(x))
1290− decoder323.DisallowUnknownFields()
1291− var h323 Command
1292− if err := decoder323.Decode(&h323); err == nil {
1293− t.Value = h323
1294− return nil
1295− }
1296− return &UnmarshalError{"unmarshal failed to match one of [CodeAction Command]"}
1297−}
1298−
1299−func (t Or_Result_textDocument_completion) MarshalJSON() ([]byte, error) {
1300− switch x := t.Value.(type) {
1301− case CompletionList:
1302− return json.Marshal(x)
1303− case []CompletionItem:
1304− return json.Marshal(x)
1305− case nil:
1306− return []byte("null"), nil
1307− }
1308− return nil, fmt.Errorf("type %T not one of [CompletionList []CompletionItem]", t)
1309−}
1310−
1311−func (t *Or_Result_textDocument_completion) UnmarshalJSON(x []byte) error {
1312− if string(x) == "null" {
1313− t.Value = nil
1314− return nil
1315− }
1316− decoder310 := json.NewDecoder(bytes.NewReader(x))
1317− decoder310.DisallowUnknownFields()
1318− var h310 CompletionList
1319− if err := decoder310.Decode(&h310); err == nil {
1320− t.Value = h310
1321− return nil
1322− }
1323− decoder311 := json.NewDecoder(bytes.NewReader(x))
1324− decoder311.DisallowUnknownFields()
1325− var h311 []CompletionItem
1326− if err := decoder311.Decode(&h311); err == nil {
1327− t.Value = h311
1328− return nil
1329− }
1330− return &UnmarshalError{"unmarshal failed to match one of [CompletionList []CompletionItem]"}
1331−}
1332−
1333−func (t Or_Result_textDocument_declaration) MarshalJSON() ([]byte, error) {
1334− switch x := t.Value.(type) {
1335− case Declaration:
1336− return json.Marshal(x)
1337− case []DeclarationLink:
1338− return json.Marshal(x)
1339− case nil:
1340− return []byte("null"), nil
1341− }
1342− return nil, fmt.Errorf("type %T not one of [Declaration []DeclarationLink]", t)
1343−}
1344−
1345−func (t *Or_Result_textDocument_declaration) UnmarshalJSON(x []byte) error {
1346− if string(x) == "null" {
1347− t.Value = nil
1348− return nil
1349− }
1350− decoder298 := json.NewDecoder(bytes.NewReader(x))
1351− decoder298.DisallowUnknownFields()
1352− var h298 Declaration
1353− if err := decoder298.Decode(&h298); err == nil {
1354− t.Value = h298
1355− return nil
1356− }
1357− decoder299 := json.NewDecoder(bytes.NewReader(x))
1358− decoder299.DisallowUnknownFields()
1359− var h299 []DeclarationLink
1360− if err := decoder299.Decode(&h299); err == nil {
1361− t.Value = h299
1362− return nil
1363− }
1364− return &UnmarshalError{"unmarshal failed to match one of [Declaration []DeclarationLink]"}
1365−}
1366−
1367−func (t Or_Result_textDocument_definition) MarshalJSON() ([]byte, error) {
1368− switch x := t.Value.(type) {
1369− case Definition:
1370− return json.Marshal(x)
1371− case []DefinitionLink:
1372− return json.Marshal(x)
1373− case nil:
1374− return []byte("null"), nil
1375− }
1376− return nil, fmt.Errorf("type %T not one of [Definition []DefinitionLink]", t)
1377−}
1378−
1379−func (t *Or_Result_textDocument_definition) UnmarshalJSON(x []byte) error {
1380− if string(x) == "null" {
1381− t.Value = nil
1382− return nil
1383− }
1384− decoder314 := json.NewDecoder(bytes.NewReader(x))
1385− decoder314.DisallowUnknownFields()
1386− var h314 Definition
1387− if err := decoder314.Decode(&h314); err == nil {
1388− t.Value = h314
1389− return nil
1390− }
1391− decoder315 := json.NewDecoder(bytes.NewReader(x))
1392− decoder315.DisallowUnknownFields()
1393− var h315 []DefinitionLink
1394− if err := decoder315.Decode(&h315); err == nil {
1395− t.Value = h315
1396− return nil
1397− }
1398− return &UnmarshalError{"unmarshal failed to match one of [Definition []DefinitionLink]"}
1399−}
1400−
1401−func (t Or_Result_textDocument_documentSymbol) MarshalJSON() ([]byte, error) {
1402− switch x := t.Value.(type) {
1403− case []DocumentSymbol:
1404− return json.Marshal(x)
1405− case []SymbolInformation:
1406− return json.Marshal(x)
1407− case nil:
1408− return []byte("null"), nil
1409− }
1410− return nil, fmt.Errorf("type %T not one of [[]DocumentSymbol []SymbolInformation]", t)
1411−}
1412−
1413−func (t *Or_Result_textDocument_documentSymbol) UnmarshalJSON(x []byte) error {
1414− if string(x) == "null" {
1415− t.Value = nil
1416− return nil
1417− }
1418− decoder318 := json.NewDecoder(bytes.NewReader(x))
1419− decoder318.DisallowUnknownFields()
1420− var h318 []DocumentSymbol
1421− if err := decoder318.Decode(&h318); err == nil {
1422− t.Value = h318
1423− return nil
1424− }
1425− decoder319 := json.NewDecoder(bytes.NewReader(x))
1426− decoder319.DisallowUnknownFields()
1427− var h319 []SymbolInformation
1428− if err := decoder319.Decode(&h319); err == nil {
1429− t.Value = h319
1430− return nil
1431− }
1432− return &UnmarshalError{"unmarshal failed to match one of [[]DocumentSymbol []SymbolInformation]"}
1433−}
1434−
1435−func (t Or_Result_textDocument_implementation) MarshalJSON() ([]byte, error) {
1436− switch x := t.Value.(type) {
1437− case Definition:
1438− return json.Marshal(x)
1439− case []DefinitionLink:
1440− return json.Marshal(x)
1441− case nil:
1442− return []byte("null"), nil
1443− }
1444− return nil, fmt.Errorf("type %T not one of [Definition []DefinitionLink]", t)
1445−}
1446−
1447−func (t *Or_Result_textDocument_implementation) UnmarshalJSON(x []byte) error {
1448− if string(x) == "null" {
1449− t.Value = nil
1450− return nil
1451− }
1452− decoder290 := json.NewDecoder(bytes.NewReader(x))
1453− decoder290.DisallowUnknownFields()
1454− var h290 Definition
1455− if err := decoder290.Decode(&h290); err == nil {
1456− t.Value = h290
1457− return nil
1458− }
1459− decoder291 := json.NewDecoder(bytes.NewReader(x))
1460− decoder291.DisallowUnknownFields()
1461− var h291 []DefinitionLink
1462− if err := decoder291.Decode(&h291); err == nil {
1463− t.Value = h291
1464− return nil
1465− }
1466− return &UnmarshalError{"unmarshal failed to match one of [Definition []DefinitionLink]"}
1467−}
1468−
1469−func (t Or_Result_textDocument_inlineCompletion) MarshalJSON() ([]byte, error) {
1470− switch x := t.Value.(type) {
1471− case InlineCompletionList:
1472− return json.Marshal(x)
1473− case []InlineCompletionItem:
1474− return json.Marshal(x)
1475− case nil:
1476− return []byte("null"), nil
1477− }
1478− return nil, fmt.Errorf("type %T not one of [InlineCompletionList []InlineCompletionItem]", t)
1479−}
1480−
1481−func (t *Or_Result_textDocument_inlineCompletion) UnmarshalJSON(x []byte) error {
1482− if string(x) == "null" {
1483− t.Value = nil
1484− return nil
1485− }
1486− decoder306 := json.NewDecoder(bytes.NewReader(x))
1487− decoder306.DisallowUnknownFields()
1488− var h306 InlineCompletionList
1489− if err := decoder306.Decode(&h306); err == nil {
1490− t.Value = h306
1491− return nil
1492− }
1493− decoder307 := json.NewDecoder(bytes.NewReader(x))
1494− decoder307.DisallowUnknownFields()
1495− var h307 []InlineCompletionItem
1496− if err := decoder307.Decode(&h307); err == nil {
1497− t.Value = h307
1498− return nil
1499− }
1500− return &UnmarshalError{"unmarshal failed to match one of [InlineCompletionList []InlineCompletionItem]"}
1501−}
1502−
1503−func (t Or_Result_textDocument_semanticTokens_full_delta) MarshalJSON() ([]byte, error) {
1504− switch x := t.Value.(type) {
1505− case SemanticTokens:
1506− return json.Marshal(x)
1507− case SemanticTokensDelta:
1508− return json.Marshal(x)
1509− case nil:
1510− return []byte("null"), nil
1511− }
1512− return nil, fmt.Errorf("type %T not one of [SemanticTokens SemanticTokensDelta]", t)
1513−}
1514−
1515−func (t *Or_Result_textDocument_semanticTokens_full_delta) UnmarshalJSON(x []byte) error {
1516− if string(x) == "null" {
1517− t.Value = nil
1518− return nil
1519− }
1520− decoder302 := json.NewDecoder(bytes.NewReader(x))
1521− decoder302.DisallowUnknownFields()
1522− var h302 SemanticTokens
1523− if err := decoder302.Decode(&h302); err == nil {
1524− t.Value = h302
1525− return nil
1526− }
1527− decoder303 := json.NewDecoder(bytes.NewReader(x))
1528− decoder303.DisallowUnknownFields()
1529− var h303 SemanticTokensDelta
1530− if err := decoder303.Decode(&h303); err == nil {
1531− t.Value = h303
1532− return nil
1533− }
1534− return &UnmarshalError{"unmarshal failed to match one of [SemanticTokens SemanticTokensDelta]"}
1535−}
1536−
1537−func (t Or_Result_textDocument_typeDefinition) MarshalJSON() ([]byte, error) {
1538− switch x := t.Value.(type) {
1539− case Definition:
1540− return json.Marshal(x)
1541− case []DefinitionLink:
1542− return json.Marshal(x)
1543− case nil:
1544− return []byte("null"), nil
1545− }
1546− return nil, fmt.Errorf("type %T not one of [Definition []DefinitionLink]", t)
1547−}
1548−
1549−func (t *Or_Result_textDocument_typeDefinition) UnmarshalJSON(x []byte) error {
1550− if string(x) == "null" {
1551− t.Value = nil
1552− return nil
1553− }
1554− decoder294 := json.NewDecoder(bytes.NewReader(x))
1555− decoder294.DisallowUnknownFields()
1556− var h294 Definition
1557− if err := decoder294.Decode(&h294); err == nil {
1558− t.Value = h294
1559− return nil
1560− }
1561− decoder295 := json.NewDecoder(bytes.NewReader(x))
1562− decoder295.DisallowUnknownFields()
1563− var h295 []DefinitionLink
1564− if err := decoder295.Decode(&h295); err == nil {
1565− t.Value = h295
1566− return nil
1567− }
1568− return &UnmarshalError{"unmarshal failed to match one of [Definition []DefinitionLink]"}
1569−}
1570−
1571−func (t Or_Result_workspace_symbol) MarshalJSON() ([]byte, error) {
1572− switch x := t.Value.(type) {
1573− case []SymbolInformation:
1574− return json.Marshal(x)
1575− case []WorkspaceSymbol:
1576− return json.Marshal(x)
1577− case nil:
1578− return []byte("null"), nil
1579− }
1580− return nil, fmt.Errorf("type %T not one of [[]SymbolInformation []WorkspaceSymbol]", t)
1581−}
1582−
1583−func (t *Or_Result_workspace_symbol) UnmarshalJSON(x []byte) error {
1584− if string(x) == "null" {
1585− t.Value = nil
1586− return nil
1587− }
1588− decoder326 := json.NewDecoder(bytes.NewReader(x))
1589− decoder326.DisallowUnknownFields()
1590− var h326 []SymbolInformation
1591− if err := decoder326.Decode(&h326); err == nil {
1592− t.Value = h326
1593− return nil
1594− }
1595− decoder327 := json.NewDecoder(bytes.NewReader(x))
1596− decoder327.DisallowUnknownFields()
1597− var h327 []WorkspaceSymbol
1598− if err := decoder327.Decode(&h327); err == nil {
1599− t.Value = h327
1600− return nil
1601− }
1602− return &UnmarshalError{"unmarshal failed to match one of [[]SymbolInformation []WorkspaceSymbol]"}
1603−}
1604−
1605−func (t Or_SemanticTokensOptions_full) MarshalJSON() ([]byte, error) {
1606− switch x := t.Value.(type) {
1607− case SemanticTokensFullDelta:
1608− return json.Marshal(x)
1609− case bool:
1610− return json.Marshal(x)
1611− case nil:
1612− return []byte("null"), nil
1613− }
1614− return nil, fmt.Errorf("type %T not one of [SemanticTokensFullDelta bool]", t)
1615−}
1616−
1617−func (t *Or_SemanticTokensOptions_full) UnmarshalJSON(x []byte) error {
1618− if string(x) == "null" {
1619− t.Value = nil
1620− return nil
1621− }
1622− decoder47 := json.NewDecoder(bytes.NewReader(x))
1623− decoder47.DisallowUnknownFields()
1624− var boolVal bool
1625− if err := decoder47.Decode(&boolVal); err == nil {
1626− t.Value = boolVal
1627− return nil
1628− }
1629− decoder48 := json.NewDecoder(bytes.NewReader(x))
1630− decoder48.DisallowUnknownFields()
1631− var h48 SemanticTokensFullDelta
1632− if err := decoder48.Decode(&h48); err == nil {
1633− t.Value = h48
1634− return nil
1635− }
1636− return &UnmarshalError{"unmarshal failed to match one of [SemanticTokensFullDelta bool]"}
1637−}
1638−
1639−func (t Or_SemanticTokensOptions_range) MarshalJSON() ([]byte, error) {
1640− switch x := t.Value.(type) {
1641− case Lit_SemanticTokensOptions_range_Item1:
1642− return json.Marshal(x)
1643− case bool:
1644− return json.Marshal(x)
1645− case nil:
1646− return []byte("null"), nil
1647− }
1648− return nil, fmt.Errorf("type %T not one of [Lit_SemanticTokensOptions_range_Item1 bool]", t)
1649−}
1650−
1651−func (t *Or_SemanticTokensOptions_range) UnmarshalJSON(x []byte) error {
1652− if string(x) == "null" {
1653− t.Value = nil
1654− return nil
1655− }
1656− decoder44 := json.NewDecoder(bytes.NewReader(x))
1657− decoder44.DisallowUnknownFields()
1658− var boolVal bool
1659− if err := decoder44.Decode(&boolVal); err == nil {
1660− t.Value = boolVal
1661− return nil
1662− }
1663− decoder45 := json.NewDecoder(bytes.NewReader(x))
1664− decoder45.DisallowUnknownFields()
1665− var h45 Lit_SemanticTokensOptions_range_Item1
1666− if err := decoder45.Decode(&h45); err == nil {
1667− t.Value = h45
1668− return nil
1669− }
1670− return &UnmarshalError{"unmarshal failed to match one of [Lit_SemanticTokensOptions_range_Item1 bool]"}
1671−}
1672−
1673−func (t Or_ServerCapabilities_callHierarchyProvider) MarshalJSON() ([]byte, error) {
1674− switch x := t.Value.(type) {
1675− case CallHierarchyOptions:
1676− return json.Marshal(x)
1677− case CallHierarchyRegistrationOptions:
1678− return json.Marshal(x)
1679− case bool:
1680− return json.Marshal(x)
1681− case nil:
1682− return []byte("null"), nil
1683− }
1684− return nil, fmt.Errorf("type %T not one of [CallHierarchyOptions CallHierarchyRegistrationOptions bool]", t)
1685−}
1686−
1687−func (t *Or_ServerCapabilities_callHierarchyProvider) UnmarshalJSON(x []byte) error {
1688− if string(x) == "null" {
1689− t.Value = nil
1690− return nil
1691− }
1692− decoder140 := json.NewDecoder(bytes.NewReader(x))
1693− decoder140.DisallowUnknownFields()
1694− var boolVal bool
1695− if err := decoder140.Decode(&boolVal); err == nil {
1696− t.Value = boolVal
1697− return nil
1698− }
1699− decoder141 := json.NewDecoder(bytes.NewReader(x))
1700− decoder141.DisallowUnknownFields()
1701− var h141 CallHierarchyOptions
1702− if err := decoder141.Decode(&h141); err == nil {
1703− t.Value = h141
1704− return nil
1705− }
1706− decoder142 := json.NewDecoder(bytes.NewReader(x))
1707− decoder142.DisallowUnknownFields()
1708− var h142 CallHierarchyRegistrationOptions
1709− if err := decoder142.Decode(&h142); err == nil {
1710− t.Value = h142
1711− return nil
1712− }
1713− return &UnmarshalError{"unmarshal failed to match one of [CallHierarchyOptions CallHierarchyRegistrationOptions bool]"}
1714−}
1715−
1716−func (t Or_ServerCapabilities_codeActionProvider) MarshalJSON() ([]byte, error) {
1717− switch x := t.Value.(type) {
1718− case CodeActionOptions:
1719− return json.Marshal(x)
1720− case bool:
1721− return json.Marshal(x)
1722− case nil:
1723− return []byte("null"), nil
1724− }
1725− return nil, fmt.Errorf("type %T not one of [CodeActionOptions bool]", t)
1726−}
1727−
1728−func (t *Or_ServerCapabilities_codeActionProvider) UnmarshalJSON(x []byte) error {
1729− if string(x) == "null" {
1730− t.Value = nil
1731− return nil
1732− }
1733− decoder109 := json.NewDecoder(bytes.NewReader(x))
1734− decoder109.DisallowUnknownFields()
1735− var boolVal bool
1736− if err := decoder109.Decode(&boolVal); err == nil {
1737− t.Value = boolVal
1738− return nil
1739− }
1740− decoder110 := json.NewDecoder(bytes.NewReader(x))
1741− decoder110.DisallowUnknownFields()
1742− var h110 CodeActionOptions
1743− if err := decoder110.Decode(&h110); err == nil {
1744− t.Value = h110
1745− return nil
1746− }
1747− return &UnmarshalError{"unmarshal failed to match one of [CodeActionOptions bool]"}
1748−}
1749−
1750−func (t Or_ServerCapabilities_colorProvider) MarshalJSON() ([]byte, error) {
1751− switch x := t.Value.(type) {
1752− case DocumentColorOptions:
1753− return json.Marshal(x)
1754− case DocumentColorRegistrationOptions:
1755− return json.Marshal(x)
1756− case bool:
1757− return json.Marshal(x)
1758− case nil:
1759− return []byte("null"), nil
1760− }
1761− return nil, fmt.Errorf("type %T not one of [DocumentColorOptions DocumentColorRegistrationOptions bool]", t)
1762−}
1763−
1764−func (t *Or_ServerCapabilities_colorProvider) UnmarshalJSON(x []byte) error {
1765− if string(x) == "null" {
1766− t.Value = nil
1767− return nil
1768− }
1769− decoder113 := json.NewDecoder(bytes.NewReader(x))
1770− decoder113.DisallowUnknownFields()
1771− var boolVal bool
1772− if err := decoder113.Decode(&boolVal); err == nil {
1773− t.Value = boolVal
1774− return nil
1775− }
1776− decoder114 := json.NewDecoder(bytes.NewReader(x))
1777− decoder114.DisallowUnknownFields()
1778− var h114 DocumentColorOptions
1779− if err := decoder114.Decode(&h114); err == nil {
1780− t.Value = h114
1781− return nil
1782− }
1783− decoder115 := json.NewDecoder(bytes.NewReader(x))
1784− decoder115.DisallowUnknownFields()
1785− var h115 DocumentColorRegistrationOptions
1786− if err := decoder115.Decode(&h115); err == nil {
1787− t.Value = h115
1788− return nil
1789− }
1790− return &UnmarshalError{"unmarshal failed to match one of [DocumentColorOptions DocumentColorRegistrationOptions bool]"}
1791−}
1792−
1793−func (t Or_ServerCapabilities_declarationProvider) MarshalJSON() ([]byte, error) {
1794− switch x := t.Value.(type) {
1795− case DeclarationOptions:
1796− return json.Marshal(x)
1797− case DeclarationRegistrationOptions:
1798− return json.Marshal(x)
1799− case bool:
1800− return json.Marshal(x)
1801− case nil:
1802− return []byte("null"), nil
1803− }
1804− return nil, fmt.Errorf("type %T not one of [DeclarationOptions DeclarationRegistrationOptions bool]", t)
1805−}
1806−
1807−func (t *Or_ServerCapabilities_declarationProvider) UnmarshalJSON(x []byte) error {
1808− if string(x) == "null" {
1809− t.Value = nil
1810− return nil
1811− }
1812− decoder83 := json.NewDecoder(bytes.NewReader(x))
1813− decoder83.DisallowUnknownFields()
1814− var boolVal bool
1815− if err := decoder83.Decode(&boolVal); err == nil {
1816− t.Value = boolVal
1817− return nil
1818− }
1819− decoder84 := json.NewDecoder(bytes.NewReader(x))
1820− decoder84.DisallowUnknownFields()
1821− var h84 DeclarationOptions
1822− if err := decoder84.Decode(&h84); err == nil {
1823− t.Value = h84
1824− return nil
1825− }
1826− decoder85 := json.NewDecoder(bytes.NewReader(x))
1827− decoder85.DisallowUnknownFields()
1828− var h85 DeclarationRegistrationOptions
1829− if err := decoder85.Decode(&h85); err == nil {
1830− t.Value = h85
1831− return nil
1832− }
1833− return &UnmarshalError{"unmarshal failed to match one of [DeclarationOptions DeclarationRegistrationOptions bool]"}
1834−}
1835−
1836−func (t Or_ServerCapabilities_definitionProvider) MarshalJSON() ([]byte, error) {
1837− switch x := t.Value.(type) {
1838− case DefinitionOptions:
1839− return json.Marshal(x)
1840− case bool:
1841− return json.Marshal(x)
1842− case nil:
1843− return []byte("null"), nil
1844− }
1845− return nil, fmt.Errorf("type %T not one of [DefinitionOptions bool]", t)
1846−}
1847−
1848−func (t *Or_ServerCapabilities_definitionProvider) UnmarshalJSON(x []byte) error {
1849− if string(x) == "null" {
1850− t.Value = nil
1851− return nil
1852− }
1853− decoder87 := json.NewDecoder(bytes.NewReader(x))
1854− decoder87.DisallowUnknownFields()
1855− var boolVal bool
1856− if err := decoder87.Decode(&boolVal); err == nil {
1857− t.Value = boolVal
1858− return nil
1859− }
1860− decoder88 := json.NewDecoder(bytes.NewReader(x))
1861− decoder88.DisallowUnknownFields()
1862− var h88 DefinitionOptions
1863− if err := decoder88.Decode(&h88); err == nil {
1864− t.Value = h88
1865− return nil
1866− }
1867− return &UnmarshalError{"unmarshal failed to match one of [DefinitionOptions bool]"}
1868−}
1869−
1870−func (t Or_ServerCapabilities_diagnosticProvider) MarshalJSON() ([]byte, error) {
1871− switch x := t.Value.(type) {
1872− case DiagnosticOptions:
1873− return json.Marshal(x)
1874− case DiagnosticRegistrationOptions:
1875− return json.Marshal(x)
1876− case nil:
1877− return []byte("null"), nil
1878− }
1879− return nil, fmt.Errorf("type %T not one of [DiagnosticOptions DiagnosticRegistrationOptions]", t)
1880−}
1881−
1882−func (t *Or_ServerCapabilities_diagnosticProvider) UnmarshalJSON(x []byte) error {
1883− if string(x) == "null" {
1884− t.Value = nil
1885− return nil
1886− }
1887− decoder174 := json.NewDecoder(bytes.NewReader(x))
1888− decoder174.DisallowUnknownFields()
1889− var h174 DiagnosticOptions
1890− if err := decoder174.Decode(&h174); err == nil {
1891− t.Value = h174
1892− return nil
1893− }
1894− decoder175 := json.NewDecoder(bytes.NewReader(x))
1895− decoder175.DisallowUnknownFields()
1896− var h175 DiagnosticRegistrationOptions
1897− if err := decoder175.Decode(&h175); err == nil {
1898− t.Value = h175
1899− return nil
1900− }
1901− return &UnmarshalError{"unmarshal failed to match one of [DiagnosticOptions DiagnosticRegistrationOptions]"}
1902−}
1903−
1904−func (t Or_ServerCapabilities_documentFormattingProvider) MarshalJSON() ([]byte, error) {
1905− switch x := t.Value.(type) {
1906− case DocumentFormattingOptions:
1907− return json.Marshal(x)
1908− case bool:
1909− return json.Marshal(x)
1910− case nil:
1911− return []byte("null"), nil
1912− }
1913− return nil, fmt.Errorf("type %T not one of [DocumentFormattingOptions bool]", t)
1914−}
1915−
1916−func (t *Or_ServerCapabilities_documentFormattingProvider) UnmarshalJSON(x []byte) error {
1917− if string(x) == "null" {
1918− t.Value = nil
1919− return nil
1920− }
1921− decoder120 := json.NewDecoder(bytes.NewReader(x))
1922− decoder120.DisallowUnknownFields()
1923− var boolVal bool
1924− if err := decoder120.Decode(&boolVal); err == nil {
1925− t.Value = boolVal
1926− return nil
1927− }
1928− decoder121 := json.NewDecoder(bytes.NewReader(x))
1929− decoder121.DisallowUnknownFields()
1930− var h121 DocumentFormattingOptions
1931− if err := decoder121.Decode(&h121); err == nil {
1932− t.Value = h121
1933− return nil
1934− }
1935− return &UnmarshalError{"unmarshal failed to match one of [DocumentFormattingOptions bool]"}
1936−}
1937−
1938−func (t Or_ServerCapabilities_documentHighlightProvider) MarshalJSON() ([]byte, error) {
1939− switch x := t.Value.(type) {
1940− case DocumentHighlightOptions:
1941− return json.Marshal(x)
1942− case bool:
1943− return json.Marshal(x)
1944− case nil:
1945− return []byte("null"), nil
1946− }
1947− return nil, fmt.Errorf("type %T not one of [DocumentHighlightOptions bool]", t)
1948−}
1949−
1950−func (t *Or_ServerCapabilities_documentHighlightProvider) UnmarshalJSON(x []byte) error {
1951− if string(x) == "null" {
1952− t.Value = nil
1953− return nil
1954− }
1955− decoder103 := json.NewDecoder(bytes.NewReader(x))
1956− decoder103.DisallowUnknownFields()
1957− var boolVal bool
1958− if err := decoder103.Decode(&boolVal); err == nil {
1959− t.Value = boolVal
1960− return nil
1961− }
1962− decoder104 := json.NewDecoder(bytes.NewReader(x))
1963− decoder104.DisallowUnknownFields()
1964− var h104 DocumentHighlightOptions
1965− if err := decoder104.Decode(&h104); err == nil {
1966− t.Value = h104
1967− return nil
1968− }
1969− return &UnmarshalError{"unmarshal failed to match one of [DocumentHighlightOptions bool]"}
1970−}
1971−
1972−func (t Or_ServerCapabilities_documentRangeFormattingProvider) MarshalJSON() ([]byte, error) {
1973− switch x := t.Value.(type) {
1974− case DocumentRangeFormattingOptions:
1975− return json.Marshal(x)
1976− case bool:
1977− return json.Marshal(x)
1978− case nil:
1979− return []byte("null"), nil
1980− }
1981− return nil, fmt.Errorf("type %T not one of [DocumentRangeFormattingOptions bool]", t)
1982−}
1983−
1984−func (t *Or_ServerCapabilities_documentRangeFormattingProvider) UnmarshalJSON(x []byte) error {
1985− if string(x) == "null" {
1986− t.Value = nil
1987− return nil
1988− }
1989− decoder123 := json.NewDecoder(bytes.NewReader(x))
1990− decoder123.DisallowUnknownFields()
1991− var boolVal bool
1992− if err := decoder123.Decode(&boolVal); err == nil {
1993− t.Value = boolVal
1994− return nil
1995− }
1996− decoder124 := json.NewDecoder(bytes.NewReader(x))
1997− decoder124.DisallowUnknownFields()
1998− var h124 DocumentRangeFormattingOptions
1999− if err := decoder124.Decode(&h124); err == nil {
2000− t.Value = h124
2001− return nil
2002− }
2003− return &UnmarshalError{"unmarshal failed to match one of [DocumentRangeFormattingOptions bool]"}
2004−}
2005−
2006−func (t Or_ServerCapabilities_documentSymbolProvider) MarshalJSON() ([]byte, error) {
2007− switch x := t.Value.(type) {
2008− case DocumentSymbolOptions:
2009− return json.Marshal(x)
2010− case bool:
2011− return json.Marshal(x)
2012− case nil:
2013− return []byte("null"), nil
2014− }
2015− return nil, fmt.Errorf("type %T not one of [DocumentSymbolOptions bool]", t)
2016−}
2017−
2018−func (t *Or_ServerCapabilities_documentSymbolProvider) UnmarshalJSON(x []byte) error {
2019− if string(x) == "null" {
2020− t.Value = nil
2021− return nil
2022− }
2023− decoder106 := json.NewDecoder(bytes.NewReader(x))
2024− decoder106.DisallowUnknownFields()
2025− var boolVal bool
2026− if err := decoder106.Decode(&boolVal); err == nil {
2027− t.Value = boolVal
2028− return nil
2029− }
2030− decoder107 := json.NewDecoder(bytes.NewReader(x))
2031− decoder107.DisallowUnknownFields()
2032− var h107 DocumentSymbolOptions
2033− if err := decoder107.Decode(&h107); err == nil {
2034− t.Value = h107
2035− return nil
2036− }
2037− return &UnmarshalError{"unmarshal failed to match one of [DocumentSymbolOptions bool]"}
2038−}
2039−
2040−func (t Or_ServerCapabilities_foldingRangeProvider) MarshalJSON() ([]byte, error) {
2041− switch x := t.Value.(type) {
2042− case FoldingRangeOptions:
2043− return json.Marshal(x)
2044− case FoldingRangeRegistrationOptions:
2045− return json.Marshal(x)
2046− case bool:
2047− return json.Marshal(x)
2048− case nil:
2049− return []byte("null"), nil
2050− }
2051− return nil, fmt.Errorf("type %T not one of [FoldingRangeOptions FoldingRangeRegistrationOptions bool]", t)
2052−}
2053−
2054−func (t *Or_ServerCapabilities_foldingRangeProvider) UnmarshalJSON(x []byte) error {
2055− if string(x) == "null" {
2056− t.Value = nil
2057− return nil
2058− }
2059− decoder130 := json.NewDecoder(bytes.NewReader(x))
2060− decoder130.DisallowUnknownFields()
2061− var boolVal bool
2062− if err := decoder130.Decode(&boolVal); err == nil {
2063− t.Value = boolVal
2064− return nil
2065− }
2066− decoder131 := json.NewDecoder(bytes.NewReader(x))
2067− decoder131.DisallowUnknownFields()
2068− var h131 FoldingRangeOptions
2069− if err := decoder131.Decode(&h131); err == nil {
2070− t.Value = h131
2071− return nil
2072− }
2073− decoder132 := json.NewDecoder(bytes.NewReader(x))
2074− decoder132.DisallowUnknownFields()
2075− var h132 FoldingRangeRegistrationOptions
2076− if err := decoder132.Decode(&h132); err == nil {
2077− t.Value = h132
2078− return nil
2079− }
2080− return &UnmarshalError{"unmarshal failed to match one of [FoldingRangeOptions FoldingRangeRegistrationOptions bool]"}
2081−}
2082−
2083−func (t Or_ServerCapabilities_hoverProvider) MarshalJSON() ([]byte, error) {
2084− switch x := t.Value.(type) {
2085− case HoverOptions:
2086− return json.Marshal(x)
2087− case bool:
2088− return json.Marshal(x)
2089− case nil:
2090− return []byte("null"), nil
2091− }
2092− return nil, fmt.Errorf("type %T not one of [HoverOptions bool]", t)
2093−}
2094−
2095−func (t *Or_ServerCapabilities_hoverProvider) UnmarshalJSON(x []byte) error {
2096− if string(x) == "null" {
2097− t.Value = nil
2098− return nil
2099− }
2100− decoder79 := json.NewDecoder(bytes.NewReader(x))
2101− decoder79.DisallowUnknownFields()
2102− var boolVal bool
2103− if err := decoder79.Decode(&boolVal); err == nil {
2104− t.Value = boolVal
2105− return nil
2106− }
2107− decoder80 := json.NewDecoder(bytes.NewReader(x))
2108− decoder80.DisallowUnknownFields()
2109− var h80 HoverOptions
2110− if err := decoder80.Decode(&h80); err == nil {
2111− t.Value = h80
2112− return nil
2113− }
2114− return &UnmarshalError{"unmarshal failed to match one of [HoverOptions bool]"}
2115−}
2116−
2117−func (t Or_ServerCapabilities_implementationProvider) MarshalJSON() ([]byte, error) {
2118− switch x := t.Value.(type) {
2119− case ImplementationOptions:
2120− return json.Marshal(x)
2121− case ImplementationRegistrationOptions:
2122− return json.Marshal(x)
2123− case bool:
2124− return json.Marshal(x)
2125− case nil:
2126− return []byte("null"), nil
2127− }
2128− return nil, fmt.Errorf("type %T not one of [ImplementationOptions ImplementationRegistrationOptions bool]", t)
2129−}
2130−
2131−func (t *Or_ServerCapabilities_implementationProvider) UnmarshalJSON(x []byte) error {
2132− if string(x) == "null" {
2133− t.Value = nil
2134− return nil
2135− }
2136− decoder96 := json.NewDecoder(bytes.NewReader(x))
2137− decoder96.DisallowUnknownFields()
2138− var boolVal bool
2139− if err := decoder96.Decode(&boolVal); err == nil {
2140− t.Value = boolVal
2141− return nil
2142− }
2143− decoder97 := json.NewDecoder(bytes.NewReader(x))
2144− decoder97.DisallowUnknownFields()
2145− var h97 ImplementationOptions
2146− if err := decoder97.Decode(&h97); err == nil {
2147− t.Value = h97
2148− return nil
2149− }
2150− decoder98 := json.NewDecoder(bytes.NewReader(x))
2151− decoder98.DisallowUnknownFields()
2152− var h98 ImplementationRegistrationOptions
2153− if err := decoder98.Decode(&h98); err == nil {
2154− t.Value = h98
2155− return nil
2156− }
2157− return &UnmarshalError{"unmarshal failed to match one of [ImplementationOptions ImplementationRegistrationOptions bool]"}
2158−}
2159−
2160−func (t Or_ServerCapabilities_inlayHintProvider) MarshalJSON() ([]byte, error) {
2161− switch x := t.Value.(type) {
2162− case InlayHintOptions:
2163− return json.Marshal(x)
2164− case InlayHintRegistrationOptions:
2165− return json.Marshal(x)
2166− case bool:
2167− return json.Marshal(x)
2168− case nil:
2169− return []byte("null"), nil
2170− }
2171− return nil, fmt.Errorf("type %T not one of [InlayHintOptions InlayHintRegistrationOptions bool]", t)
2172−}
2173−
2174−func (t *Or_ServerCapabilities_inlayHintProvider) UnmarshalJSON(x []byte) error {
2175− if string(x) == "null" {
2176− t.Value = nil
2177− return nil
2178− }
2179− decoder169 := json.NewDecoder(bytes.NewReader(x))
2180− decoder169.DisallowUnknownFields()
2181− var boolVal bool
2182− if err := decoder169.Decode(&boolVal); err == nil {
2183− t.Value = boolVal
2184− return nil
2185− }
2186− decoder170 := json.NewDecoder(bytes.NewReader(x))
2187− decoder170.DisallowUnknownFields()
2188− var h170 InlayHintOptions
2189− if err := decoder170.Decode(&h170); err == nil {
2190− t.Value = h170
2191− return nil
2192− }
2193− decoder171 := json.NewDecoder(bytes.NewReader(x))
2194− decoder171.DisallowUnknownFields()
2195− var h171 InlayHintRegistrationOptions
2196− if err := decoder171.Decode(&h171); err == nil {
2197− t.Value = h171
2198− return nil
2199− }
2200− return &UnmarshalError{"unmarshal failed to match one of [InlayHintOptions InlayHintRegistrationOptions bool]"}
2201−}
2202−
2203−func (t Or_ServerCapabilities_inlineCompletionProvider) MarshalJSON() ([]byte, error) {
2204− switch x := t.Value.(type) {
2205− case InlineCompletionOptions:
2206− return json.Marshal(x)
2207− case bool:
2208− return json.Marshal(x)
2209− case nil:
2210− return []byte("null"), nil
2211− }
2212− return nil, fmt.Errorf("type %T not one of [InlineCompletionOptions bool]", t)
2213−}
2214−
2215−func (t *Or_ServerCapabilities_inlineCompletionProvider) UnmarshalJSON(x []byte) error {
2216− if string(x) == "null" {
2217− t.Value = nil
2218− return nil
2219− }
2220− decoder177 := json.NewDecoder(bytes.NewReader(x))
2221− decoder177.DisallowUnknownFields()
2222− var boolVal bool
2223− if err := decoder177.Decode(&boolVal); err == nil {
2224− t.Value = boolVal
2225− return nil
2226− }
2227− decoder178 := json.NewDecoder(bytes.NewReader(x))
2228− decoder178.DisallowUnknownFields()
2229− var h178 InlineCompletionOptions
2230− if err := decoder178.Decode(&h178); err == nil {
2231− t.Value = h178
2232− return nil
2233− }
2234− return &UnmarshalError{"unmarshal failed to match one of [InlineCompletionOptions bool]"}
2235−}
2236−
2237−func (t Or_ServerCapabilities_inlineValueProvider) MarshalJSON() ([]byte, error) {
2238− switch x := t.Value.(type) {
2239− case InlineValueOptions:
2240− return json.Marshal(x)
2241− case InlineValueRegistrationOptions:
2242− return json.Marshal(x)
2243− case bool:
2244− return json.Marshal(x)
2245− case nil:
2246− return []byte("null"), nil
2247− }
2248− return nil, fmt.Errorf("type %T not one of [InlineValueOptions InlineValueRegistrationOptions bool]", t)
2249−}
2250−
2251−func (t *Or_ServerCapabilities_inlineValueProvider) UnmarshalJSON(x []byte) error {
2252− if string(x) == "null" {
2253− t.Value = nil
2254− return nil
2255− }
2256− decoder164 := json.NewDecoder(bytes.NewReader(x))
2257− decoder164.DisallowUnknownFields()
2258− var boolVal bool
2259− if err := decoder164.Decode(&boolVal); err == nil {
2260− t.Value = boolVal
2261− return nil
2262− }
2263− decoder165 := json.NewDecoder(bytes.NewReader(x))
2264− decoder165.DisallowUnknownFields()
2265− var h165 InlineValueOptions
2266− if err := decoder165.Decode(&h165); err == nil {
2267− t.Value = h165
2268− return nil
2269− }
2270− decoder166 := json.NewDecoder(bytes.NewReader(x))
2271− decoder166.DisallowUnknownFields()
2272− var h166 InlineValueRegistrationOptions
2273− if err := decoder166.Decode(&h166); err == nil {
2274− t.Value = h166
2275− return nil
2276− }
2277− return &UnmarshalError{"unmarshal failed to match one of [InlineValueOptions InlineValueRegistrationOptions bool]"}
2278−}
2279−
2280−func (t Or_ServerCapabilities_linkedEditingRangeProvider) MarshalJSON() ([]byte, error) {
2281− switch x := t.Value.(type) {
2282− case LinkedEditingRangeOptions:
2283− return json.Marshal(x)
2284− case LinkedEditingRangeRegistrationOptions:
2285− return json.Marshal(x)
2286− case bool:
2287− return json.Marshal(x)
2288− case nil:
2289− return []byte("null"), nil
2290− }
2291− return nil, fmt.Errorf("type %T not one of [LinkedEditingRangeOptions LinkedEditingRangeRegistrationOptions bool]", t)
2292−}
2293−
2294−func (t *Or_ServerCapabilities_linkedEditingRangeProvider) UnmarshalJSON(x []byte) error {
2295− if string(x) == "null" {
2296− t.Value = nil
2297− return nil
2298− }
2299− decoder145 := json.NewDecoder(bytes.NewReader(x))
2300− decoder145.DisallowUnknownFields()
2301− var boolVal bool
2302− if err := decoder145.Decode(&boolVal); err == nil {
2303− t.Value = boolVal
2304− return nil
2305− }
2306− decoder146 := json.NewDecoder(bytes.NewReader(x))
2307− decoder146.DisallowUnknownFields()
2308− var h146 LinkedEditingRangeOptions
2309− if err := decoder146.Decode(&h146); err == nil {
2310− t.Value = h146
2311− return nil
2312− }
2313− decoder147 := json.NewDecoder(bytes.NewReader(x))
2314− decoder147.DisallowUnknownFields()
2315− var h147 LinkedEditingRangeRegistrationOptions
2316− if err := decoder147.Decode(&h147); err == nil {
2317− t.Value = h147
2318− return nil
2319− }
2320− return &UnmarshalError{"unmarshal failed to match one of [LinkedEditingRangeOptions LinkedEditingRangeRegistrationOptions bool]"}
2321−}
2322−
2323−func (t Or_ServerCapabilities_monikerProvider) MarshalJSON() ([]byte, error) {
2324− switch x := t.Value.(type) {
2325− case MonikerOptions:
2326− return json.Marshal(x)
2327− case MonikerRegistrationOptions:
2328− return json.Marshal(x)
2329− case bool:
2330− return json.Marshal(x)
2331− case nil:
2332− return []byte("null"), nil
2333− }
2334− return nil, fmt.Errorf("type %T not one of [MonikerOptions MonikerRegistrationOptions bool]", t)
2335−}
2336−
2337−func (t *Or_ServerCapabilities_monikerProvider) UnmarshalJSON(x []byte) error {
2338− if string(x) == "null" {
2339− t.Value = nil
2340− return nil
2341− }
2342− decoder154 := json.NewDecoder(bytes.NewReader(x))
2343− decoder154.DisallowUnknownFields()
2344− var boolVal bool
2345− if err := decoder154.Decode(&boolVal); err == nil {
2346− t.Value = boolVal
2347− return nil
2348− }
2349− decoder155 := json.NewDecoder(bytes.NewReader(x))
2350− decoder155.DisallowUnknownFields()
2351− var h155 MonikerOptions
2352− if err := decoder155.Decode(&h155); err == nil {
2353− t.Value = h155
2354− return nil
2355− }
2356− decoder156 := json.NewDecoder(bytes.NewReader(x))
2357− decoder156.DisallowUnknownFields()
2358− var h156 MonikerRegistrationOptions
2359− if err := decoder156.Decode(&h156); err == nil {
2360− t.Value = h156
2361− return nil
2362− }
2363− return &UnmarshalError{"unmarshal failed to match one of [MonikerOptions MonikerRegistrationOptions bool]"}
2364−}
2365−
2366−func (t Or_ServerCapabilities_notebookDocumentSync) MarshalJSON() ([]byte, error) {
2367− switch x := t.Value.(type) {
2368− case NotebookDocumentSyncOptions:
2369− return json.Marshal(x)
2370− case NotebookDocumentSyncRegistrationOptions:
2371− return json.Marshal(x)
2372− case nil:
2373− return []byte("null"), nil
2374− }
2375− return nil, fmt.Errorf("type %T not one of [NotebookDocumentSyncOptions NotebookDocumentSyncRegistrationOptions]", t)
2376−}
2377−
2378−func (t *Or_ServerCapabilities_notebookDocumentSync) UnmarshalJSON(x []byte) error {
2379− if string(x) == "null" {
2380− t.Value = nil
2381− return nil
2382− }
2383− decoder76 := json.NewDecoder(bytes.NewReader(x))
2384− decoder76.DisallowUnknownFields()
2385− var h76 NotebookDocumentSyncOptions
2386− if err := decoder76.Decode(&h76); err == nil {
2387− t.Value = h76
2388− return nil
2389− }
2390− decoder77 := json.NewDecoder(bytes.NewReader(x))
2391− decoder77.DisallowUnknownFields()
2392− var h77 NotebookDocumentSyncRegistrationOptions
2393− if err := decoder77.Decode(&h77); err == nil {
2394− t.Value = h77
2395− return nil
2396− }
2397− return &UnmarshalError{"unmarshal failed to match one of [NotebookDocumentSyncOptions NotebookDocumentSyncRegistrationOptions]"}
2398−}
2399−
2400−func (t Or_ServerCapabilities_referencesProvider) MarshalJSON() ([]byte, error) {
2401− switch x := t.Value.(type) {
2402− case ReferenceOptions:
2403− return json.Marshal(x)
2404− case bool:
2405− return json.Marshal(x)
2406− case nil:
2407− return []byte("null"), nil
2408− }
2409− return nil, fmt.Errorf("type %T not one of [ReferenceOptions bool]", t)
2410−}
2411−
2412−func (t *Or_ServerCapabilities_referencesProvider) UnmarshalJSON(x []byte) error {
2413− if string(x) == "null" {
2414− t.Value = nil
2415− return nil
2416− }
2417− decoder100 := json.NewDecoder(bytes.NewReader(x))
2418− decoder100.DisallowUnknownFields()
2419− var boolVal bool
2420− if err := decoder100.Decode(&boolVal); err == nil {
2421− t.Value = boolVal
2422− return nil
2423− }
2424− decoder101 := json.NewDecoder(bytes.NewReader(x))
2425− decoder101.DisallowUnknownFields()
2426− var h101 ReferenceOptions
2427− if err := decoder101.Decode(&h101); err == nil {
2428− t.Value = h101
2429− return nil
2430− }
2431− return &UnmarshalError{"unmarshal failed to match one of [ReferenceOptions bool]"}
2432−}
2433−
2434−func (t Or_ServerCapabilities_renameProvider) MarshalJSON() ([]byte, error) {
2435− switch x := t.Value.(type) {
2436− case RenameOptions:
2437− return json.Marshal(x)
2438− case bool:
2439− return json.Marshal(x)
2440− case nil:
2441− return []byte("null"), nil
2442− }
2443− return nil, fmt.Errorf("type %T not one of [RenameOptions bool]", t)
2444−}
2445−
2446−func (t *Or_ServerCapabilities_renameProvider) UnmarshalJSON(x []byte) error {
2447− if string(x) == "null" {
2448− t.Value = nil
2449− return nil
2450− }
2451− decoder126 := json.NewDecoder(bytes.NewReader(x))
2452− decoder126.DisallowUnknownFields()
2453− var boolVal bool
2454− if err := decoder126.Decode(&boolVal); err == nil {
2455− t.Value = boolVal
2456− return nil
2457− }
2458− decoder127 := json.NewDecoder(bytes.NewReader(x))
2459− decoder127.DisallowUnknownFields()
2460− var h127 RenameOptions
2461− if err := decoder127.Decode(&h127); err == nil {
2462− t.Value = h127
2463− return nil
2464− }
2465− return &UnmarshalError{"unmarshal failed to match one of [RenameOptions bool]"}
2466−}
2467−
2468−func (t Or_ServerCapabilities_selectionRangeProvider) MarshalJSON() ([]byte, error) {
2469− switch x := t.Value.(type) {
2470− case SelectionRangeOptions:
2471− return json.Marshal(x)
2472− case SelectionRangeRegistrationOptions:
2473− return json.Marshal(x)
2474− case bool:
2475− return json.Marshal(x)
2476− case nil:
2477− return []byte("null"), nil
2478− }
2479− return nil, fmt.Errorf("type %T not one of [SelectionRangeOptions SelectionRangeRegistrationOptions bool]", t)
2480−}
2481−
2482−func (t *Or_ServerCapabilities_selectionRangeProvider) UnmarshalJSON(x []byte) error {
2483− if string(x) == "null" {
2484− t.Value = nil
2485− return nil
2486− }
2487− decoder135 := json.NewDecoder(bytes.NewReader(x))
2488− decoder135.DisallowUnknownFields()
2489− var boolVal bool
2490− if err := decoder135.Decode(&boolVal); err == nil {
2491− t.Value = boolVal
2492− return nil
2493− }
2494− decoder136 := json.NewDecoder(bytes.NewReader(x))
2495− decoder136.DisallowUnknownFields()
2496− var h136 SelectionRangeOptions
2497− if err := decoder136.Decode(&h136); err == nil {
2498− t.Value = h136
2499− return nil
2500− }
2501− decoder137 := json.NewDecoder(bytes.NewReader(x))
2502− decoder137.DisallowUnknownFields()
2503− var h137 SelectionRangeRegistrationOptions
2504− if err := decoder137.Decode(&h137); err == nil {
2505− t.Value = h137
2506− return nil
2507− }
2508− return &UnmarshalError{"unmarshal failed to match one of [SelectionRangeOptions SelectionRangeRegistrationOptions bool]"}
2509−}
2510−
2511−func (t Or_ServerCapabilities_semanticTokensProvider) MarshalJSON() ([]byte, error) {
2512− switch x := t.Value.(type) {
2513− case SemanticTokensOptions:
2514− return json.Marshal(x)
2515− case SemanticTokensRegistrationOptions:
2516− return json.Marshal(x)
2517− case nil:
2518− return []byte("null"), nil
2519− }
2520− return nil, fmt.Errorf("type %T not one of [SemanticTokensOptions SemanticTokensRegistrationOptions]", t)
2521−}
2522−
2523−func (t *Or_ServerCapabilities_semanticTokensProvider) UnmarshalJSON(x []byte) error {
2524− if string(x) == "null" {
2525− t.Value = nil
2526− return nil
2527− }
2528− decoder150 := json.NewDecoder(bytes.NewReader(x))
2529− decoder150.DisallowUnknownFields()
2530− var h150 SemanticTokensOptions
2531− if err := decoder150.Decode(&h150); err == nil {
2532− t.Value = h150
2533− return nil
2534− }
2535− decoder151 := json.NewDecoder(bytes.NewReader(x))
2536− decoder151.DisallowUnknownFields()
2537− var h151 SemanticTokensRegistrationOptions
2538− if err := decoder151.Decode(&h151); err == nil {
2539− t.Value = h151
2540− return nil
2541− }
2542− return &UnmarshalError{"unmarshal failed to match one of [SemanticTokensOptions SemanticTokensRegistrationOptions]"}
2543−}
2544−
2545−func (t Or_ServerCapabilities_textDocumentSync) MarshalJSON() ([]byte, error) {
2546− switch x := t.Value.(type) {
2547− case TextDocumentSyncKind:
2548− return json.Marshal(x)
2549− case TextDocumentSyncOptions:
2550− return json.Marshal(x)
2551− case nil:
2552− return []byte("null"), nil
2553− }
2554− return nil, fmt.Errorf("type %T not one of [TextDocumentSyncKind TextDocumentSyncOptions]", t)
2555−}
2556−
2557−func (t *Or_ServerCapabilities_textDocumentSync) UnmarshalJSON(x []byte) error {
2558− if string(x) == "null" {
2559− t.Value = nil
2560− return nil
2561− }
2562− decoder72 := json.NewDecoder(bytes.NewReader(x))
2563− decoder72.DisallowUnknownFields()
2564− var h72 TextDocumentSyncKind
2565− if err := decoder72.Decode(&h72); err == nil {
2566− t.Value = h72
2567− return nil
2568− }
2569− decoder73 := json.NewDecoder(bytes.NewReader(x))
2570− decoder73.DisallowUnknownFields()
2571− var h73 TextDocumentSyncOptions
2572− if err := decoder73.Decode(&h73); err == nil {
2573− t.Value = h73
2574− return nil
2575− }
2576− return &UnmarshalError{"unmarshal failed to match one of [TextDocumentSyncKind TextDocumentSyncOptions]"}
2577−}
2578−
2579−func (t Or_ServerCapabilities_typeDefinitionProvider) MarshalJSON() ([]byte, error) {
2580− switch x := t.Value.(type) {
2581− case TypeDefinitionOptions:
2582− return json.Marshal(x)
2583− case TypeDefinitionRegistrationOptions:
2584− return json.Marshal(x)
2585− case bool:
2586− return json.Marshal(x)
2587− case nil:
2588− return []byte("null"), nil
2589− }
2590− return nil, fmt.Errorf("type %T not one of [TypeDefinitionOptions TypeDefinitionRegistrationOptions bool]", t)
2591−}
2592−
2593−func (t *Or_ServerCapabilities_typeDefinitionProvider) UnmarshalJSON(x []byte) error {
2594− if string(x) == "null" {
2595− t.Value = nil
2596− return nil
2597− }
2598− decoder91 := json.NewDecoder(bytes.NewReader(x))
2599− decoder91.DisallowUnknownFields()
2600− var boolVal bool
2601− if err := decoder91.Decode(&boolVal); err == nil {
2602− t.Value = boolVal
2603− return nil
2604− }
2605− decoder92 := json.NewDecoder(bytes.NewReader(x))
2606− decoder92.DisallowUnknownFields()
2607− var h92 TypeDefinitionOptions
2608− if err := decoder92.Decode(&h92); err == nil {
2609− t.Value = h92
2610− return nil
2611− }
2612− decoder93 := json.NewDecoder(bytes.NewReader(x))
2613− decoder93.DisallowUnknownFields()
2614− var h93 TypeDefinitionRegistrationOptions
2615− if err := decoder93.Decode(&h93); err == nil {
2616− t.Value = h93
2617− return nil
2618− }
2619− return &UnmarshalError{"unmarshal failed to match one of [TypeDefinitionOptions TypeDefinitionRegistrationOptions bool]"}
2620−}
2621−
2622−func (t Or_ServerCapabilities_typeHierarchyProvider) MarshalJSON() ([]byte, error) {
2623− switch x := t.Value.(type) {
2624− case TypeHierarchyOptions:
2625− return json.Marshal(x)
2626− case TypeHierarchyRegistrationOptions:
2627− return json.Marshal(x)
2628− case bool:
2629− return json.Marshal(x)
2630− case nil:
2631− return []byte("null"), nil
2632− }
2633− return nil, fmt.Errorf("type %T not one of [TypeHierarchyOptions TypeHierarchyRegistrationOptions bool]", t)
2634−}
2635−
2636−func (t *Or_ServerCapabilities_typeHierarchyProvider) UnmarshalJSON(x []byte) error {
2637− if string(x) == "null" {
2638− t.Value = nil
2639− return nil
2640− }
2641− decoder159 := json.NewDecoder(bytes.NewReader(x))
2642− decoder159.DisallowUnknownFields()
2643− var boolVal bool
2644− if err := decoder159.Decode(&boolVal); err == nil {
2645− t.Value = boolVal
2646− return nil
2647− }
2648− decoder160 := json.NewDecoder(bytes.NewReader(x))
2649− decoder160.DisallowUnknownFields()
2650− var h160 TypeHierarchyOptions
2651− if err := decoder160.Decode(&h160); err == nil {
2652− t.Value = h160
2653− return nil
2654− }
2655− decoder161 := json.NewDecoder(bytes.NewReader(x))
2656− decoder161.DisallowUnknownFields()
2657− var h161 TypeHierarchyRegistrationOptions
2658− if err := decoder161.Decode(&h161); err == nil {
2659− t.Value = h161
2660− return nil
2661− }
2662− return &UnmarshalError{"unmarshal failed to match one of [TypeHierarchyOptions TypeHierarchyRegistrationOptions bool]"}
2663−}
2664−
2665−func (t Or_ServerCapabilities_workspaceSymbolProvider) MarshalJSON() ([]byte, error) {
2666− switch x := t.Value.(type) {
2667− case WorkspaceSymbolOptions:
2668− return json.Marshal(x)
2669− case bool:
2670− return json.Marshal(x)
2671− case nil:
2672− return []byte("null"), nil
2673− }
2674− return nil, fmt.Errorf("type %T not one of [WorkspaceSymbolOptions bool]", t)
2675−}
2676−
2677−func (t *Or_ServerCapabilities_workspaceSymbolProvider) UnmarshalJSON(x []byte) error {
2678− if string(x) == "null" {
2679− t.Value = nil
2680− return nil
2681− }
2682− decoder117 := json.NewDecoder(bytes.NewReader(x))
2683− decoder117.DisallowUnknownFields()
2684− var boolVal bool
2685− if err := decoder117.Decode(&boolVal); err == nil {
2686− t.Value = boolVal
2687− return nil
2688− }
2689− decoder118 := json.NewDecoder(bytes.NewReader(x))
2690− decoder118.DisallowUnknownFields()
2691− var h118 WorkspaceSymbolOptions
2692− if err := decoder118.Decode(&h118); err == nil {
2693− t.Value = h118
2694− return nil
2695− }
2696− return &UnmarshalError{"unmarshal failed to match one of [WorkspaceSymbolOptions bool]"}
2697−}
2698−
2699−func (t Or_SignatureInformation_documentation) MarshalJSON() ([]byte, error) {
2700− switch x := t.Value.(type) {
2701− case MarkupContent:
2702− return json.Marshal(x)
2703− case string:
2704− return json.Marshal(x)
2705− case nil:
2706− return []byte("null"), nil
2707− }
2708− return nil, fmt.Errorf("type %T not one of [MarkupContent string]", t)
2709−}
2710−
2711−func (t *Or_SignatureInformation_documentation) UnmarshalJSON(x []byte) error {
2712− if string(x) == "null" {
2713− t.Value = nil
2714− return nil
2715− }
2716− decoder186 := json.NewDecoder(bytes.NewReader(x))
2717− decoder186.DisallowUnknownFields()
2718− var stringVal string
2719− if err := decoder186.Decode(&stringVal); err == nil {
2720− t.Value = stringVal
2721− return nil
2722− }
2723− decoder187 := json.NewDecoder(bytes.NewReader(x))
2724− decoder187.DisallowUnknownFields()
2725− var h187 MarkupContent
2726− if err := decoder187.Decode(&h187); err == nil {
2727− t.Value = h187
2728− return nil
2729− }
2730− return &UnmarshalError{"unmarshal failed to match one of [MarkupContent string]"}
2731−}
2732−
2733−func (t Or_TextDocumentContentChangeEvent) MarshalJSON() ([]byte, error) {
2734− switch x := t.Value.(type) {
2735− case TextDocumentContentChangePartial:
2736− return json.Marshal(x)
2737− case TextDocumentContentChangeWholeDocument:
2738− return json.Marshal(x)
2739− case nil:
2740− return []byte("null"), nil
2741− }
2742− return nil, fmt.Errorf("type %T not one of [TextDocumentContentChangePartial TextDocumentContentChangeWholeDocument]", t)
2743−}
2744−
2745−func (t *Or_TextDocumentContentChangeEvent) UnmarshalJSON(x []byte) error {
2746− if string(x) == "null" {
2747− t.Value = nil
2748− return nil
2749− }
2750− decoder263 := json.NewDecoder(bytes.NewReader(x))
2751− decoder263.DisallowUnknownFields()
2752− var h263 TextDocumentContentChangePartial
2753− if err := decoder263.Decode(&h263); err == nil {
2754− t.Value = h263
2755− return nil
2756− }
2757− decoder264 := json.NewDecoder(bytes.NewReader(x))
2758− decoder264.DisallowUnknownFields()
2759− var h264 TextDocumentContentChangeWholeDocument
2760− if err := decoder264.Decode(&h264); err == nil {
2761− t.Value = h264
2762− return nil
2763− }
2764− return &UnmarshalError{"unmarshal failed to match one of [TextDocumentContentChangePartial TextDocumentContentChangeWholeDocument]"}
2765−}
2766−
2767−func (t Or_TextDocumentEdit_edits_Elem) MarshalJSON() ([]byte, error) {
2768− switch x := t.Value.(type) {
2769− case AnnotatedTextEdit:
2770− return json.Marshal(x)
2771− case SnippetTextEdit:
2772− return json.Marshal(x)
2773− case TextEdit:
2774− return json.Marshal(x)
2775− case nil:
2776− return []byte("null"), nil
2777− }
2778− return nil, fmt.Errorf("type %T not one of [AnnotatedTextEdit SnippetTextEdit TextEdit]", t)
2779−}
2780−
2781−func (t *Or_TextDocumentEdit_edits_Elem) UnmarshalJSON(x []byte) error {
2782− if string(x) == "null" {
2783− t.Value = nil
2784− return nil
2785− }
2786− decoder52 := json.NewDecoder(bytes.NewReader(x))
2787− decoder52.DisallowUnknownFields()
2788− var h52 AnnotatedTextEdit
2789− if err := decoder52.Decode(&h52); err == nil {
2790− t.Value = h52
2791− return nil
2792− }
2793− decoder53 := json.NewDecoder(bytes.NewReader(x))
2794− decoder53.DisallowUnknownFields()
2795− var h53 SnippetTextEdit
2796− if err := decoder53.Decode(&h53); err == nil {
2797− t.Value = h53
2798− return nil
2799− }
2800− decoder54 := json.NewDecoder(bytes.NewReader(x))
2801− decoder54.DisallowUnknownFields()
2802− var h54 TextEdit
2803− if err := decoder54.Decode(&h54); err == nil {
2804− t.Value = h54
2805− return nil
2806− }
2807− return &UnmarshalError{"unmarshal failed to match one of [AnnotatedTextEdit SnippetTextEdit TextEdit]"}
2808−}
2809−
2810−func (t Or_TextDocumentFilter) MarshalJSON() ([]byte, error) {
2811− switch x := t.Value.(type) {
2812− case TextDocumentFilterLanguage:
2813− return json.Marshal(x)
2814− case TextDocumentFilterPattern:
2815− return json.Marshal(x)
2816− case TextDocumentFilterScheme:
2817− return json.Marshal(x)
2818− case nil:
2819− return []byte("null"), nil
2820− }
2821− return nil, fmt.Errorf("type %T not one of [TextDocumentFilterLanguage TextDocumentFilterPattern TextDocumentFilterScheme]", t)
2822−}
2823−
2824−func (t *Or_TextDocumentFilter) UnmarshalJSON(x []byte) error {
2825− if string(x) == "null" {
2826− t.Value = nil
2827− return nil
2828− }
2829− decoder279 := json.NewDecoder(bytes.NewReader(x))
2830− decoder279.DisallowUnknownFields()
2831− var h279 TextDocumentFilterLanguage
2832− if err := decoder279.Decode(&h279); err == nil {
2833− t.Value = h279
2834− return nil
2835− }
2836− decoder280 := json.NewDecoder(bytes.NewReader(x))
2837− decoder280.DisallowUnknownFields()
2838− var h280 TextDocumentFilterPattern
2839− if err := decoder280.Decode(&h280); err == nil {
2840− t.Value = h280
2841− return nil
2842− }
2843− decoder281 := json.NewDecoder(bytes.NewReader(x))
2844− decoder281.DisallowUnknownFields()
2845− var h281 TextDocumentFilterScheme
2846− if err := decoder281.Decode(&h281); err == nil {
2847− t.Value = h281
2848− return nil
2849− }
2850− return &UnmarshalError{"unmarshal failed to match one of [TextDocumentFilterLanguage TextDocumentFilterPattern TextDocumentFilterScheme]"}
2851−}
2852−
2853−func (t Or_TextDocumentSyncOptions_save) MarshalJSON() ([]byte, error) {
2854− switch x := t.Value.(type) {
2855− case SaveOptions:
2856− return json.Marshal(x)
2857− case bool:
2858− return json.Marshal(x)
2859− case nil:
2860− return []byte("null"), nil
2861− }
2862− return nil, fmt.Errorf("type %T not one of [SaveOptions bool]", t)
2863−}
2864−
2865−func (t *Or_TextDocumentSyncOptions_save) UnmarshalJSON(x []byte) error {
2866− if string(x) == "null" {
2867− t.Value = nil
2868− return nil
2869− }
2870− decoder195 := json.NewDecoder(bytes.NewReader(x))
2871− decoder195.DisallowUnknownFields()
2872− var boolVal bool
2873− if err := decoder195.Decode(&boolVal); err == nil {
2874− t.Value = boolVal
2875− return nil
2876− }
2877− decoder196 := json.NewDecoder(bytes.NewReader(x))
2878− decoder196.DisallowUnknownFields()
2879− var h196 SaveOptions
2880− if err := decoder196.Decode(&h196); err == nil {
2881− t.Value = h196
2882− return nil
2883− }
2884− return &UnmarshalError{"unmarshal failed to match one of [SaveOptions bool]"}
2885−}
2886−
2887−func (t Or_WorkspaceDocumentDiagnosticReport) MarshalJSON() ([]byte, error) {
2888− switch x := t.Value.(type) {
2889− case WorkspaceFullDocumentDiagnosticReport:
2890− return json.Marshal(x)
2891− case WorkspaceUnchangedDocumentDiagnosticReport:
2892− return json.Marshal(x)
2893− case nil:
2894− return []byte("null"), nil
2895− }
2896− return nil, fmt.Errorf("type %T not one of [WorkspaceFullDocumentDiagnosticReport WorkspaceUnchangedDocumentDiagnosticReport]", t)
2897−}
2898−
2899−func (t *Or_WorkspaceDocumentDiagnosticReport) UnmarshalJSON(x []byte) error {
2900− if string(x) == "null" {
2901− t.Value = nil
2902− return nil
2903− }
2904− decoder259 := json.NewDecoder(bytes.NewReader(x))
2905− decoder259.DisallowUnknownFields()
2906− var h259 WorkspaceFullDocumentDiagnosticReport
2907− if err := decoder259.Decode(&h259); err == nil {
2908− t.Value = h259
2909− return nil
2910− }
2911− decoder260 := json.NewDecoder(bytes.NewReader(x))
2912− decoder260.DisallowUnknownFields()
2913− var h260 WorkspaceUnchangedDocumentDiagnosticReport
2914− if err := decoder260.Decode(&h260); err == nil {
2915− t.Value = h260
2916− return nil
2917− }
2918− return &UnmarshalError{"unmarshal failed to match one of [WorkspaceFullDocumentDiagnosticReport WorkspaceUnchangedDocumentDiagnosticReport]"}
2919−}
2920−
2921−func (t Or_WorkspaceEdit_documentChanges_Elem) MarshalJSON() ([]byte, error) {
2922− switch x := t.Value.(type) {
2923− case CreateFile:
2924− return json.Marshal(x)
2925− case DeleteFile:
2926− return json.Marshal(x)
2927− case RenameFile:
2928− return json.Marshal(x)
2929− case TextDocumentEdit:
2930− return json.Marshal(x)
2931− case nil:
2932− return []byte("null"), nil
2933− }
2934− return nil, fmt.Errorf("type %T not one of [CreateFile DeleteFile RenameFile TextDocumentEdit]", t)
2935−}
2936−
2937−func (t *Or_WorkspaceEdit_documentChanges_Elem) UnmarshalJSON(x []byte) error {
2938− if string(x) == "null" {
2939− t.Value = nil
2940− return nil
2941− }
2942− decoder4 := json.NewDecoder(bytes.NewReader(x))
2943− decoder4.DisallowUnknownFields()
2944− var h4 CreateFile
2945− if err := decoder4.Decode(&h4); err == nil {
2946− t.Value = h4
2947− return nil
2948− }
2949− decoder5 := json.NewDecoder(bytes.NewReader(x))
2950− decoder5.DisallowUnknownFields()
2951− var h5 DeleteFile
2952− if err := decoder5.Decode(&h5); err == nil {
2953− t.Value = h5
2954− return nil
2955− }
2956− decoder6 := json.NewDecoder(bytes.NewReader(x))
2957− decoder6.DisallowUnknownFields()
2958− var h6 RenameFile
2959− if err := decoder6.Decode(&h6); err == nil {
2960− t.Value = h6
2961− return nil
2962− }
2963− decoder7 := json.NewDecoder(bytes.NewReader(x))
2964− decoder7.DisallowUnknownFields()
2965− var h7 TextDocumentEdit
2966− if err := decoder7.Decode(&h7); err == nil {
2967− t.Value = h7
2968− return nil
2969− }
2970− return &UnmarshalError{"unmarshal failed to match one of [CreateFile DeleteFile RenameFile TextDocumentEdit]"}
2971−}
2972−
2973−func (t Or_WorkspaceFoldersServerCapabilities_changeNotifications) MarshalJSON() ([]byte, error) {
2974− switch x := t.Value.(type) {
2975− case bool:
2976− return json.Marshal(x)
2977− case string:
2978− return json.Marshal(x)
2979− case nil:
2980− return []byte("null"), nil
2981− }
2982− return nil, fmt.Errorf("type %T not one of [bool string]", t)
2983−}
2984−
2985−func (t *Or_WorkspaceFoldersServerCapabilities_changeNotifications) UnmarshalJSON(x []byte) error {
2986− if string(x) == "null" {
2987− t.Value = nil
2988− return nil
2989− }
2990− decoder210 := json.NewDecoder(bytes.NewReader(x))
2991− decoder210.DisallowUnknownFields()
2992− var boolVal bool
2993− if err := decoder210.Decode(&boolVal); err == nil {
2994− t.Value = boolVal
2995− return nil
2996− }
2997− decoder211 := json.NewDecoder(bytes.NewReader(x))
2998− decoder211.DisallowUnknownFields()
2999− var stringVal string
3000− if err := decoder211.Decode(&stringVal); err == nil {
3001− t.Value = stringVal
3002− return nil
3003− }
3004− return &UnmarshalError{"unmarshal failed to match one of [bool string]"}
3005−}
3006−
3007−func (t Or_WorkspaceOptions_textDocumentContent) MarshalJSON() ([]byte, error) {
3008− switch x := t.Value.(type) {
3009− case TextDocumentContentOptions:
3010− return json.Marshal(x)
3011− case TextDocumentContentRegistrationOptions:
3012− return json.Marshal(x)
3013− case nil:
3014− return []byte("null"), nil
3015− }
3016− return nil, fmt.Errorf("type %T not one of [TextDocumentContentOptions TextDocumentContentRegistrationOptions]", t)
3017−}
3018−
3019−func (t *Or_WorkspaceOptions_textDocumentContent) UnmarshalJSON(x []byte) error {
3020− if string(x) == "null" {
3021− t.Value = nil
3022− return nil
3023− }
3024− decoder199 := json.NewDecoder(bytes.NewReader(x))
3025− decoder199.DisallowUnknownFields()
3026− var h199 TextDocumentContentOptions
3027− if err := decoder199.Decode(&h199); err == nil {
3028− t.Value = h199
3029− return nil
3030− }
3031− decoder200 := json.NewDecoder(bytes.NewReader(x))
3032− decoder200.DisallowUnknownFields()
3033− var h200 TextDocumentContentRegistrationOptions
3034− if err := decoder200.Decode(&h200); err == nil {
3035− t.Value = h200
3036− return nil
3037− }
3038− return &UnmarshalError{"unmarshal failed to match one of [TextDocumentContentOptions TextDocumentContentRegistrationOptions]"}
3039−}
3040−
3041−func (t Or_WorkspaceSymbol_location) MarshalJSON() ([]byte, error) {
3042− switch x := t.Value.(type) {
3043− case Location:
3044− return json.Marshal(x)
3045− case LocationUriOnly:
3046− return json.Marshal(x)
3047− case nil:
3048− return []byte("null"), nil
3049− }
3050− return nil, fmt.Errorf("type %T not one of [Location LocationUriOnly]", t)
3051−}
3052−
3053−func (t *Or_WorkspaceSymbol_location) UnmarshalJSON(x []byte) error {
3054− if string(x) == "null" {
3055− t.Value = nil
3056− return nil
3057− }
3058− decoder39 := json.NewDecoder(bytes.NewReader(x))
3059− decoder39.DisallowUnknownFields()
3060− var h39 Location
3061− if err := decoder39.Decode(&h39); err == nil {
3062− t.Value = h39
3063− return nil
3064− }
3065− decoder40 := json.NewDecoder(bytes.NewReader(x))
3066− decoder40.DisallowUnknownFields()
3067− var h40 LocationUriOnly
3068− if err := decoder40.Decode(&h40); err == nil {
3069− t.Value = h40
3070− return nil
3071− }
3072− return &UnmarshalError{"unmarshal failed to match one of [Location LocationUriOnly]"}
3073−}
internal/lsp/protocol/tsprotocol.godeleted−6952
@@ -1,6952 +0,0 @@
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 slog.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 (
229− ChangeAnnotationIdentifier = string // (alias)
230− // @since 3.18.0
231− //
232− // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#changeAnnotationsSupportOptions
233− ChangeAnnotationsSupportOptions struct {
234− // Whether the client groups edits with equal labels into tree nodes,
235− // for instance all edits labelled with "Changes in Strings" would
236− // be a tree node.
237− GroupsOnLabel bool `json:"groupsOnLabel,omitempty"`
238− }
239−)
240−
241−// Defines the capabilities provided by the client.
242−//
243−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientCapabilities
244−type ClientCapabilities struct {
245− // Workspace specific client capabilities.
246− Workspace WorkspaceClientCapabilities `json:"workspace,omitempty"`
247− // Text document specific client capabilities.
248− TextDocument TextDocumentClientCapabilities `json:"textDocument,omitempty"`
249− // Capabilities specific to the notebook document support.
250− //
251− // @since 3.17.0
252− NotebookDocument *NotebookDocumentClientCapabilities `json:"notebookDocument,omitempty"`
253− // Window specific client capabilities.
254− Window WindowClientCapabilities `json:"window,omitempty"`
255− // General client capabilities.
256− //
257− // @since 3.16.0
258− General *GeneralClientCapabilities `json:"general,omitempty"`
259− // Experimental client capabilities.
260− Experimental interface{} `json:"experimental,omitempty"`
261−}
262−
263−// @since 3.18.0
264−//
265−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientCodeActionKindOptions
266−type ClientCodeActionKindOptions struct {
267− // The code action kind values the client supports. When this
268− // property exists the client also guarantees that it will
269− // handle values outside its set gracefully and falls back
270− // to a default value when unknown.
271− ValueSet []CodeActionKind `json:"valueSet"`
272−}
273−
274−// @since 3.18.0
275−//
276−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientCodeActionLiteralOptions
277−type ClientCodeActionLiteralOptions struct {
278− // The code action kind is support with the following value
279− // set.
280− CodeActionKind ClientCodeActionKindOptions `json:"codeActionKind"`
281−}
282−
283−// @since 3.18.0
284−//
285−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientCodeActionResolveOptions
286−type ClientCodeActionResolveOptions struct {
287− // The properties that a client can resolve lazily.
288− Properties []string `json:"properties"`
289−}
290−
291−// @since 3.18.0
292−//
293−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientCodeLensResolveOptions
294−type ClientCodeLensResolveOptions struct {
295− // The properties that a client can resolve lazily.
296− Properties []string `json:"properties"`
297−}
298−
299−// @since 3.18.0
300−//
301−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientCompletionItemInsertTextModeOptions
302−type ClientCompletionItemInsertTextModeOptions struct {
303− ValueSet []InsertTextMode `json:"valueSet"`
304−}
305−
306−// @since 3.18.0
307−//
308−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientCompletionItemOptions
309−type ClientCompletionItemOptions struct {
310− // Client supports snippets as insert text.
311− //
312− // A snippet can define tab stops and placeholders with `$1`, `$2`
313− // and `${3:foo}`. `$0` defines the final tab stop, it defaults to
314− // the end of the snippet. Placeholders with equal identifiers are linked,
315− // that is typing in one will update others too.
316− SnippetSupport bool `json:"snippetSupport,omitempty"`
317− // Client supports commit characters on a completion item.
318− CommitCharactersSupport bool `json:"commitCharactersSupport,omitempty"`
319− // Client supports the following content formats for the documentation
320− // property. The order describes the preferred format of the client.
321− DocumentationFormat []MarkupKind `json:"documentationFormat,omitempty"`
322− // Client supports the deprecated property on a completion item.
323− DeprecatedSupport bool `json:"deprecatedSupport,omitempty"`
324− // Client supports the preselect property on a completion item.
325− PreselectSupport bool `json:"preselectSupport,omitempty"`
326− // Client supports the tag property on a completion item. Clients supporting
327− // tags have to handle unknown tags gracefully. Clients especially need to
328− // preserve unknown tags when sending a completion item back to the server in
329− // a resolve call.
330− //
331− // @since 3.15.0
332− TagSupport *CompletionItemTagOptions `json:"tagSupport,omitempty"`
333− // Client support insert replace edit to control different behavior if a
334− // completion item is inserted in the text or should replace text.
335− //
336− // @since 3.16.0
337− InsertReplaceSupport bool `json:"insertReplaceSupport,omitempty"`
338− // Indicates which properties a client can resolve lazily on a completion
339− // item. Before version 3.16.0 only the predefined properties `documentation`
340− // and `details` could be resolved lazily.
341− //
342− // @since 3.16.0
343− ResolveSupport *ClientCompletionItemResolveOptions `json:"resolveSupport,omitempty"`
344− // The client supports the `insertTextMode` property on
345− // a completion item to override the whitespace handling mode
346− // as defined by the client (see `insertTextMode`).
347− //
348− // @since 3.16.0
349− InsertTextModeSupport *ClientCompletionItemInsertTextModeOptions `json:"insertTextModeSupport,omitempty"`
350− // The client has support for completion item label
351− // details (see also `CompletionItemLabelDetails`).
352− //
353− // @since 3.17.0
354− LabelDetailsSupport bool `json:"labelDetailsSupport,omitempty"`
355−}
356−
357−// @since 3.18.0
358−//
359−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientCompletionItemOptionsKind
360−type ClientCompletionItemOptionsKind struct {
361− // The completion item kind values the client supports. When this
362− // property exists the client also guarantees that it will
363− // handle values outside its set gracefully and falls back
364− // to a default value when unknown.
365− //
366− // If this property is not present the client only supports
367− // the completion items kinds from `Text` to `Reference` as defined in
368− // the initial version of the protocol.
369− ValueSet []CompletionItemKind `json:"valueSet,omitempty"`
370−}
371−
372−// @since 3.18.0
373−//
374−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientCompletionItemResolveOptions
375−type ClientCompletionItemResolveOptions struct {
376− // The properties that a client can resolve lazily.
377− Properties []string `json:"properties"`
378−}
379−
380−// @since 3.18.0
381−//
382−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientDiagnosticsTagOptions
383−type ClientDiagnosticsTagOptions struct {
384− // The tags supported by the client.
385− ValueSet []DiagnosticTag `json:"valueSet"`
386−}
387−
388−// @since 3.18.0
389−//
390−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientFoldingRangeKindOptions
391−type ClientFoldingRangeKindOptions struct {
392− // The folding range kind values the client supports. When this
393− // property exists the client also guarantees that it will
394− // handle values outside its set gracefully and falls back
395− // to a default value when unknown.
396− ValueSet []FoldingRangeKind `json:"valueSet,omitempty"`
397−}
398−
399−// @since 3.18.0
400−//
401−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientFoldingRangeOptions
402−type ClientFoldingRangeOptions struct {
403− // If set, the client signals that it supports setting collapsedText on
404− // folding ranges to display custom labels instead of the default text.
405− //
406− // @since 3.17.0
407− CollapsedText bool `json:"collapsedText,omitempty"`
408−}
409−
410−// Information about the client
411−//
412−// @since 3.15.0
413−// @since 3.18.0 ClientInfo type name added.
414−//
415−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientInfo
416−type ClientInfo struct {
417− // The name of the client as defined by the client.
418− Name string `json:"name"`
419− // The client's version as defined by the client.
420− Version string `json:"version,omitempty"`
421−}
422−
423−// @since 3.18.0
424−//
425−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientInlayHintResolveOptions
426−type ClientInlayHintResolveOptions struct {
427− // The properties that a client can resolve lazily.
428− Properties []string `json:"properties"`
429−}
430−
431−// @since 3.18.0
432−//
433−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientSemanticTokensRequestFullDelta
434−type ClientSemanticTokensRequestFullDelta struct {
435− // The client will send the `textDocument/semanticTokens/full/delta` request if
436− // the server provides a corresponding handler.
437− Delta bool `json:"delta,omitempty"`
438−}
439−
440−// @since 3.18.0
441−//
442−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientSemanticTokensRequestOptions
443−type ClientSemanticTokensRequestOptions struct {
444− // The client will send the `textDocument/semanticTokens/range` request if
445− // the server provides a corresponding handler.
446− Range *Or_ClientSemanticTokensRequestOptions_range `json:"range,omitempty"`
447− // The client will send the `textDocument/semanticTokens/full` request if
448− // the server provides a corresponding handler.
449− Full *Or_ClientSemanticTokensRequestOptions_full `json:"full,omitempty"`
450−}
451−
452−// @since 3.18.0
453−//
454−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientShowMessageActionItemOptions
455−type ClientShowMessageActionItemOptions struct {
456− // Whether the client supports additional attributes which
457− // are preserved and send back to the server in the
458− // request's response.
459− AdditionalPropertiesSupport bool `json:"additionalPropertiesSupport,omitempty"`
460−}
461−
462−// @since 3.18.0
463−//
464−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientSignatureInformationOptions
465−type ClientSignatureInformationOptions struct {
466− // Client supports the following content formats for the documentation
467− // property. The order describes the preferred format of the client.
468− DocumentationFormat []MarkupKind `json:"documentationFormat,omitempty"`
469− // Client capabilities specific to parameter information.
470− ParameterInformation *ClientSignatureParameterInformationOptions `json:"parameterInformation,omitempty"`
471− // The client supports the `activeParameter` property on `SignatureInformation`
472− // literal.
473− //
474− // @since 3.16.0
475− ActiveParameterSupport bool `json:"activeParameterSupport,omitempty"`
476− // The client supports the `activeParameter` property on
477− // `SignatureHelp`/`SignatureInformation` being set to `null` to
478− // indicate that no parameter should be active.
479− //
480− // @since 3.18.0
481− // @proposed
482− NoActiveParameterSupport bool `json:"noActiveParameterSupport,omitempty"`
483−}
484−
485−// @since 3.18.0
486−//
487−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientSignatureParameterInformationOptions
488−type ClientSignatureParameterInformationOptions struct {
489− // The client supports processing label offsets instead of a
490− // simple label string.
491− //
492− // @since 3.14.0
493− LabelOffsetSupport bool `json:"labelOffsetSupport,omitempty"`
494−}
495−
496−// @since 3.18.0
497−//
498−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientSymbolKindOptions
499−type ClientSymbolKindOptions struct {
500− // The symbol kind values the client supports. When this
501− // property exists the client also guarantees that it will
502− // handle values outside its set gracefully and falls back
503− // to a default value when unknown.
504− //
505− // If this property is not present the client only supports
506− // the symbol kinds from `File` to `Array` as defined in
507− // the initial version of the protocol.
508− ValueSet []SymbolKind `json:"valueSet,omitempty"`
509−}
510−
511−// @since 3.18.0
512−//
513−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientSymbolResolveOptions
514−type ClientSymbolResolveOptions struct {
515− // The properties that a client can resolve lazily. Usually
516− // `location.range`
517− Properties []string `json:"properties"`
518−}
519−
520−// @since 3.18.0
521−//
522−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientSymbolTagOptions
523−type ClientSymbolTagOptions struct {
524− // The tags supported by the client.
525− ValueSet []SymbolTag `json:"valueSet"`
526−}
527−
528−// A code action represents a change that can be performed in code, e.g. to fix a problem or
529−// to refactor code.
530−//
531−// A CodeAction must set either `edit` and/or a `command`. If both are supplied, the `edit` is applied first, then the `command` is executed.
532−//
533−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeAction
534−type CodeAction struct {
535− // A short, human-readable, title for this code action.
536− Title string `json:"title"`
537− // The kind of the code action.
538− //
539− // Used to filter code actions.
540− Kind CodeActionKind `json:"kind,omitempty"`
541− // The diagnostics that this code action resolves.
542− Diagnostics []Diagnostic `json:"diagnostics,omitempty"`
543− // Marks this as a preferred action. Preferred actions are used by the `auto fix` command and can be targeted
544− // by keybindings.
545− //
546− // A quick fix should be marked preferred if it properly addresses the underlying error.
547− // A refactoring should be marked preferred if it is the most reasonable choice of actions to take.
548− //
549− // @since 3.15.0
550− IsPreferred bool `json:"isPreferred,omitempty"`
551− // Marks that the code action cannot currently be applied.
552− //
553− // Clients should follow the following guidelines regarding disabled code actions:
554− //
555− // - Disabled code actions are not shown in automatic [lightbulbs](https://code.visualstudio.com/docs/editor/editingevolved#_code-action)
556− // code action menus.
557− //
558− // - Disabled actions are shown as faded out in the code action menu when the user requests a more specific type
559− // of code action, such as refactorings.
560− //
561− // - If the user has a [keybinding](https://code.visualstudio.com/docs/editor/refactoring#_keybindings-for-code-actions)
562− // that auto applies a code action and only disabled code actions are returned, the client should show the user an
563− // error message with `reason` in the editor.
564− //
565− // @since 3.16.0
566− Disabled *CodeActionDisabled `json:"disabled,omitempty"`
567− // The workspace edit this code action performs.
568− Edit *WorkspaceEdit `json:"edit,omitempty"`
569− // A command this code action executes. If a code action
570− // provides an edit and a command, first the edit is
571− // executed and then the command.
572− Command *Command `json:"command,omitempty"`
573− // A data entry field that is preserved on a code action between
574− // a `textDocument/codeAction` and a `codeAction/resolve` request.
575− //
576− // @since 3.16.0
577− Data *json.RawMessage `json:"data,omitempty"`
578−}
579−
580−// The Client Capabilities of a {@link CodeActionRequest}.
581−//
582−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeActionClientCapabilities
583−type CodeActionClientCapabilities struct {
584− // Whether code action supports dynamic registration.
585− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
586− // The client support code action literals of type `CodeAction` as a valid
587− // response of the `textDocument/codeAction` request. If the property is not
588− // set the request can only return `Command` literals.
589− //
590− // @since 3.8.0
591− CodeActionLiteralSupport ClientCodeActionLiteralOptions `json:"codeActionLiteralSupport,omitempty"`
592− // Whether code action supports the `isPreferred` property.
593− //
594− // @since 3.15.0
595− IsPreferredSupport bool `json:"isPreferredSupport,omitempty"`
596− // Whether code action supports the `disabled` property.
597− //
598− // @since 3.16.0
599− DisabledSupport bool `json:"disabledSupport,omitempty"`
600− // Whether code action supports the `data` property which is
601− // preserved between a `textDocument/codeAction` and a
602− // `codeAction/resolve` request.
603− //
604− // @since 3.16.0
605− DataSupport bool `json:"dataSupport,omitempty"`
606− // Whether the client supports resolving additional code action
607− // properties via a separate `codeAction/resolve` request.
608− //
609− // @since 3.16.0
610− ResolveSupport *ClientCodeActionResolveOptions `json:"resolveSupport,omitempty"`
611− // Whether the client honors the change annotations in
612− // text edits and resource operations returned via the
613− // `CodeAction#edit` property by for example presenting
614− // the workspace edit in the user interface and asking
615− // for confirmation.
616− //
617− // @since 3.16.0
618− HonorsChangeAnnotations bool `json:"honorsChangeAnnotations,omitempty"`
619− // Whether the client supports documentation for a class of
620− // code actions.
621− //
622− // @since 3.18.0
623− // @proposed
624− DocumentationSupport bool `json:"documentationSupport,omitempty"`
625−}
626−
627−// Contains additional diagnostic information about the context in which
628−// a {@link CodeActionProvider.provideCodeActions code action} is run.
629−//
630−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeActionContext
631−type CodeActionContext struct {
632− // An array of diagnostics known on the client side overlapping the range provided to the
633− // `textDocument/codeAction` request. They are provided so that the server knows which
634− // errors are currently presented to the user for the given range. There is no guarantee
635− // that these accurately reflect the error state of the resource. The primary parameter
636− // to compute code actions is the provided range.
637− Diagnostics []Diagnostic `json:"diagnostics"`
638− // Requested kind of actions to return.
639− //
640− // Actions not of this kind are filtered out by the client before being shown. So servers
641− // can omit computing them.
642− Only []CodeActionKind `json:"only,omitempty"`
643− // The reason why code actions were requested.
644− //
645− // @since 3.17.0
646− TriggerKind *CodeActionTriggerKind `json:"triggerKind,omitempty"`
647−}
648−
649−// Captures why the code action is currently disabled.
650−//
651−// @since 3.18.0
652−//
653−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeActionDisabled
654−type CodeActionDisabled struct {
655− // Human readable description of why the code action is currently disabled.
656− //
657− // This is displayed in the code actions UI.
658− Reason string `json:"reason"`
659−}
660−
661−// A set of predefined code action kinds
662−type CodeActionKind string
663−
664−// Documentation for a class of code actions.
665−//
666−// @since 3.18.0
667−// @proposed
668−//
669−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeActionKindDocumentation
670−type CodeActionKindDocumentation struct {
671− // The kind of the code action being documented.
672− //
673− // If the kind is generic, such as `CodeActionKind.Refactor`, the documentation will be shown whenever any
674− // refactorings are returned. If the kind if more specific, such as `CodeActionKind.RefactorExtract`, the
675− // documentation will only be shown when extract refactoring code actions are returned.
676− Kind CodeActionKind `json:"kind"`
677− // Command that is ued to display the documentation to the user.
678− //
679− // The title of this documentation code action is taken from {@linkcode Command.title}
680− Command Command `json:"command"`
681−}
682−
683−// Provider options for a {@link CodeActionRequest}.
684−//
685−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeActionOptions
686−type CodeActionOptions struct {
687− // CodeActionKinds that this server may return.
688− //
689− // The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server
690− // may list out every specific kind they provide.
691− CodeActionKinds []CodeActionKind `json:"codeActionKinds,omitempty"`
692− // Static documentation for a class of code actions.
693− //
694− // Documentation from the provider should be shown in the code actions menu if either:
695− //
696− //
697− // - Code actions of `kind` are requested by the editor. In this case, the editor will show the documentation that
698− // most closely matches the requested code action kind. For example, if a provider has documentation for
699− // both `Refactor` and `RefactorExtract`, when the user requests code actions for `RefactorExtract`,
700− // the editor will use the documentation for `RefactorExtract` instead of the documentation for `Refactor`.
701− //
702− //
703− // - Any code actions of `kind` are returned by the provider.
704− //
705− // At most one documentation entry should be shown per provider.
706− //
707− // @since 3.18.0
708− // @proposed
709− Documentation []CodeActionKindDocumentation `json:"documentation,omitempty"`
710− // The server provides support to resolve additional
711− // information for a code action.
712− //
713− // @since 3.16.0
714− ResolveProvider bool `json:"resolveProvider,omitempty"`
715− WorkDoneProgressOptions
716−}
717−
718−// The parameters of a {@link CodeActionRequest}.
719−//
720−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeActionParams
721−type CodeActionParams struct {
722− // The document in which the command was invoked.
723− TextDocument TextDocumentIdentifier `json:"textDocument"`
724− // The range for which the command was invoked.
725− Range Range `json:"range"`
726− // Context carrying additional information.
727− Context CodeActionContext `json:"context"`
728− WorkDoneProgressParams
729− PartialResultParams
730−}
731−
732−// Registration options for a {@link CodeActionRequest}.
733−//
734−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeActionRegistrationOptions
735−type CodeActionRegistrationOptions struct {
736− TextDocumentRegistrationOptions
737− CodeActionOptions
738−}
739−
740−// The reason why code actions were requested.
741−//
742−// @since 3.17.0
743−type CodeActionTriggerKind uint32
744−
745−// Structure to capture a description for an error code.
746−//
747−// @since 3.16.0
748−//
749−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeDescription
750−type CodeDescription struct {
751− // An URI to open with more information about the diagnostic error.
752− Href URI `json:"href"`
753−}
754−
755−// A code lens represents a {@link Command command} that should be shown along with
756−// source text, like the number of references, a way to run tests, etc.
757−//
758−// A code lens is _unresolved_ when no command is associated to it. For performance
759−// reasons the creation of a code lens and resolving should be done in two stages.
760−//
761−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeLens
762−type CodeLens struct {
763− // The range in which this code lens is valid. Should only span a single line.
764− Range Range `json:"range"`
765− // The command this code lens represents.
766− Command *Command `json:"command,omitempty"`
767− // A data entry field that is preserved on a code lens item between
768− // a {@link CodeLensRequest} and a {@link CodeLensResolveRequest}
769− Data interface{} `json:"data,omitempty"`
770−}
771−
772−// The client capabilities of a {@link CodeLensRequest}.
773−//
774−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeLensClientCapabilities
775−type CodeLensClientCapabilities struct {
776− // Whether code lens supports dynamic registration.
777− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
778− // Whether the client supports resolving additional code lens
779− // properties via a separate `codeLens/resolve` request.
780− //
781− // @since 3.18.0
782− ResolveSupport *ClientCodeLensResolveOptions `json:"resolveSupport,omitempty"`
783−}
784−
785−// Code Lens provider options of a {@link CodeLensRequest}.
786−//
787−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeLensOptions
788−type CodeLensOptions struct {
789− // Code lens has a resolve provider as well.
790− ResolveProvider bool `json:"resolveProvider,omitempty"`
791− WorkDoneProgressOptions
792−}
793−
794−// The parameters of a {@link CodeLensRequest}.
795−//
796−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeLensParams
797−type CodeLensParams struct {
798− // The document to request code lens for.
799− TextDocument TextDocumentIdentifier `json:"textDocument"`
800− WorkDoneProgressParams
801− PartialResultParams
802−}
803−
804−// Registration options for a {@link CodeLensRequest}.
805−//
806−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeLensRegistrationOptions
807−type CodeLensRegistrationOptions struct {
808− TextDocumentRegistrationOptions
809− CodeLensOptions
810−}
811−
812−// @since 3.16.0
813−//
814−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeLensWorkspaceClientCapabilities
815−type CodeLensWorkspaceClientCapabilities struct {
816− // Whether the client implementation supports a refresh request sent from the
817− // server to the client.
818− //
819− // Note that this event is global and will force the client to refresh all
820− // code lenses currently shown. It should be used with absolute care and is
821− // useful for situation where a server for example detect a project wide
822− // change that requires such a calculation.
823− RefreshSupport bool `json:"refreshSupport,omitempty"`
824−}
825−
826−// Represents a color in RGBA space.
827−//
828−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#color
829−type Color struct {
830− // The red component of this color in the range [0-1].
831− Red float64 `json:"red"`
832− // The green component of this color in the range [0-1].
833− Green float64 `json:"green"`
834− // The blue component of this color in the range [0-1].
835− Blue float64 `json:"blue"`
836− // The alpha component of this color in the range [0-1].
837− Alpha float64 `json:"alpha"`
838−}
839−
840−// Represents a color range from a document.
841−//
842−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#colorInformation
843−type ColorInformation struct {
844− // The range in the document where this color appears.
845− Range Range `json:"range"`
846− // The actual color value for this color range.
847− Color Color `json:"color"`
848−}
849−
850−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#colorPresentation
851−type ColorPresentation struct {
852− // The label of this color presentation. It will be shown on the color
853− // picker header. By default this is also the text that is inserted when selecting
854− // this color presentation.
855− Label string `json:"label"`
856− // An {@link TextEdit edit} which is applied to a document when selecting
857− // this presentation for the color. When `falsy` the {@link ColorPresentation.label label}
858− // is used.
859− TextEdit *TextEdit `json:"textEdit,omitempty"`
860− // An optional array of additional {@link TextEdit text edits} that are applied when
861− // selecting this color presentation. Edits must not overlap with the main {@link ColorPresentation.textEdit edit} nor with themselves.
862− AdditionalTextEdits []TextEdit `json:"additionalTextEdits,omitempty"`
863−}
864−
865−// Parameters for a {@link ColorPresentationRequest}.
866−//
867−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#colorPresentationParams
868−type ColorPresentationParams struct {
869− // The text document.
870− TextDocument TextDocumentIdentifier `json:"textDocument"`
871− // The color to request presentations for.
872− Color Color `json:"color"`
873− // The range where the color would be inserted. Serves as a context.
874− Range Range `json:"range"`
875− WorkDoneProgressParams
876− PartialResultParams
877−}
878−
879−// Represents a reference to a command. Provides a title which
880−// will be used to represent a command in the UI and, optionally,
881−// an array of arguments which will be passed to the command handler
882−// function when invoked.
883−//
884−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#command
885−type Command struct {
886− // Title of the command, like `save`.
887− Title string `json:"title"`
888− // An optional tooltip.
889− //
890− // @since 3.18.0
891− // @proposed
892− Tooltip string `json:"tooltip,omitempty"`
893− // The identifier of the actual command handler.
894− Command string `json:"command"`
895− // Arguments that the command handler should be
896− // invoked with.
897− Arguments []json.RawMessage `json:"arguments,omitempty"`
898−}
899−
900−// Completion client capabilities
901−//
902−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionClientCapabilities
903−type CompletionClientCapabilities struct {
904− // Whether completion supports dynamic registration.
905− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
906− // The client supports the following `CompletionItem` specific
907− // capabilities.
908− CompletionItem ClientCompletionItemOptions `json:"completionItem,omitempty"`
909− CompletionItemKind *ClientCompletionItemOptionsKind `json:"completionItemKind,omitempty"`
910− // Defines how the client handles whitespace and indentation
911− // when accepting a completion item that uses multi line
912− // text in either `insertText` or `textEdit`.
913− //
914− // @since 3.17.0
915− InsertTextMode InsertTextMode `json:"insertTextMode,omitempty"`
916− // The client supports to send additional context information for a
917− // `textDocument/completion` request.
918− ContextSupport bool `json:"contextSupport,omitempty"`
919− // The client supports the following `CompletionList` specific
920− // capabilities.
921− //
922− // @since 3.17.0
923− CompletionList *CompletionListCapabilities `json:"completionList,omitempty"`
924−}
925−
926−// Contains additional information about the context in which a completion request is triggered.
927−//
928−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionContext
929−type CompletionContext struct {
930− // How the completion was triggered.
931− TriggerKind CompletionTriggerKind `json:"triggerKind"`
932− // The trigger character (a single character) that has trigger code complete.
933− // Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter`
934− TriggerCharacter string `json:"triggerCharacter,omitempty"`
935−}
936−
937−// A completion item represents a text snippet that is
938−// proposed to complete text that is being typed.
939−//
940−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionItem
941−type CompletionItem struct {
942− // The label of this completion item.
943− //
944− // The label property is also by default the text that
945− // is inserted when selecting this completion.
946− //
947− // If label details are provided the label itself should
948− // be an unqualified name of the completion item.
949− Label string `json:"label"`
950− // Additional details for the label
951− //
952− // @since 3.17.0
953− LabelDetails *CompletionItemLabelDetails `json:"labelDetails,omitempty"`
954− // The kind of this completion item. Based of the kind
955− // an icon is chosen by the editor.
956− Kind CompletionItemKind `json:"kind,omitempty"`
957− // Tags for this completion item.
958− //
959− // @since 3.15.0
960− Tags []CompletionItemTag `json:"tags,omitempty"`
961− // A human-readable string with additional information
962− // about this item, like type or symbol information.
963− Detail string `json:"detail,omitempty"`
964− // A human-readable string that represents a doc-comment.
965− Documentation *Or_CompletionItem_documentation `json:"documentation,omitempty"`
966− // Indicates if this item is deprecated.
967− // @deprecated Use `tags` instead.
968− Deprecated bool `json:"deprecated,omitempty"`
969− // Select this item when showing.
970− //
971− // *Note* that only one completion item can be selected and that the
972− // tool / client decides which item that is. The rule is that the *first*
973− // item of those that match best is selected.
974− Preselect bool `json:"preselect,omitempty"`
975− // A string that should be used when comparing this item
976− // with other items. When `falsy` the {@link CompletionItem.label label}
977− // is used.
978− SortText string `json:"sortText,omitempty"`
979− // A string that should be used when filtering a set of
980− // completion items. When `falsy` the {@link CompletionItem.label label}
981− // is used.
982− FilterText string `json:"filterText,omitempty"`
983− // A string that should be inserted into a document when selecting
984− // this completion. When `falsy` the {@link CompletionItem.label label}
985− // is used.
986− //
987− // The `insertText` is subject to interpretation by the client side.
988− // Some tools might not take the string literally. For example
989− // VS Code when code complete is requested in this example
990− // `con<cursor position>` and a completion item with an `insertText` of
991− // `console` is provided it will only insert `sole`. Therefore it is
992− // recommended to use `textEdit` instead since it avoids additional client
993− // side interpretation.
994− InsertText string `json:"insertText,omitempty"`
995− // The format of the insert text. The format applies to both the
996− // `insertText` property and the `newText` property of a provided
997− // `textEdit`. If omitted defaults to `InsertTextFormat.PlainText`.
998− //
999− // Please note that the insertTextFormat doesn't apply to
1000− // `additionalTextEdits`.
1001− InsertTextFormat *InsertTextFormat `json:"insertTextFormat,omitempty"`
1002− // How whitespace and indentation is handled during completion
1003− // item insertion. If not provided the clients default value depends on
1004− // the `textDocument.completion.insertTextMode` client capability.
1005− //
1006− // @since 3.16.0
1007− InsertTextMode *InsertTextMode `json:"insertTextMode,omitempty"`
1008− // An {@link TextEdit edit} which is applied to a document when selecting
1009− // this completion. When an edit is provided the value of
1010− // {@link CompletionItem.insertText insertText} is ignored.
1011− //
1012− // Most editors support two different operations when accepting a completion
1013− // item. One is to insert a completion text and the other is to replace an
1014− // existing text with a completion text. Since this can usually not be
1015− // predetermined by a server it can report both ranges. Clients need to
1016− // signal support for `InsertReplaceEdits` via the
1017− // `textDocument.completion.insertReplaceSupport` client capability
1018− // property.
1019− //
1020− // *Note 1:* The text edit's range as well as both ranges from an insert
1021− // replace edit must be a [single line] and they must contain the position
1022− // at which completion has been requested.
1023− // *Note 2:* If an `InsertReplaceEdit` is returned the edit's insert range
1024− // must be a prefix of the edit's replace range, that means it must be
1025− // contained and starting at the same position.
1026− //
1027− // @since 3.16.0 additional type `InsertReplaceEdit`
1028− TextEdit *Or_CompletionItem_textEdit `json:"textEdit,omitempty"`
1029− // The edit text used if the completion item is part of a CompletionList and
1030− // CompletionList defines an item default for the text edit range.
1031− //
1032− // Clients will only honor this property if they opt into completion list
1033− // item defaults using the capability `completionList.itemDefaults`.
1034− //
1035− // If not provided and a list's default range is provided the label
1036− // property is used as a text.
1037− //
1038− // @since 3.17.0
1039− TextEditText string `json:"textEditText,omitempty"`
1040− // An optional array of additional {@link TextEdit text edits} that are applied when
1041− // selecting this completion. Edits must not overlap (including the same insert position)
1042− // with the main {@link CompletionItem.textEdit edit} nor with themselves.
1043− //
1044− // Additional text edits should be used to change text unrelated to the current cursor position
1045− // (for example adding an import statement at the top of the file if the completion item will
1046− // insert an unqualified type).
1047− AdditionalTextEdits []TextEdit `json:"additionalTextEdits,omitempty"`
1048− // An optional set of characters that when pressed while this completion is active will accept it first and
1049− // then type that character. *Note* that all commit characters should have `length=1` and that superfluous
1050− // characters will be ignored.
1051− CommitCharacters []string `json:"commitCharacters,omitempty"`
1052− // An optional {@link Command command} that is executed *after* inserting this completion. *Note* that
1053− // additional modifications to the current document should be described with the
1054− // {@link CompletionItem.additionalTextEdits additionalTextEdits}-property.
1055− Command *Command `json:"command,omitempty"`
1056− // A data entry field that is preserved on a completion item between a
1057− // {@link CompletionRequest} and a {@link CompletionResolveRequest}.
1058− Data interface{} `json:"data,omitempty"`
1059−}
1060−
1061−// In many cases the items of an actual completion result share the same
1062−// value for properties like `commitCharacters` or the range of a text
1063−// edit. A completion list can therefore define item defaults which will
1064−// be used if a completion item itself doesn't specify the value.
1065−//
1066−// If a completion list specifies a default value and a completion item
1067−// also specifies a corresponding value the one from the item is used.
1068−//
1069−// Servers are only allowed to return default values if the client
1070−// signals support for this via the `completionList.itemDefaults`
1071−// capability.
1072−//
1073−// @since 3.17.0
1074−//
1075−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionItemDefaults
1076−type CompletionItemDefaults struct {
1077− // A default commit character set.
1078− //
1079− // @since 3.17.0
1080− CommitCharacters []string `json:"commitCharacters,omitempty"`
1081− // A default edit range.
1082− //
1083− // @since 3.17.0
1084− EditRange *Or_CompletionItemDefaults_editRange `json:"editRange,omitempty"`
1085− // A default insert text format.
1086− //
1087− // @since 3.17.0
1088− InsertTextFormat *InsertTextFormat `json:"insertTextFormat,omitempty"`
1089− // A default insert text mode.
1090− //
1091− // @since 3.17.0
1092− InsertTextMode *InsertTextMode `json:"insertTextMode,omitempty"`
1093− // A default data value.
1094− //
1095− // @since 3.17.0
1096− Data interface{} `json:"data,omitempty"`
1097−}
1098−
1099−// The kind of a completion entry.
1100−type CompletionItemKind uint32
1101−
1102−// Additional details for a completion item label.
1103−//
1104−// @since 3.17.0
1105−//
1106−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionItemLabelDetails
1107−type CompletionItemLabelDetails struct {
1108− // An optional string which is rendered less prominently directly after {@link CompletionItem.label label},
1109− // without any spacing. Should be used for function signatures and type annotations.
1110− Detail string `json:"detail,omitempty"`
1111− // An optional string which is rendered less prominently after {@link CompletionItem.detail}. Should be used
1112− // for fully qualified names and file paths.
1113− Description string `json:"description,omitempty"`
1114−}
1115−
1116−// Completion item tags are extra annotations that tweak the rendering of a completion
1117−// item.
1118−//
1119−// @since 3.15.0
1120−type CompletionItemTag uint32
1121−
1122−// @since 3.18.0
1123−//
1124−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionItemTagOptions
1125−type CompletionItemTagOptions struct {
1126− // The tags supported by the client.
1127− ValueSet []CompletionItemTag `json:"valueSet"`
1128−}
1129−
1130−// Represents a collection of {@link CompletionItem completion items} to be presented
1131−// in the editor.
1132−//
1133−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionList
1134−type CompletionList struct {
1135− // This list it not complete. Further typing results in recomputing this list.
1136− //
1137− // Recomputed lists have all their items replaced (not appended) in the
1138− // incomplete completion sessions.
1139− IsIncomplete bool `json:"isIncomplete"`
1140− // In many cases the items of an actual completion result share the same
1141− // value for properties like `commitCharacters` or the range of a text
1142− // edit. A completion list can therefore define item defaults which will
1143− // be used if a completion item itself doesn't specify the value.
1144− //
1145− // If a completion list specifies a default value and a completion item
1146− // also specifies a corresponding value the one from the item is used.
1147− //
1148− // Servers are only allowed to return default values if the client
1149− // signals support for this via the `completionList.itemDefaults`
1150− // capability.
1151− //
1152− // @since 3.17.0
1153− ItemDefaults *CompletionItemDefaults `json:"itemDefaults,omitempty"`
1154− // The completion items.
1155− Items []CompletionItem `json:"items"`
1156−}
1157−
1158−// The client supports the following `CompletionList` specific
1159−// capabilities.
1160−//
1161−// @since 3.17.0
1162−//
1163−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionListCapabilities
1164−type CompletionListCapabilities struct {
1165− // The client supports the following itemDefaults on
1166− // a completion list.
1167− //
1168− // The value lists the supported property names of the
1169− // `CompletionList.itemDefaults` object. If omitted
1170− // no properties are supported.
1171− //
1172− // @since 3.17.0
1173− ItemDefaults []string `json:"itemDefaults,omitempty"`
1174−}
1175−
1176−// Completion options.
1177−//
1178−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionOptions
1179−type CompletionOptions struct {
1180− // Most tools trigger completion request automatically without explicitly requesting
1181− // it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user
1182− // starts to type an identifier. For example if the user types `c` in a JavaScript file
1183− // code complete will automatically pop up present `console` besides others as a
1184− // completion item. Characters that make up identifiers don't need to be listed here.
1185− //
1186− // If code complete should automatically be trigger on characters not being valid inside
1187− // an identifier (for example `.` in JavaScript) list them in `triggerCharacters`.
1188− TriggerCharacters []string `json:"triggerCharacters,omitempty"`
1189− // The list of all possible characters that commit a completion. This field can be used
1190− // if clients don't support individual commit characters per completion item. See
1191− // `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport`
1192− //
1193− // If a server provides both `allCommitCharacters` and commit characters on an individual
1194− // completion item the ones on the completion item win.
1195− //
1196− // @since 3.2.0
1197− AllCommitCharacters []string `json:"allCommitCharacters,omitempty"`
1198− // The server provides support to resolve additional
1199− // information for a completion item.
1200− ResolveProvider bool `json:"resolveProvider,omitempty"`
1201− // The server supports the following `CompletionItem` specific
1202− // capabilities.
1203− //
1204− // @since 3.17.0
1205− CompletionItem *ServerCompletionItemOptions `json:"completionItem,omitempty"`
1206− WorkDoneProgressOptions
1207−}
1208−
1209−// Completion parameters
1210−//
1211−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionParams
1212−type CompletionParams struct {
1213− // The completion context. This is only available it the client specifies
1214− // to send this using the client capability `textDocument.completion.contextSupport === true`
1215− Context CompletionContext `json:"context,omitempty"`
1216− TextDocumentPositionParams
1217− WorkDoneProgressParams
1218− PartialResultParams
1219−}
1220−
1221−// Registration options for a {@link CompletionRequest}.
1222−//
1223−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionRegistrationOptions
1224−type CompletionRegistrationOptions struct {
1225− TextDocumentRegistrationOptions
1226− CompletionOptions
1227−}
1228−
1229−// How a completion was triggered
1230−type CompletionTriggerKind uint32
1231−
1232−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#configurationItem
1233−type ConfigurationItem struct {
1234− // The scope to get the configuration section for.
1235− ScopeURI *URI `json:"scopeUri,omitempty"`
1236− // The configuration section asked for.
1237− Section string `json:"section,omitempty"`
1238−}
1239−
1240−// The parameters of a configuration request.
1241−//
1242−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#configurationParams
1243−type ConfigurationParams struct {
1244− Items []ConfigurationItem `json:"items"`
1245−}
1246−
1247−// Create file operation.
1248−//
1249−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#createFile
1250−type CreateFile struct {
1251− // A create
1252− Kind string `json:"kind"`
1253− // The resource to create.
1254− URI DocumentURI `json:"uri"`
1255− // Additional options
1256− Options *CreateFileOptions `json:"options,omitempty"`
1257− ResourceOperation
1258−}
1259−
1260−// Options to create a file.
1261−//
1262−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#createFileOptions
1263−type CreateFileOptions struct {
1264− // Overwrite existing file. Overwrite wins over `ignoreIfExists`
1265− Overwrite bool `json:"overwrite,omitempty"`
1266− // Ignore if exists.
1267− IgnoreIfExists bool `json:"ignoreIfExists,omitempty"`
1268−}
1269−
1270−// The parameters sent in notifications/requests for user-initiated creation of
1271−// files.
1272−//
1273−// @since 3.16.0
1274−//
1275−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#createFilesParams
1276−type CreateFilesParams struct {
1277− // An array of all files/folders created in this operation.
1278− Files []FileCreate `json:"files"`
1279−}
1280−
1281−// The declaration of a symbol representation as one or many {@link Location locations}.
1282−//
1283−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#declaration
1284−type (
1285− Declaration = Or_Declaration // (alias)
1286− // @since 3.14.0
1287− //
1288− // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#declarationClientCapabilities
1289− DeclarationClientCapabilities struct {
1290− // Whether declaration supports dynamic registration. If this is set to `true`
1291− // the client supports the new `DeclarationRegistrationOptions` return value
1292− // for the corresponding server capability as well.
1293− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
1294− // The client supports additional metadata in the form of declaration links.
1295− LinkSupport bool `json:"linkSupport,omitempty"`
1296− }
1297−)
1298−
1299−// Information about where a symbol is declared.
1300−//
1301−// Provides additional metadata over normal {@link Location location} declarations, including the range of
1302−// the declaring symbol.
1303−//
1304−// Servers should prefer returning `DeclarationLink` over `Declaration` if supported
1305−// by the client.
1306−//
1307−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#declarationLink
1308−type (
1309− DeclarationLink = LocationLink // (alias)
1310− // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#declarationOptions
1311− DeclarationOptions struct {
1312− WorkDoneProgressOptions
1313− }
1314−)
1315−
1316−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#declarationParams
1317−type DeclarationParams struct {
1318− TextDocumentPositionParams
1319− WorkDoneProgressParams
1320− PartialResultParams
1321−}
1322−
1323−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#declarationRegistrationOptions
1324−type DeclarationRegistrationOptions struct {
1325− DeclarationOptions
1326− TextDocumentRegistrationOptions
1327− StaticRegistrationOptions
1328−}
1329−
1330−// The definition of a symbol represented as one or many {@link Location locations}.
1331−// For most programming languages there is only one location at which a symbol is
1332−// defined.
1333−//
1334−// Servers should prefer returning `DefinitionLink` over `Definition` if supported
1335−// by the client.
1336−//
1337−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#definition
1338−type (
1339− Definition = Or_Definition // (alias)
1340− // Client Capabilities for a {@link DefinitionRequest}.
1341− //
1342− // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#definitionClientCapabilities
1343− DefinitionClientCapabilities struct {
1344− // Whether definition supports dynamic registration.
1345− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
1346− // The client supports additional metadata in the form of definition links.
1347− //
1348− // @since 3.14.0
1349− LinkSupport bool `json:"linkSupport,omitempty"`
1350− }
1351−)
1352−
1353−// Information about where a symbol is defined.
1354−//
1355−// Provides additional metadata over normal {@link Location location} definitions, including the range of
1356−// the defining symbol
1357−//
1358−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#definitionLink
1359−type (
1360− DefinitionLink = LocationLink // (alias)
1361− // Server Capabilities for a {@link DefinitionRequest}.
1362− //
1363− // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#definitionOptions
1364− DefinitionOptions struct {
1365− WorkDoneProgressOptions
1366− }
1367−)
1368−
1369−// Parameters for a {@link DefinitionRequest}.
1370−//
1371−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#definitionParams
1372−type DefinitionParams struct {
1373− TextDocumentPositionParams
1374− WorkDoneProgressParams
1375− PartialResultParams
1376−}
1377−
1378−// Registration options for a {@link DefinitionRequest}.
1379−//
1380−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#definitionRegistrationOptions
1381−type DefinitionRegistrationOptions struct {
1382− TextDocumentRegistrationOptions
1383− DefinitionOptions
1384−}
1385−
1386−// Delete file operation
1387−//
1388−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#deleteFile
1389−type DeleteFile struct {
1390− // A delete
1391− Kind string `json:"kind"`
1392− // The file to delete.
1393− URI DocumentURI `json:"uri"`
1394− // Delete options.
1395− Options *DeleteFileOptions `json:"options,omitempty"`
1396− ResourceOperation
1397−}
1398−
1399−// Delete file options
1400−//
1401−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#deleteFileOptions
1402−type DeleteFileOptions struct {
1403− // Delete the content recursively if a folder is denoted.
1404− Recursive bool `json:"recursive,omitempty"`
1405− // Ignore the operation if the file doesn't exist.
1406− IgnoreIfNotExists bool `json:"ignoreIfNotExists,omitempty"`
1407−}
1408−
1409−// The parameters sent in notifications/requests for user-initiated deletes of
1410−// files.
1411−//
1412−// @since 3.16.0
1413−//
1414−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#deleteFilesParams
1415−type DeleteFilesParams struct {
1416− // An array of all files/folders deleted in this operation.
1417− Files []FileDelete `json:"files"`
1418−}
1419−
1420−// Represents a diagnostic, such as a compiler error or warning. Diagnostic objects
1421−// are only valid in the scope of a resource.
1422−//
1423−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#diagnostic
1424−type Diagnostic struct {
1425− // The range at which the message applies
1426− Range Range `json:"range"`
1427− // The diagnostic's severity. To avoid interpretation mismatches when a
1428− // server is used with different clients it is highly recommended that servers
1429− // always provide a severity value.
1430− Severity DiagnosticSeverity `json:"severity,omitempty"`
1431− // The diagnostic's code, which usually appear in the user interface.
1432− Code interface{} `json:"code,omitempty"`
1433− // An optional property to describe the error code.
1434− // Requires the code field (above) to be present/not null.
1435− //
1436− // @since 3.16.0
1437− CodeDescription *CodeDescription `json:"codeDescription,omitempty"`
1438− // A human-readable string describing the source of this
1439− // diagnostic, e.g. 'typescript' or 'super lint'. It usually
1440− // appears in the user interface.
1441− Source string `json:"source,omitempty"`
1442− // The diagnostic's message. It usually appears in the user interface
1443− Message string `json:"message"`
1444− // Additional metadata about the diagnostic.
1445− //
1446− // @since 3.15.0
1447− Tags []DiagnosticTag `json:"tags,omitempty"`
1448− // An array of related diagnostic information, e.g. when symbol-names within
1449− // a scope collide all definitions can be marked via this property.
1450− RelatedInformation []DiagnosticRelatedInformation `json:"relatedInformation,omitempty"`
1451− // A data entry field that is preserved between a `textDocument/publishDiagnostics`
1452− // notification and `textDocument/codeAction` request.
1453− //
1454− // @since 3.16.0
1455− Data *json.RawMessage `json:"data,omitempty"`
1456−}
1457−
1458−// Client capabilities specific to diagnostic pull requests.
1459−//
1460−// @since 3.17.0
1461−//
1462−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#diagnosticClientCapabilities
1463−type DiagnosticClientCapabilities struct {
1464− // Whether implementation supports dynamic registration. If this is set to `true`
1465− // the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
1466− // return value for the corresponding server capability as well.
1467− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
1468− // Whether the clients supports related documents for document diagnostic pulls.
1469− RelatedDocumentSupport bool `json:"relatedDocumentSupport,omitempty"`
1470− DiagnosticsCapabilities
1471−}
1472−
1473−// Diagnostic options.
1474−//
1475−// @since 3.17.0
1476−//
1477−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#diagnosticOptions
1478−type DiagnosticOptions struct {
1479− // An optional identifier under which the diagnostics are
1480− // managed by the client.
1481− Identifier string `json:"identifier,omitempty"`
1482− // Whether the language has inter file dependencies meaning that
1483− // editing code in one file can result in a different diagnostic
1484− // set in another file. Inter file dependencies are common for
1485− // most programming languages and typically uncommon for linters.
1486− InterFileDependencies bool `json:"interFileDependencies"`
1487− // The server provides support for workspace diagnostics as well.
1488− WorkspaceDiagnostics bool `json:"workspaceDiagnostics"`
1489− WorkDoneProgressOptions
1490−}
1491−
1492−// Diagnostic registration options.
1493−//
1494−// @since 3.17.0
1495−//
1496−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#diagnosticRegistrationOptions
1497−type DiagnosticRegistrationOptions struct {
1498− TextDocumentRegistrationOptions
1499− DiagnosticOptions
1500− StaticRegistrationOptions
1501−}
1502−
1503−// Represents a related message and source code location for a diagnostic. This should be
1504−// used to point to code locations that cause or related to a diagnostics, e.g when duplicating
1505−// a symbol in a scope.
1506−//
1507−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#diagnosticRelatedInformation
1508−type DiagnosticRelatedInformation struct {
1509− // The location of this related diagnostic information.
1510− Location Location `json:"location"`
1511− // The message of this related diagnostic information.
1512− Message string `json:"message"`
1513−}
1514−
1515−// Cancellation data returned from a diagnostic request.
1516−//
1517−// @since 3.17.0
1518−//
1519−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#diagnosticServerCancellationData
1520−type DiagnosticServerCancellationData struct {
1521− RetriggerRequest bool `json:"retriggerRequest"`
1522−}
1523−
1524−// The diagnostic's severity.
1525−type DiagnosticSeverity uint32
1526−
1527−// The diagnostic tags.
1528−//
1529−// @since 3.15.0
1530−type DiagnosticTag uint32
1531−
1532−// Workspace client capabilities specific to diagnostic pull requests.
1533−//
1534−// @since 3.17.0
1535−//
1536−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#diagnosticWorkspaceClientCapabilities
1537−type DiagnosticWorkspaceClientCapabilities struct {
1538− // Whether the client implementation supports a refresh request sent from
1539− // the server to the client.
1540− //
1541− // Note that this event is global and will force the client to refresh all
1542− // pulled diagnostics currently shown. It should be used with absolute care and
1543− // is useful for situation where a server for example detects a project wide
1544− // change that requires such a calculation.
1545− RefreshSupport bool `json:"refreshSupport,omitempty"`
1546−}
1547−
1548−// General diagnostics capabilities for pull and push model.
1549−//
1550−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#diagnosticsCapabilities
1551−type DiagnosticsCapabilities struct {
1552− // Whether the clients accepts diagnostics with related information.
1553− RelatedInformation bool `json:"relatedInformation,omitempty"`
1554− // Client supports the tag property to provide meta data about a diagnostic.
1555− // Clients supporting tags have to handle unknown tags gracefully.
1556− //
1557− // @since 3.15.0
1558− TagSupport *ClientDiagnosticsTagOptions `json:"tagSupport,omitempty"`
1559− // Client supports a codeDescription property
1560− //
1561− // @since 3.16.0
1562− CodeDescriptionSupport bool `json:"codeDescriptionSupport,omitempty"`
1563− // Whether code action supports the `data` property which is
1564− // preserved between a `textDocument/publishDiagnostics` and
1565− // `textDocument/codeAction` request.
1566− //
1567− // @since 3.16.0
1568− DataSupport bool `json:"dataSupport,omitempty"`
1569−}
1570−
1571−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didChangeConfigurationClientCapabilities
1572−type DidChangeConfigurationClientCapabilities struct {
1573− // Did change configuration notification supports dynamic registration.
1574− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
1575−}
1576−
1577−// The parameters of a change configuration notification.
1578−//
1579−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didChangeConfigurationParams
1580−type DidChangeConfigurationParams struct {
1581− // The actual changed settings
1582− Settings interface{} `json:"settings"`
1583−}
1584−
1585−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didChangeConfigurationRegistrationOptions
1586−type DidChangeConfigurationRegistrationOptions struct {
1587− Section *Or_DidChangeConfigurationRegistrationOptions_section `json:"section,omitempty"`
1588−}
1589−
1590−// The params sent in a change notebook document notification.
1591−//
1592−// @since 3.17.0
1593−//
1594−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didChangeNotebookDocumentParams
1595−type DidChangeNotebookDocumentParams struct {
1596− // The notebook document that did change. The version number points
1597− // to the version after all provided changes have been applied. If
1598− // only the text document content of a cell changes the notebook version
1599− // doesn't necessarily have to change.
1600− NotebookDocument VersionedNotebookDocumentIdentifier `json:"notebookDocument"`
1601− // The actual changes to the notebook document.
1602− //
1603− // The changes describe single state changes to the notebook document.
1604− // So if there are two changes c1 (at array index 0) and c2 (at array
1605− // index 1) for a notebook in state S then c1 moves the notebook from
1606− // S to S' and c2 from S' to S''. So c1 is computed on the state S and
1607− // c2 is computed on the state S'.
1608− //
1609− // To mirror the content of a notebook using change events use the following approach:
1610− //
1611− // - start with the same initial content
1612− // - apply the 'notebookDocument/didChange' notifications in the order you receive them.
1613− // - apply the `NotebookChangeEvent`s in a single notification in the order
1614− // you receive them.
1615− Change NotebookDocumentChangeEvent `json:"change"`
1616−}
1617−
1618−// The change text document notification's parameters.
1619−//
1620−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didChangeTextDocumentParams
1621−type DidChangeTextDocumentParams struct {
1622− // The document that did change. The version number points
1623− // to the version after all provided content changes have
1624− // been applied.
1625− TextDocument VersionedTextDocumentIdentifier `json:"textDocument"`
1626− // The actual content changes. The content changes describe single state changes
1627− // to the document. So if there are two content changes c1 (at array index 0) and
1628− // c2 (at array index 1) for a document in state S then c1 moves the document from
1629− // S to S' and c2 from S' to S''. So c1 is computed on the state S and c2 is computed
1630− // on the state S'.
1631− //
1632− // To mirror the content of a document using change events use the following approach:
1633− //
1634− // - start with the same initial content
1635− // - apply the 'textDocument/didChange' notifications in the order you receive them.
1636− // - apply the `TextDocumentContentChangeEvent`s in a single notification in the order
1637− // you receive them.
1638− ContentChanges []TextDocumentContentChangeEvent `json:"contentChanges"`
1639−}
1640−
1641−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didChangeWatchedFilesClientCapabilities
1642−type DidChangeWatchedFilesClientCapabilities struct {
1643− // Did change watched files notification supports dynamic registration. Please note
1644− // that the current protocol doesn't support static configuration for file changes
1645− // from the server side.
1646− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
1647− // Whether the client has support for {@link RelativePattern relative pattern}
1648− // or not.
1649− //
1650− // @since 3.17.0
1651− RelativePatternSupport bool `json:"relativePatternSupport,omitempty"`
1652−}
1653−
1654−// The watched files change notification's parameters.
1655−//
1656−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didChangeWatchedFilesParams
1657−type DidChangeWatchedFilesParams struct {
1658− // The actual file events.
1659− Changes []FileEvent `json:"changes"`
1660−}
1661−
1662−// Describe options to be used when registered for text document change events.
1663−//
1664−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didChangeWatchedFilesRegistrationOptions
1665−type DidChangeWatchedFilesRegistrationOptions struct {
1666− // The watchers to register.
1667− Watchers []FileSystemWatcher `json:"watchers"`
1668−}
1669−
1670−// The parameters of a `workspace/didChangeWorkspaceFolders` notification.
1671−//
1672−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didChangeWorkspaceFoldersParams
1673−type DidChangeWorkspaceFoldersParams struct {
1674− // The actual workspace folder change event.
1675− Event WorkspaceFoldersChangeEvent `json:"event"`
1676−}
1677−
1678−// The params sent in a close notebook document notification.
1679−//
1680−// @since 3.17.0
1681−//
1682−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didCloseNotebookDocumentParams
1683−type DidCloseNotebookDocumentParams struct {
1684− // The notebook document that got closed.
1685− NotebookDocument NotebookDocumentIdentifier `json:"notebookDocument"`
1686− // The text documents that represent the content
1687− // of a notebook cell that got closed.
1688− CellTextDocuments []TextDocumentIdentifier `json:"cellTextDocuments"`
1689−}
1690−
1691−// The parameters sent in a close text document notification
1692−//
1693−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didCloseTextDocumentParams
1694−type DidCloseTextDocumentParams struct {
1695− // The document that was closed.
1696− TextDocument TextDocumentIdentifier `json:"textDocument"`
1697−}
1698−
1699−// The params sent in an open notebook document notification.
1700−//
1701−// @since 3.17.0
1702−//
1703−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didOpenNotebookDocumentParams
1704−type DidOpenNotebookDocumentParams struct {
1705− // The notebook document that got opened.
1706− NotebookDocument NotebookDocument `json:"notebookDocument"`
1707− // The text documents that represent the content
1708− // of a notebook cell.
1709− CellTextDocuments []TextDocumentItem `json:"cellTextDocuments"`
1710−}
1711−
1712−// The parameters sent in an open text document notification
1713−//
1714−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didOpenTextDocumentParams
1715−type DidOpenTextDocumentParams struct {
1716− // The document that was opened.
1717− TextDocument TextDocumentItem `json:"textDocument"`
1718−}
1719−
1720−// The params sent in a save notebook document notification.
1721−//
1722−// @since 3.17.0
1723−//
1724−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didSaveNotebookDocumentParams
1725−type DidSaveNotebookDocumentParams struct {
1726− // The notebook document that got saved.
1727− NotebookDocument NotebookDocumentIdentifier `json:"notebookDocument"`
1728−}
1729−
1730−// The parameters sent in a save text document notification
1731−//
1732−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didSaveTextDocumentParams
1733−type DidSaveTextDocumentParams struct {
1734− // The document that was saved.
1735− TextDocument TextDocumentIdentifier `json:"textDocument"`
1736− // Optional the content when saved. Depends on the includeText value
1737− // when the save notification was requested.
1738− Text *string `json:"text,omitempty"`
1739−}
1740−
1741−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentColorClientCapabilities
1742−type DocumentColorClientCapabilities struct {
1743− // Whether implementation supports dynamic registration. If this is set to `true`
1744− // the client supports the new `DocumentColorRegistrationOptions` return value
1745− // for the corresponding server capability as well.
1746− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
1747−}
1748−
1749−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentColorOptions
1750−type DocumentColorOptions struct {
1751− WorkDoneProgressOptions
1752−}
1753−
1754−// Parameters for a {@link DocumentColorRequest}.
1755−//
1756−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentColorParams
1757−type DocumentColorParams struct {
1758− // The text document.
1759− TextDocument TextDocumentIdentifier `json:"textDocument"`
1760− WorkDoneProgressParams
1761− PartialResultParams
1762−}
1763−
1764−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentColorRegistrationOptions
1765−type DocumentColorRegistrationOptions struct {
1766− TextDocumentRegistrationOptions
1767− DocumentColorOptions
1768− StaticRegistrationOptions
1769−}
1770−
1771−// Parameters of the document diagnostic request.
1772−//
1773−// @since 3.17.0
1774−//
1775−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentDiagnosticParams
1776−type DocumentDiagnosticParams struct {
1777− // The text document.
1778− TextDocument TextDocumentIdentifier `json:"textDocument"`
1779− // The additional identifier provided during registration.
1780− Identifier string `json:"identifier,omitempty"`
1781− // The result id of a previous response if provided.
1782− PreviousResultID string `json:"previousResultId,omitempty"`
1783− WorkDoneProgressParams
1784− PartialResultParams
1785−}
1786−
1787−// The result of a document diagnostic pull request. A report can
1788−// either be a full report containing all diagnostics for the
1789−// requested document or an unchanged report indicating that nothing
1790−// has changed in terms of diagnostics in comparison to the last
1791−// pull request.
1792−//
1793−// @since 3.17.0
1794−//
1795−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentDiagnosticReport
1796−type (
1797− DocumentDiagnosticReport = Or_DocumentDiagnosticReport // (alias)
1798− // The document diagnostic report kinds.
1799− //
1800− // @since 3.17.0
1801− DocumentDiagnosticReportKind string
1802−)
1803−
1804−// A partial result for a document diagnostic report.
1805−//
1806−// @since 3.17.0
1807−//
1808−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentDiagnosticReportPartialResult
1809−type DocumentDiagnosticReportPartialResult struct {
1810− RelatedDocuments map[DocumentURI]interface{} `json:"relatedDocuments"`
1811−}
1812−
1813−// A document filter describes a top level text document or
1814−// a notebook cell document.
1815−//
1816−// @since 3.17.0 - proposed support for NotebookCellTextDocumentFilter.
1817−//
1818−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentFilter
1819−type (
1820− DocumentFilter = Or_DocumentFilter // (alias)
1821− // Client capabilities of a {@link DocumentFormattingRequest}.
1822− //
1823− // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentFormattingClientCapabilities
1824− DocumentFormattingClientCapabilities struct {
1825− // Whether formatting supports dynamic registration.
1826− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
1827− }
1828−)
1829−
1830−// Provider options for a {@link DocumentFormattingRequest}.
1831−//
1832−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentFormattingOptions
1833−type DocumentFormattingOptions struct {
1834− WorkDoneProgressOptions
1835−}
1836−
1837−// The parameters of a {@link DocumentFormattingRequest}.
1838−//
1839−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentFormattingParams
1840−type DocumentFormattingParams struct {
1841− // The document to format.
1842− TextDocument TextDocumentIdentifier `json:"textDocument"`
1843− // The format options.
1844− Options FormattingOptions `json:"options"`
1845− WorkDoneProgressParams
1846−}
1847−
1848−// Registration options for a {@link DocumentFormattingRequest}.
1849−//
1850−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentFormattingRegistrationOptions
1851−type DocumentFormattingRegistrationOptions struct {
1852− TextDocumentRegistrationOptions
1853− DocumentFormattingOptions
1854−}
1855−
1856−// A document highlight is a range inside a text document which deserves
1857−// special attention. Usually a document highlight is visualized by changing
1858−// the background color of its range.
1859−//
1860−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentHighlight
1861−type DocumentHighlight struct {
1862− // The range this highlight applies to.
1863− Range Range `json:"range"`
1864− // The highlight kind, default is {@link DocumentHighlightKind.Text text}.
1865− Kind DocumentHighlightKind `json:"kind,omitempty"`
1866−}
1867−
1868−// Client Capabilities for a {@link DocumentHighlightRequest}.
1869−//
1870−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentHighlightClientCapabilities
1871−type DocumentHighlightClientCapabilities struct {
1872− // Whether document highlight supports dynamic registration.
1873− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
1874−}
1875−
1876−// A document highlight kind.
1877−type DocumentHighlightKind uint32
1878−
1879−// Provider options for a {@link DocumentHighlightRequest}.
1880−//
1881−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentHighlightOptions
1882−type DocumentHighlightOptions struct {
1883− WorkDoneProgressOptions
1884−}
1885−
1886−// Parameters for a {@link DocumentHighlightRequest}.
1887−//
1888−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentHighlightParams
1889−type DocumentHighlightParams struct {
1890− TextDocumentPositionParams
1891− WorkDoneProgressParams
1892− PartialResultParams
1893−}
1894−
1895−// Registration options for a {@link DocumentHighlightRequest}.
1896−//
1897−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentHighlightRegistrationOptions
1898−type DocumentHighlightRegistrationOptions struct {
1899− TextDocumentRegistrationOptions
1900− DocumentHighlightOptions
1901−}
1902−
1903−// A document link is a range in a text document that links to an internal or external resource, like another
1904−// text document or a web site.
1905−//
1906−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentLink
1907−type DocumentLink struct {
1908− // The range this link applies to.
1909− Range Range `json:"range"`
1910− // The uri this link points to. If missing a resolve request is sent later.
1911− Target *URI `json:"target,omitempty"`
1912− // The tooltip text when you hover over this link.
1913− //
1914− // If a tooltip is provided, is will be displayed in a string that includes instructions on how to
1915− // trigger the link, such as `{0} (ctrl + click)`. The specific instructions vary depending on OS,
1916− // user settings, and localization.
1917− //
1918− // @since 3.15.0
1919− Tooltip string `json:"tooltip,omitempty"`
1920− // A data entry field that is preserved on a document link between a
1921− // DocumentLinkRequest and a DocumentLinkResolveRequest.
1922− Data interface{} `json:"data,omitempty"`
1923−}
1924−
1925−// The client capabilities of a {@link DocumentLinkRequest}.
1926−//
1927−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentLinkClientCapabilities
1928−type DocumentLinkClientCapabilities struct {
1929− // Whether document link supports dynamic registration.
1930− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
1931− // Whether the client supports the `tooltip` property on `DocumentLink`.
1932− //
1933− // @since 3.15.0
1934− TooltipSupport bool `json:"tooltipSupport,omitempty"`
1935−}
1936−
1937−// Provider options for a {@link DocumentLinkRequest}.
1938−//
1939−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentLinkOptions
1940−type DocumentLinkOptions struct {
1941− // Document links have a resolve provider as well.
1942− ResolveProvider bool `json:"resolveProvider,omitempty"`
1943− WorkDoneProgressOptions
1944−}
1945−
1946−// The parameters of a {@link DocumentLinkRequest}.
1947−//
1948−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentLinkParams
1949−type DocumentLinkParams struct {
1950− // The document to provide document links for.
1951− TextDocument TextDocumentIdentifier `json:"textDocument"`
1952− WorkDoneProgressParams
1953− PartialResultParams
1954−}
1955−
1956−// Registration options for a {@link DocumentLinkRequest}.
1957−//
1958−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentLinkRegistrationOptions
1959−type DocumentLinkRegistrationOptions struct {
1960− TextDocumentRegistrationOptions
1961− DocumentLinkOptions
1962−}
1963−
1964−// Client capabilities of a {@link DocumentOnTypeFormattingRequest}.
1965−//
1966−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentOnTypeFormattingClientCapabilities
1967−type DocumentOnTypeFormattingClientCapabilities struct {
1968− // Whether on type formatting supports dynamic registration.
1969− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
1970−}
1971−
1972−// Provider options for a {@link DocumentOnTypeFormattingRequest}.
1973−//
1974−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentOnTypeFormattingOptions
1975−type DocumentOnTypeFormattingOptions struct {
1976− // A character on which formatting should be triggered, like `{`.
1977− FirstTriggerCharacter string `json:"firstTriggerCharacter"`
1978− // More trigger characters.
1979− MoreTriggerCharacter []string `json:"moreTriggerCharacter,omitempty"`
1980−}
1981−
1982−// The parameters of a {@link DocumentOnTypeFormattingRequest}.
1983−//
1984−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentOnTypeFormattingParams
1985−type DocumentOnTypeFormattingParams struct {
1986− // The document to format.
1987− TextDocument TextDocumentIdentifier `json:"textDocument"`
1988− // The position around which the on type formatting should happen.
1989− // This is not necessarily the exact position where the character denoted
1990− // by the property `ch` got typed.
1991− Position Position `json:"position"`
1992− // The character that has been typed that triggered the formatting
1993− // on type request. That is not necessarily the last character that
1994− // got inserted into the document since the client could auto insert
1995− // characters as well (e.g. like automatic brace completion).
1996− Ch string `json:"ch"`
1997− // The formatting options.
1998− Options FormattingOptions `json:"options"`
1999−}
2000−
2001−// Registration options for a {@link DocumentOnTypeFormattingRequest}.
2002−//
2003−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentOnTypeFormattingRegistrationOptions
2004−type DocumentOnTypeFormattingRegistrationOptions struct {
2005− TextDocumentRegistrationOptions
2006− DocumentOnTypeFormattingOptions
2007−}
2008−
2009−// Client capabilities of a {@link DocumentRangeFormattingRequest}.
2010−//
2011−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentRangeFormattingClientCapabilities
2012−type DocumentRangeFormattingClientCapabilities struct {
2013− // Whether range formatting supports dynamic registration.
2014− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
2015− // Whether the client supports formatting multiple ranges at once.
2016− //
2017− // @since 3.18.0
2018− // @proposed
2019− RangesSupport bool `json:"rangesSupport,omitempty"`
2020−}
2021−
2022−// Provider options for a {@link DocumentRangeFormattingRequest}.
2023−//
2024−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentRangeFormattingOptions
2025−type DocumentRangeFormattingOptions struct {
2026− // Whether the server supports formatting multiple ranges at once.
2027− //
2028− // @since 3.18.0
2029− // @proposed
2030− RangesSupport bool `json:"rangesSupport,omitempty"`
2031− WorkDoneProgressOptions
2032−}
2033−
2034−// The parameters of a {@link DocumentRangeFormattingRequest}.
2035−//
2036−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentRangeFormattingParams
2037−type DocumentRangeFormattingParams struct {
2038− // The document to format.
2039− TextDocument TextDocumentIdentifier `json:"textDocument"`
2040− // The range to format
2041− Range Range `json:"range"`
2042− // The format options
2043− Options FormattingOptions `json:"options"`
2044− WorkDoneProgressParams
2045−}
2046−
2047−// Registration options for a {@link DocumentRangeFormattingRequest}.
2048−//
2049−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentRangeFormattingRegistrationOptions
2050−type DocumentRangeFormattingRegistrationOptions struct {
2051− TextDocumentRegistrationOptions
2052− DocumentRangeFormattingOptions
2053−}
2054−
2055−// The parameters of a {@link DocumentRangesFormattingRequest}.
2056−//
2057−// @since 3.18.0
2058−// @proposed
2059−//
2060−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentRangesFormattingParams
2061−type DocumentRangesFormattingParams struct {
2062− // The document to format.
2063− TextDocument TextDocumentIdentifier `json:"textDocument"`
2064− // The ranges to format
2065− Ranges []Range `json:"ranges"`
2066− // The format options
2067− Options FormattingOptions `json:"options"`
2068− WorkDoneProgressParams
2069−}
2070−
2071−// A document selector is the combination of one or many document filters.
2072−//
2073−// @sample `let sel:DocumentSelector = [{ language: 'typescript' }, { language: 'json', pattern: '**∕tsconfig.json' }]`;
2074−//
2075−// The use of a string as a document filter is deprecated @since 3.16.0.
2076−//
2077−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentSelector
2078−type (
2079− DocumentSelector = []DocumentFilter // (alias)
2080− // Represents programming constructs like variables, classes, interfaces etc.
2081− // that appear in a document. Document symbols can be hierarchical and they
2082− // have two ranges: one that encloses its definition and one that points to
2083− // its most interesting range, e.g. the range of an identifier.
2084− //
2085− // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentSymbol
2086− DocumentSymbol struct {
2087− // The name of this symbol. Will be displayed in the user interface and therefore must not be
2088− // an empty string or a string only consisting of white spaces.
2089− Name string `json:"name"`
2090− // More detail for this symbol, e.g the signature of a function.
2091− Detail string `json:"detail,omitempty"`
2092− // The kind of this symbol.
2093− Kind SymbolKind `json:"kind"`
2094− // Tags for this document symbol.
2095− //
2096− // @since 3.16.0
2097− Tags []SymbolTag `json:"tags,omitempty"`
2098− // Indicates if this symbol is deprecated.
2099− //
2100− // @deprecated Use tags instead
2101− Deprecated bool `json:"deprecated,omitempty"`
2102− // The range enclosing this symbol not including leading/trailing whitespace but everything else
2103− // like comments. This information is typically used to determine if the clients cursor is
2104− // inside the symbol to reveal in the symbol in the UI.
2105− Range Range `json:"range"`
2106− // The range that should be selected and revealed when this symbol is being picked, e.g the name of a function.
2107− // Must be contained by the `range`.
2108− SelectionRange Range `json:"selectionRange"`
2109− // Children of this symbol, e.g. properties of a class.
2110− Children []DocumentSymbol `json:"children,omitempty"`
2111− }
2112−)
2113−
2114−// Client Capabilities for a {@link DocumentSymbolRequest}.
2115−//
2116−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentSymbolClientCapabilities
2117−type DocumentSymbolClientCapabilities struct {
2118− // Whether document symbol supports dynamic registration.
2119− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
2120− // Specific capabilities for the `SymbolKind` in the
2121− // `textDocument/documentSymbol` request.
2122− SymbolKind *ClientSymbolKindOptions `json:"symbolKind,omitempty"`
2123− // The client supports hierarchical document symbols.
2124− HierarchicalDocumentSymbolSupport bool `json:"hierarchicalDocumentSymbolSupport,omitempty"`
2125− // The client supports tags on `SymbolInformation`. Tags are supported on
2126− // `DocumentSymbol` if `hierarchicalDocumentSymbolSupport` is set to true.
2127− // Clients supporting tags have to handle unknown tags gracefully.
2128− //
2129− // @since 3.16.0
2130− TagSupport *ClientSymbolTagOptions `json:"tagSupport,omitempty"`
2131− // The client supports an additional label presented in the UI when
2132− // registering a document symbol provider.
2133− //
2134− // @since 3.16.0
2135− LabelSupport bool `json:"labelSupport,omitempty"`
2136−}
2137−
2138−// Provider options for a {@link DocumentSymbolRequest}.
2139−//
2140−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentSymbolOptions
2141−type DocumentSymbolOptions struct {
2142− // A human-readable string that is shown when multiple outlines trees
2143− // are shown for the same document.
2144− //
2145− // @since 3.16.0
2146− Label string `json:"label,omitempty"`
2147− WorkDoneProgressOptions
2148−}
2149−
2150−// Parameters for a {@link DocumentSymbolRequest}.
2151−//
2152−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentSymbolParams
2153−type DocumentSymbolParams struct {
2154− // The text document.
2155− TextDocument TextDocumentIdentifier `json:"textDocument"`
2156− WorkDoneProgressParams
2157− PartialResultParams
2158−}
2159−
2160−// Registration options for a {@link DocumentSymbolRequest}.
2161−//
2162−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentSymbolRegistrationOptions
2163−type DocumentSymbolRegistrationOptions struct {
2164− TextDocumentRegistrationOptions
2165− DocumentSymbolOptions
2166−}
2167−
2168−// Edit range variant that includes ranges for insert and replace operations.
2169−//
2170−// @since 3.18.0
2171−//
2172−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#editRangeWithInsertReplace
2173−type EditRangeWithInsertReplace struct {
2174− Insert Range `json:"insert"`
2175− Replace Range `json:"replace"`
2176−}
2177−
2178−// Predefined error codes.
2179−type ErrorCodes int32
2180−
2181−// The client capabilities of a {@link ExecuteCommandRequest}.
2182−//
2183−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#executeCommandClientCapabilities
2184−type ExecuteCommandClientCapabilities struct {
2185− // Execute command supports dynamic registration.
2186− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
2187−}
2188−
2189−// The server capabilities of a {@link ExecuteCommandRequest}.
2190−//
2191−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#executeCommandOptions
2192−type ExecuteCommandOptions struct {
2193− // The commands to be executed on the server
2194− Commands []string `json:"commands"`
2195− WorkDoneProgressOptions
2196−}
2197−
2198−// The parameters of a {@link ExecuteCommandRequest}.
2199−//
2200−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#executeCommandParams
2201−type ExecuteCommandParams struct {
2202− // The identifier of the actual command handler.
2203− Command string `json:"command"`
2204− // Arguments that the command should be invoked with.
2205− Arguments []json.RawMessage `json:"arguments,omitempty"`
2206− WorkDoneProgressParams
2207−}
2208−
2209−// Registration options for a {@link ExecuteCommandRequest}.
2210−//
2211−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#executeCommandRegistrationOptions
2212−type ExecuteCommandRegistrationOptions struct {
2213− ExecuteCommandOptions
2214−}
2215−
2216−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#executionSummary
2217−type ExecutionSummary struct {
2218− // A strict monotonically increasing value
2219− // indicating the execution order of a cell
2220− // inside a notebook.
2221− ExecutionOrder uint32 `json:"executionOrder"`
2222− // Whether the execution was successful or
2223− // not if known by the client.
2224− Success bool `json:"success,omitempty"`
2225−}
2226−type FailureHandlingKind string
2227−
2228−// The file event type
2229−type FileChangeType uint32
2230−
2231−// Represents information on a file/folder create.
2232−//
2233−// @since 3.16.0
2234−//
2235−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileCreate
2236−type FileCreate struct {
2237− // A file:// URI for the location of the file/folder being created.
2238− URI string `json:"uri"`
2239−}
2240−
2241−// Represents information on a file/folder delete.
2242−//
2243−// @since 3.16.0
2244−//
2245−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileDelete
2246−type FileDelete struct {
2247− // A file:// URI for the location of the file/folder being deleted.
2248− URI string `json:"uri"`
2249−}
2250−
2251−// An event describing a file change.
2252−//
2253−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileEvent
2254−type FileEvent struct {
2255− // The file's uri.
2256− URI DocumentURI `json:"uri"`
2257− // The change type.
2258− Type FileChangeType `json:"type"`
2259−}
2260−
2261−// Capabilities relating to events from file operations by the user in the client.
2262−//
2263−// These events do not come from the file system, they come from user operations
2264−// like renaming a file in the UI.
2265−//
2266−// @since 3.16.0
2267−//
2268−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileOperationClientCapabilities
2269−type FileOperationClientCapabilities struct {
2270− // Whether the client supports dynamic registration for file requests/notifications.
2271− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
2272− // The client has support for sending didCreateFiles notifications.
2273− DidCreate bool `json:"didCreate,omitempty"`
2274− // The client has support for sending willCreateFiles requests.
2275− WillCreate bool `json:"willCreate,omitempty"`
2276− // The client has support for sending didRenameFiles notifications.
2277− DidRename bool `json:"didRename,omitempty"`
2278− // The client has support for sending willRenameFiles requests.
2279− WillRename bool `json:"willRename,omitempty"`
2280− // The client has support for sending didDeleteFiles notifications.
2281− DidDelete bool `json:"didDelete,omitempty"`
2282− // The client has support for sending willDeleteFiles requests.
2283− WillDelete bool `json:"willDelete,omitempty"`
2284−}
2285−
2286−// A filter to describe in which file operation requests or notifications
2287−// the server is interested in receiving.
2288−//
2289−// @since 3.16.0
2290−//
2291−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileOperationFilter
2292−type FileOperationFilter struct {
2293− // A Uri scheme like `file` or `untitled`.
2294− Scheme string `json:"scheme,omitempty"`
2295− // The actual file operation pattern.
2296− Pattern FileOperationPattern `json:"pattern"`
2297−}
2298−
2299−// Options for notifications/requests for user operations on files.
2300−//
2301−// @since 3.16.0
2302−//
2303−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileOperationOptions
2304−type FileOperationOptions struct {
2305− // The server is interested in receiving didCreateFiles notifications.
2306− DidCreate *FileOperationRegistrationOptions `json:"didCreate,omitempty"`
2307− // The server is interested in receiving willCreateFiles requests.
2308− WillCreate *FileOperationRegistrationOptions `json:"willCreate,omitempty"`
2309− // The server is interested in receiving didRenameFiles notifications.
2310− DidRename *FileOperationRegistrationOptions `json:"didRename,omitempty"`
2311− // The server is interested in receiving willRenameFiles requests.
2312− WillRename *FileOperationRegistrationOptions `json:"willRename,omitempty"`
2313− // The server is interested in receiving didDeleteFiles file notifications.
2314− DidDelete *FileOperationRegistrationOptions `json:"didDelete,omitempty"`
2315− // The server is interested in receiving willDeleteFiles file requests.
2316− WillDelete *FileOperationRegistrationOptions `json:"willDelete,omitempty"`
2317−}
2318−
2319−// A pattern to describe in which file operation requests or notifications
2320−// the server is interested in receiving.
2321−//
2322−// @since 3.16.0
2323−//
2324−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileOperationPattern
2325−type FileOperationPattern struct {
2326− // The glob pattern to match. Glob patterns can have the following syntax:
2327− //
2328− // - `*` to match one or more characters in a path segment
2329− // - `?` to match on one character in a path segment
2330− // - `**` to match any number of path segments, including none
2331− // - `{}` to group sub patterns into an OR expression. (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files)
2332− // - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …)
2333− // - `[!...]` 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`)
2334− Glob string `json:"glob"`
2335− // Whether to match files or folders with this pattern.
2336− //
2337− // Matches both if undefined.
2338− Matches *FileOperationPatternKind `json:"matches,omitempty"`
2339− // Additional options used during matching.
2340− Options *FileOperationPatternOptions `json:"options,omitempty"`
2341−}
2342−
2343−// A pattern kind describing if a glob pattern matches a file a folder or
2344−// both.
2345−//
2346−// @since 3.16.0
2347−type FileOperationPatternKind string
2348−
2349−// Matching options for the file operation pattern.
2350−//
2351−// @since 3.16.0
2352−//
2353−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileOperationPatternOptions
2354−type FileOperationPatternOptions struct {
2355− // The pattern should be matched ignoring casing.
2356− IgnoreCase bool `json:"ignoreCase,omitempty"`
2357−}
2358−
2359−// The options to register for file operations.
2360−//
2361−// @since 3.16.0
2362−//
2363−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileOperationRegistrationOptions
2364−type FileOperationRegistrationOptions struct {
2365− // The actual filters.
2366− Filters []FileOperationFilter `json:"filters"`
2367−}
2368−
2369−// Represents information on a file/folder rename.
2370−//
2371−// @since 3.16.0
2372−//
2373−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileRename
2374−type FileRename struct {
2375− // A file:// URI for the original location of the file/folder being renamed.
2376− OldURI string `json:"oldUri"`
2377− // A file:// URI for the new location of the file/folder being renamed.
2378− NewURI string `json:"newUri"`
2379−}
2380−
2381−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileSystemWatcher
2382−type FileSystemWatcher struct {
2383− // The glob pattern to watch. See {@link GlobPattern glob pattern} for more detail.
2384− //
2385− // @since 3.17.0 support for relative patterns.
2386− GlobPattern GlobPattern `json:"globPattern"`
2387− // The kind of events of interest. If omitted it defaults
2388− // to WatchKind.Create | WatchKind.Change | WatchKind.Delete
2389− // which is 7.
2390− Kind *WatchKind `json:"kind,omitempty"`
2391−}
2392−
2393−// Represents a folding range. To be valid, start and end line must be bigger than zero and smaller
2394−// than the number of lines in the document. Clients are free to ignore invalid ranges.
2395−//
2396−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#foldingRange
2397−type FoldingRange struct {
2398− // The zero-based start line of the range to fold. The folded area starts after the line's last character.
2399− // To be valid, the end must be zero or larger and smaller than the number of lines in the document.
2400− StartLine uint32 `json:"startLine"`
2401− // The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line.
2402− StartCharacter uint32 `json:"startCharacter,omitempty"`
2403− // The zero-based end line of the range to fold. The folded area ends with the line's last character.
2404− // To be valid, the end must be zero or larger and smaller than the number of lines in the document.
2405− EndLine uint32 `json:"endLine"`
2406− // The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line.
2407− EndCharacter uint32 `json:"endCharacter,omitempty"`
2408− // Describes the kind of the folding range such as 'comment' or 'region'. The kind
2409− // is used to categorize folding ranges and used by commands like 'Fold all comments'.
2410− // See {@link FoldingRangeKind} for an enumeration of standardized kinds.
2411− Kind string `json:"kind,omitempty"`
2412− // The text that the client should show when the specified range is
2413− // collapsed. If not defined or not supported by the client, a default
2414− // will be chosen by the client.
2415− //
2416− // @since 3.17.0
2417− CollapsedText string `json:"collapsedText,omitempty"`
2418−}
2419−
2420−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#foldingRangeClientCapabilities
2421−type FoldingRangeClientCapabilities struct {
2422− // Whether implementation supports dynamic registration for folding range
2423− // providers. If this is set to `true` the client supports the new
2424− // `FoldingRangeRegistrationOptions` return value for the corresponding
2425− // server capability as well.
2426− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
2427− // The maximum number of folding ranges that the client prefers to receive
2428− // per document. The value serves as a hint, servers are free to follow the
2429− // limit.
2430− RangeLimit uint32 `json:"rangeLimit,omitempty"`
2431− // If set, the client signals that it only supports folding complete lines.
2432− // If set, client will ignore specified `startCharacter` and `endCharacter`
2433− // properties in a FoldingRange.
2434− LineFoldingOnly bool `json:"lineFoldingOnly,omitempty"`
2435− // Specific options for the folding range kind.
2436− //
2437− // @since 3.17.0
2438− FoldingRangeKind *ClientFoldingRangeKindOptions `json:"foldingRangeKind,omitempty"`
2439− // Specific options for the folding range.
2440− //
2441− // @since 3.17.0
2442− FoldingRange *ClientFoldingRangeOptions `json:"foldingRange,omitempty"`
2443−}
2444−
2445−// A set of predefined range kinds.
2446−type FoldingRangeKind string
2447−
2448−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#foldingRangeOptions
2449−type FoldingRangeOptions struct {
2450− WorkDoneProgressOptions
2451−}
2452−
2453−// Parameters for a {@link FoldingRangeRequest}.
2454−//
2455−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#foldingRangeParams
2456−type FoldingRangeParams struct {
2457− // The text document.
2458− TextDocument TextDocumentIdentifier `json:"textDocument"`
2459− WorkDoneProgressParams
2460− PartialResultParams
2461−}
2462−
2463−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#foldingRangeRegistrationOptions
2464−type FoldingRangeRegistrationOptions struct {
2465− TextDocumentRegistrationOptions
2466− FoldingRangeOptions
2467− StaticRegistrationOptions
2468−}
2469−
2470−// Client workspace capabilities specific to folding ranges
2471−//
2472−// @since 3.18.0
2473−// @proposed
2474−//
2475−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#foldingRangeWorkspaceClientCapabilities
2476−type FoldingRangeWorkspaceClientCapabilities struct {
2477− // Whether the client implementation supports a refresh request sent from the
2478− // server to the client.
2479− //
2480− // Note that this event is global and will force the client to refresh all
2481− // folding ranges currently shown. It should be used with absolute care and is
2482− // useful for situation where a server for example detects a project wide
2483− // change that requires such a calculation.
2484− //
2485− // @since 3.18.0
2486− // @proposed
2487− RefreshSupport bool `json:"refreshSupport,omitempty"`
2488−}
2489−
2490−// Value-object describing what options formatting should use.
2491−//
2492−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#formattingOptions
2493−type FormattingOptions struct {
2494− // Size of a tab in spaces.
2495− TabSize uint32 `json:"tabSize"`
2496− // Prefer spaces over tabs.
2497− InsertSpaces bool `json:"insertSpaces"`
2498− // Trim trailing whitespace on a line.
2499− //
2500− // @since 3.15.0
2501− TrimTrailingWhitespace bool `json:"trimTrailingWhitespace,omitempty"`
2502− // Insert a newline character at the end of the file if one does not exist.
2503− //
2504− // @since 3.15.0
2505− InsertFinalNewline bool `json:"insertFinalNewline,omitempty"`
2506− // Trim all newlines after the final newline at the end of the file.
2507− //
2508− // @since 3.15.0
2509− TrimFinalNewlines bool `json:"trimFinalNewlines,omitempty"`
2510−}
2511−
2512−// A diagnostic report with a full set of problems.
2513−//
2514−// @since 3.17.0
2515−//
2516−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fullDocumentDiagnosticReport
2517−type FullDocumentDiagnosticReport struct {
2518− // A full document diagnostic report.
2519− Kind string `json:"kind"`
2520− // An optional result id. If provided it will
2521− // be sent on the next diagnostic request for the
2522− // same document.
2523− ResultID string `json:"resultId,omitempty"`
2524− // The actual items.
2525− Items []Diagnostic `json:"items"`
2526−}
2527−
2528−// General client capabilities.
2529−//
2530−// @since 3.16.0
2531−//
2532−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#generalClientCapabilities
2533−type GeneralClientCapabilities struct {
2534− // Client capability that signals how the client
2535− // handles stale requests (e.g. a request
2536− // for which the client will not process the response
2537− // anymore since the information is outdated).
2538− //
2539− // @since 3.17.0
2540− StaleRequestSupport *StaleRequestSupportOptions `json:"staleRequestSupport,omitempty"`
2541− // Client capabilities specific to regular expressions.
2542− //
2543− // @since 3.16.0
2544− RegularExpressions *RegularExpressionsClientCapabilities `json:"regularExpressions,omitempty"`
2545− // Client capabilities specific to the client's markdown parser.
2546− //
2547− // @since 3.16.0
2548− Markdown *MarkdownClientCapabilities `json:"markdown,omitempty"`
2549− // The position encodings supported by the client. Client and server
2550− // have to agree on the same position encoding to ensure that offsets
2551− // (e.g. character position in a line) are interpreted the same on both
2552− // sides.
2553− //
2554− // To keep the protocol backwards compatible the following applies: if
2555− // the value 'utf-16' is missing from the array of position encodings
2556− // servers can assume that the client supports UTF-16. UTF-16 is
2557− // therefore a mandatory encoding.
2558− //
2559− // If omitted it defaults to ['utf-16'].
2560− //
2561− // Implementation considerations: since the conversion from one encoding
2562− // into another requires the content of the file / line the conversion
2563− // is best done where the file is read which is usually on the server
2564− // side.
2565− //
2566− // @since 3.17.0
2567− PositionEncodings []PositionEncodingKind `json:"positionEncodings,omitempty"`
2568−}
2569−
2570−// The glob pattern. Either a string pattern or a relative pattern.
2571−//
2572−// @since 3.17.0
2573−//
2574−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#globPattern
2575−type (
2576− GlobPattern = Or_GlobPattern // (alias)
2577− // The result of a hover request.
2578− //
2579− // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#hover
2580− Hover struct {
2581− // The hover's content
2582− Contents MarkupContent `json:"contents"`
2583− // An optional range inside the text document that is used to
2584− // visualize the hover, e.g. by changing the background color.
2585− Range Range `json:"range,omitempty"`
2586− }
2587−)
2588−
2589−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#hoverClientCapabilities
2590−type HoverClientCapabilities struct {
2591− // Whether hover supports dynamic registration.
2592− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
2593− // Client supports the following content formats for the content
2594− // property. The order describes the preferred format of the client.
2595− ContentFormat []MarkupKind `json:"contentFormat,omitempty"`
2596−}
2597−
2598−// Hover options.
2599−//
2600−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#hoverOptions
2601−type HoverOptions struct {
2602− WorkDoneProgressOptions
2603−}
2604−
2605−// Parameters for a {@link HoverRequest}.
2606−//
2607−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#hoverParams
2608−type HoverParams struct {
2609− TextDocumentPositionParams
2610− WorkDoneProgressParams
2611−}
2612−
2613−// Registration options for a {@link HoverRequest}.
2614−//
2615−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#hoverRegistrationOptions
2616−type HoverRegistrationOptions struct {
2617− TextDocumentRegistrationOptions
2618− HoverOptions
2619−}
2620−
2621−// @since 3.6.0
2622−//
2623−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#implementationClientCapabilities
2624−type ImplementationClientCapabilities struct {
2625− // Whether implementation supports dynamic registration. If this is set to `true`
2626− // the client supports the new `ImplementationRegistrationOptions` return value
2627− // for the corresponding server capability as well.
2628− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
2629− // The client supports additional metadata in the form of definition links.
2630− //
2631− // @since 3.14.0
2632− LinkSupport bool `json:"linkSupport,omitempty"`
2633−}
2634−
2635−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#implementationOptions
2636−type ImplementationOptions struct {
2637− WorkDoneProgressOptions
2638−}
2639−
2640−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#implementationParams
2641−type ImplementationParams struct {
2642− TextDocumentPositionParams
2643− WorkDoneProgressParams
2644− PartialResultParams
2645−}
2646−
2647−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#implementationRegistrationOptions
2648−type ImplementationRegistrationOptions struct {
2649− TextDocumentRegistrationOptions
2650− ImplementationOptions
2651− StaticRegistrationOptions
2652−}
2653−
2654−// The data type of the ResponseError if the
2655−// initialize request fails.
2656−//
2657−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#initializeError
2658−type InitializeError struct {
2659− // Indicates whether the client execute the following retry logic:
2660− // (1) show the message provided by the ResponseError to the user
2661− // (2) user selects retry or cancel
2662− // (3) if user selected retry the initialize method is sent again.
2663− Retry bool `json:"retry"`
2664−}
2665−
2666−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#initializeParams
2667−type InitializeParams struct {
2668− XInitializeParams
2669− WorkspaceFoldersInitializeParams
2670−}
2671−
2672−// The result returned from an initialize request.
2673−//
2674−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#initializeResult
2675−type InitializeResult struct {
2676− // The capabilities the language server provides.
2677− Capabilities ServerCapabilities `json:"capabilities"`
2678− // Information about the server.
2679− //
2680− // @since 3.15.0
2681− ServerInfo *ServerInfo `json:"serverInfo,omitempty"`
2682−}
2683−
2684−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#initializedParams
2685−type InitializedParams struct{}
2686−
2687−// Inlay hint information.
2688−//
2689−// @since 3.17.0
2690−//
2691−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlayHint
2692−type InlayHint struct {
2693− // The position of this hint.
2694− //
2695− // If multiple hints have the same position, they will be shown in the order
2696− // they appear in the response.
2697− Position Position `json:"position"`
2698− // The label of this hint. A human readable string or an array of
2699− // InlayHintLabelPart label parts.
2700− //
2701− // *Note* that neither the string nor the label part can be empty.
2702− Label []InlayHintLabelPart `json:"label"`
2703− // The kind of this hint. Can be omitted in which case the client
2704− // should fall back to a reasonable default.
2705− Kind InlayHintKind `json:"kind,omitempty"`
2706− // Optional text edits that are performed when accepting this inlay hint.
2707− //
2708− // *Note* that edits are expected to change the document so that the inlay
2709− // hint (or its nearest variant) is now part of the document and the inlay
2710− // hint itself is now obsolete.
2711− TextEdits []TextEdit `json:"textEdits,omitempty"`
2712− // The tooltip text when you hover over this item.
2713− Tooltip *Or_InlayHint_tooltip `json:"tooltip,omitempty"`
2714− // Render padding before the hint.
2715− //
2716− // Note: Padding should use the editor's background color, not the
2717− // background color of the hint itself. That means padding can be used
2718− // to visually align/separate an inlay hint.
2719− PaddingLeft bool `json:"paddingLeft,omitempty"`
2720− // Render padding after the hint.
2721− //
2722− // Note: Padding should use the editor's background color, not the
2723− // background color of the hint itself. That means padding can be used
2724− // to visually align/separate an inlay hint.
2725− PaddingRight bool `json:"paddingRight,omitempty"`
2726− // A data entry field that is preserved on an inlay hint between
2727− // a `textDocument/inlayHint` and a `inlayHint/resolve` request.
2728− Data interface{} `json:"data,omitempty"`
2729−}
2730−
2731−// Inlay hint client capabilities.
2732−//
2733−// @since 3.17.0
2734−//
2735−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlayHintClientCapabilities
2736−type InlayHintClientCapabilities struct {
2737− // Whether inlay hints support dynamic registration.
2738− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
2739− // Indicates which properties a client can resolve lazily on an inlay
2740− // hint.
2741− ResolveSupport *ClientInlayHintResolveOptions `json:"resolveSupport,omitempty"`
2742−}
2743−
2744−// Inlay hint kinds.
2745−//
2746−// @since 3.17.0
2747−type InlayHintKind uint32
2748−
2749−// An inlay hint label part allows for interactive and composite labels
2750−// of inlay hints.
2751−//
2752−// @since 3.17.0
2753−//
2754−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlayHintLabelPart
2755−type InlayHintLabelPart struct {
2756− // The value of this label part.
2757− Value string `json:"value"`
2758− // The tooltip text when you hover over this label part. Depending on
2759− // the client capability `inlayHint.resolveSupport` clients might resolve
2760− // this property late using the resolve request.
2761− Tooltip *Or_InlayHintLabelPart_tooltip `json:"tooltip,omitempty"`
2762− // An optional source code location that represents this
2763− // label part.
2764− //
2765− // The editor will use this location for the hover and for code navigation
2766− // features: This part will become a clickable link that resolves to the
2767− // definition of the symbol at the given location (not necessarily the
2768− // location itself), it shows the hover that shows at the given location,
2769− // and it shows a context menu with further code navigation commands.
2770− //
2771− // Depending on the client capability `inlayHint.resolveSupport` clients
2772− // might resolve this property late using the resolve request.
2773− Location *Location `json:"location,omitempty"`
2774− // An optional command for this label part.
2775− //
2776− // Depending on the client capability `inlayHint.resolveSupport` clients
2777− // might resolve this property late using the resolve request.
2778− Command *Command `json:"command,omitempty"`
2779−}
2780−
2781−// Inlay hint options used during static registration.
2782−//
2783−// @since 3.17.0
2784−//
2785−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlayHintOptions
2786−type InlayHintOptions struct {
2787− // The server provides support to resolve additional
2788− // information for an inlay hint item.
2789− ResolveProvider bool `json:"resolveProvider,omitempty"`
2790− WorkDoneProgressOptions
2791−}
2792−
2793−// A parameter literal used in inlay hint requests.
2794−//
2795−// @since 3.17.0
2796−//
2797−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlayHintParams
2798−type InlayHintParams struct {
2799− // The text document.
2800− TextDocument TextDocumentIdentifier `json:"textDocument"`
2801− // The document range for which inlay hints should be computed.
2802− Range Range `json:"range"`
2803− WorkDoneProgressParams
2804−}
2805−
2806−// Inlay hint options used during static or dynamic registration.
2807−//
2808−// @since 3.17.0
2809−//
2810−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlayHintRegistrationOptions
2811−type InlayHintRegistrationOptions struct {
2812− InlayHintOptions
2813− TextDocumentRegistrationOptions
2814− StaticRegistrationOptions
2815−}
2816−
2817−// Client workspace capabilities specific to inlay hints.
2818−//
2819−// @since 3.17.0
2820−//
2821−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlayHintWorkspaceClientCapabilities
2822−type InlayHintWorkspaceClientCapabilities struct {
2823− // Whether the client implementation supports a refresh request sent from
2824− // the server to the client.
2825− //
2826− // Note that this event is global and will force the client to refresh all
2827− // inlay hints currently shown. It should be used with absolute care and
2828− // is useful for situation where a server for example detects a project wide
2829− // change that requires such a calculation.
2830− RefreshSupport bool `json:"refreshSupport,omitempty"`
2831−}
2832−
2833−// Client capabilities specific to inline completions.
2834−//
2835−// @since 3.18.0
2836−// @proposed
2837−//
2838−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineCompletionClientCapabilities
2839−type InlineCompletionClientCapabilities struct {
2840− // Whether implementation supports dynamic registration for inline completion providers.
2841− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
2842−}
2843−
2844−// Provides information about the context in which an inline completion was requested.
2845−//
2846−// @since 3.18.0
2847−// @proposed
2848−//
2849−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineCompletionContext
2850−type InlineCompletionContext struct {
2851− // Describes how the inline completion was triggered.
2852− TriggerKind InlineCompletionTriggerKind `json:"triggerKind"`
2853− // Provides information about the currently selected item in the autocomplete widget if it is visible.
2854− SelectedCompletionInfo *SelectedCompletionInfo `json:"selectedCompletionInfo,omitempty"`
2855−}
2856−
2857−// An inline completion item represents a text snippet that is proposed inline to complete text that is being typed.
2858−//
2859−// @since 3.18.0
2860−// @proposed
2861−//
2862−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineCompletionItem
2863−type InlineCompletionItem struct {
2864− // The text to replace the range with. Must be set.
2865− InsertText Or_InlineCompletionItem_insertText `json:"insertText"`
2866− // A text that is used to decide if this inline completion should be shown. When `falsy` the {@link InlineCompletionItem.insertText} is used.
2867− FilterText string `json:"filterText,omitempty"`
2868− // The range to replace. Must begin and end on the same line.
2869− Range *Range `json:"range,omitempty"`
2870− // An optional {@link Command} that is executed *after* inserting this completion.
2871− Command *Command `json:"command,omitempty"`
2872−}
2873−
2874−// Represents a collection of {@link InlineCompletionItem inline completion items} to be presented in the editor.
2875−//
2876−// @since 3.18.0
2877−// @proposed
2878−//
2879−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineCompletionList
2880−type InlineCompletionList struct {
2881− // The inline completion items
2882− Items []InlineCompletionItem `json:"items"`
2883−}
2884−
2885−// Inline completion options used during static registration.
2886−//
2887−// @since 3.18.0
2888−// @proposed
2889−//
2890−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineCompletionOptions
2891−type InlineCompletionOptions struct {
2892− WorkDoneProgressOptions
2893−}
2894−
2895−// A parameter literal used in inline completion requests.
2896−//
2897−// @since 3.18.0
2898−// @proposed
2899−//
2900−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineCompletionParams
2901−type InlineCompletionParams struct {
2902− // Additional information about the context in which inline completions were
2903− // requested.
2904− Context InlineCompletionContext `json:"context"`
2905− TextDocumentPositionParams
2906− WorkDoneProgressParams
2907−}
2908−
2909−// Inline completion options used during static or dynamic registration.
2910−//
2911−// @since 3.18.0
2912−// @proposed
2913−//
2914−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineCompletionRegistrationOptions
2915−type InlineCompletionRegistrationOptions struct {
2916− InlineCompletionOptions
2917− TextDocumentRegistrationOptions
2918− StaticRegistrationOptions
2919−}
2920−
2921−// Describes how an {@link InlineCompletionItemProvider inline completion provider} was triggered.
2922−//
2923−// @since 3.18.0
2924−// @proposed
2925−type InlineCompletionTriggerKind uint32
2926−
2927−// Inline value information can be provided by different means:
2928−//
2929−// - directly as a text value (class InlineValueText).
2930−// - as a name to use for a variable lookup (class InlineValueVariableLookup)
2931−// - as an evaluatable expression (class InlineValueEvaluatableExpression)
2932−//
2933−// The InlineValue types combines all inline value types into one type.
2934−//
2935−// @since 3.17.0
2936−//
2937−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValue
2938−type (
2939− InlineValue = Or_InlineValue // (alias)
2940− // Client capabilities specific to inline values.
2941− //
2942− // @since 3.17.0
2943− //
2944− // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValueClientCapabilities
2945− InlineValueClientCapabilities struct {
2946− // Whether implementation supports dynamic registration for inline value providers.
2947− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
2948− }
2949−)
2950−
2951−// @since 3.17.0
2952−//
2953−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValueContext
2954−type InlineValueContext struct {
2955− // The stack frame (as a DAP Id) where the execution has stopped.
2956− FrameID int32 `json:"frameId"`
2957− // The document range where execution has stopped.
2958− // Typically the end position of the range denotes the line where the inline values are shown.
2959− StoppedLocation Range `json:"stoppedLocation"`
2960−}
2961−
2962−// Provide an inline value through an expression evaluation.
2963−// If only a range is specified, the expression will be extracted from the underlying document.
2964−// An optional expression can be used to override the extracted expression.
2965−//
2966−// @since 3.17.0
2967−//
2968−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValueEvaluatableExpression
2969−type InlineValueEvaluatableExpression struct {
2970− // The document range for which the inline value applies.
2971− // The range is used to extract the evaluatable expression from the underlying document.
2972− Range Range `json:"range"`
2973− // If specified the expression overrides the extracted expression.
2974− Expression string `json:"expression,omitempty"`
2975−}
2976−
2977−// Inline value options used during static registration.
2978−//
2979−// @since 3.17.0
2980−//
2981−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValueOptions
2982−type InlineValueOptions struct {
2983− WorkDoneProgressOptions
2984−}
2985−
2986−// A parameter literal used in inline value requests.
2987−//
2988−// @since 3.17.0
2989−//
2990−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValueParams
2991−type InlineValueParams struct {
2992− // The text document.
2993− TextDocument TextDocumentIdentifier `json:"textDocument"`
2994− // The document range for which inline values should be computed.
2995− Range Range `json:"range"`
2996− // Additional information about the context in which inline values were
2997− // requested.
2998− Context InlineValueContext `json:"context"`
2999− WorkDoneProgressParams
3000−}
3001−
3002−// Inline value options used during static or dynamic registration.
3003−//
3004−// @since 3.17.0
3005−//
3006−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValueRegistrationOptions
3007−type InlineValueRegistrationOptions struct {
3008− InlineValueOptions
3009− TextDocumentRegistrationOptions
3010− StaticRegistrationOptions
3011−}
3012−
3013−// Provide inline value as text.
3014−//
3015−// @since 3.17.0
3016−//
3017−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValueText
3018−type InlineValueText struct {
3019− // The document range for which the inline value applies.
3020− Range Range `json:"range"`
3021− // The text of the inline value.
3022− Text string `json:"text"`
3023−}
3024−
3025−// Provide inline value through a variable lookup.
3026−// If only a range is specified, the variable name will be extracted from the underlying document.
3027−// An optional variable name can be used to override the extracted name.
3028−//
3029−// @since 3.17.0
3030−//
3031−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValueVariableLookup
3032−type InlineValueVariableLookup struct {
3033− // The document range for which the inline value applies.
3034− // The range is used to extract the variable name from the underlying document.
3035− Range Range `json:"range"`
3036− // If specified the name of the variable to look up.
3037− VariableName string `json:"variableName,omitempty"`
3038− // How to perform the lookup.
3039− CaseSensitiveLookup bool `json:"caseSensitiveLookup"`
3040−}
3041−
3042−// Client workspace capabilities specific to inline values.
3043−//
3044−// @since 3.17.0
3045−//
3046−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValueWorkspaceClientCapabilities
3047−type InlineValueWorkspaceClientCapabilities struct {
3048− // Whether the client implementation supports a refresh request sent from the
3049− // server to the client.
3050− //
3051− // Note that this event is global and will force the client to refresh all
3052− // inline values currently shown. It should be used with absolute care and is
3053− // useful for situation where a server for example detects a project wide
3054− // change that requires such a calculation.
3055− RefreshSupport bool `json:"refreshSupport,omitempty"`
3056−}
3057−
3058−// A special text edit to provide an insert and a replace operation.
3059−//
3060−// @since 3.16.0
3061−//
3062−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#insertReplaceEdit
3063−type InsertReplaceEdit struct {
3064− // The string to be inserted.
3065− NewText string `json:"newText"`
3066− // The range if the insert is requested
3067− Insert Range `json:"insert"`
3068− // The range if the replace is requested.
3069− Replace Range `json:"replace"`
3070−}
3071−
3072−// Defines whether the insert text in a completion item should be interpreted as
3073−// plain text or a snippet.
3074−type InsertTextFormat uint32
3075−
3076−// How whitespace and indentation is handled during completion
3077−// item insertion.
3078−//
3079−// @since 3.16.0
3080−type (
3081− InsertTextMode uint32
3082− LSPAny = interface{}
3083−)
3084−
3085−// LSP arrays.
3086−// @since 3.17.0
3087−//
3088−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#lSPArray
3089−type (
3090− LSPArray = []interface{} // (alias)
3091− LSPErrorCodes int32
3092−)
3093−
3094−// LSP object definition.
3095−// @since 3.17.0
3096−//
3097−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#lSPObject
3098−type (
3099− LSPObject = map[string]LSPAny // (alias)
3100− // Predefined Language kinds
3101− // @since 3.18.0
3102− // @proposed
3103− LanguageKind string
3104−)
3105−
3106−// Client capabilities for the linked editing range request.
3107−//
3108−// @since 3.16.0
3109−//
3110−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#linkedEditingRangeClientCapabilities
3111−type LinkedEditingRangeClientCapabilities struct {
3112− // Whether implementation supports dynamic registration. If this is set to `true`
3113− // the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
3114− // return value for the corresponding server capability as well.
3115− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
3116−}
3117−
3118−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#linkedEditingRangeOptions
3119−type LinkedEditingRangeOptions struct {
3120− WorkDoneProgressOptions
3121−}
3122−
3123−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#linkedEditingRangeParams
3124−type LinkedEditingRangeParams struct {
3125− TextDocumentPositionParams
3126− WorkDoneProgressParams
3127−}
3128−
3129−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#linkedEditingRangeRegistrationOptions
3130−type LinkedEditingRangeRegistrationOptions struct {
3131− TextDocumentRegistrationOptions
3132− LinkedEditingRangeOptions
3133− StaticRegistrationOptions
3134−}
3135−
3136−// The result of a linked editing range request.
3137−//
3138−// @since 3.16.0
3139−//
3140−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#linkedEditingRanges
3141−type LinkedEditingRanges struct {
3142− // A list of ranges that can be edited together. The ranges must have
3143− // identical length and contain identical text content. The ranges cannot overlap.
3144− Ranges []Range `json:"ranges"`
3145− // An optional word pattern (regular expression) that describes valid contents for
3146− // the given ranges. If no pattern is provided, the client configuration's word
3147− // pattern will be used.
3148− WordPattern string `json:"wordPattern,omitempty"`
3149−}
3150−
3151−// created for Literal (Lit_ClientSemanticTokensRequestOptions_range_Item1)
3152−type Lit_ClientSemanticTokensRequestOptions_range_Item1 struct{}
3153−
3154−// created for Literal (Lit_SemanticTokensOptions_range_Item1)
3155−type Lit_SemanticTokensOptions_range_Item1 struct{}
3156−
3157−// Represents a location inside a resource, such as a line
3158−// inside a text file.
3159−//
3160−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#location
3161−type Location struct {
3162− URI DocumentURI `json:"uri"`
3163− Range Range `json:"range"`
3164−}
3165−
3166−// Represents the connection of two locations. Provides additional metadata over normal {@link Location locations},
3167−// including an origin range.
3168−//
3169−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#locationLink
3170−type LocationLink struct {
3171− // Span of the origin of this link.
3172− //
3173− // Used as the underlined span for mouse interaction. Defaults to the word range at
3174− // the definition position.
3175− OriginSelectionRange *Range `json:"originSelectionRange,omitempty"`
3176− // The target resource identifier of this link.
3177− TargetURI DocumentURI `json:"targetUri"`
3178− // The full target range of this link. If the target for example is a symbol then target range is the
3179− // range enclosing this symbol not including leading/trailing whitespace but everything else
3180− // like comments. This information is typically used to highlight the range in the editor.
3181− TargetRange Range `json:"targetRange"`
3182− // The range that should be selected and revealed when this link is being followed, e.g the name of a function.
3183− // Must be contained by the `targetRange`. See also `DocumentSymbol#range`
3184− TargetSelectionRange Range `json:"targetSelectionRange"`
3185−}
3186−
3187−// Location with only uri and does not include range.
3188−//
3189−// @since 3.18.0
3190−//
3191−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#locationUriOnly
3192−type LocationUriOnly struct {
3193− URI DocumentURI `json:"uri"`
3194−}
3195−
3196−// The log message parameters.
3197−//
3198−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#logMessageParams
3199−type LogMessageParams struct {
3200− // The message type. See {@link MessageType}
3201− Type MessageType `json:"type"`
3202− // The actual message.
3203− Message string `json:"message"`
3204−}
3205−
3206−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#logTraceParams
3207−type LogTraceParams struct {
3208− Message string `json:"message"`
3209− Verbose string `json:"verbose,omitempty"`
3210−}
3211−
3212−// Client capabilities specific to the used markdown parser.
3213−//
3214−// @since 3.16.0
3215−//
3216−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#markdownClientCapabilities
3217−type MarkdownClientCapabilities struct {
3218− // The name of the parser.
3219− Parser string `json:"parser"`
3220− // The version of the parser.
3221− Version string `json:"version,omitempty"`
3222− // A list of HTML tags that the client allows / supports in
3223− // Markdown.
3224− //
3225− // @since 3.17.0
3226− AllowedTags []string `json:"allowedTags,omitempty"`
3227−}
3228−
3229−// MarkedString can be used to render human readable text. It is either a markdown string
3230−// or a code-block that provides a language and a code snippet. The language identifier
3231−// is semantically equal to the optional language identifier in fenced code blocks in GitHub
3232−// issues. See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting
3233−//
3234−// The pair of a language and a value is an equivalent to markdown:
3235−// ```${language}
3236−// ${value}
3237−// ```
3238−//
3239−// Note that markdown strings will be sanitized - that means html will be escaped.
3240−// @deprecated use MarkupContent instead.
3241−//
3242−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#markedString
3243−type (
3244− MarkedString = Or_MarkedString // (alias)
3245− // @since 3.18.0
3246− // @deprecated use MarkupContent instead.
3247− //
3248− // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#markedStringWithLanguage
3249− MarkedStringWithLanguage struct {
3250− Language string `json:"language"`
3251− Value string `json:"value"`
3252− }
3253−)
3254−
3255−// A `MarkupContent` literal represents a string value which content is interpreted base on its
3256−// kind flag. Currently the protocol supports `plaintext` and `markdown` as markup kinds.
3257−//
3258−// If the kind is `markdown` then the value can contain fenced code blocks like in GitHub issues.
3259−// See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting
3260−//
3261−// Here is an example how such a string can be constructed using JavaScript / TypeScript:
3262−// ```ts
3263−//
3264−// let markdown: MarkdownContent = {
3265−// kind: MarkupKind.Markdown,
3266−// value: [
3267−// '# Header',
3268−// 'Some text',
3269−// '```typescript',
3270−// 'someCode();',
3271−// '```'
3272−// ].join('\n')
3273−// };
3274−//
3275−// ```
3276−//
3277−// *Please Note* that clients might sanitize the return markdown. A client could decide to
3278−// remove HTML from the markdown to avoid script execution.
3279−//
3280−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#markupContent
3281−type MarkupContent struct {
3282− // The type of the Markup
3283− Kind MarkupKind `json:"kind"`
3284− // The content itself
3285− Value string `json:"value"`
3286−}
3287−
3288−// Describes the content type that a client supports in various
3289−// result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
3290−//
3291−// Please note that `MarkupKinds` must not start with a `$`. This kinds
3292−// are reserved for internal usage.
3293−type MarkupKind string
3294−
3295−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#messageActionItem
3296−type MessageActionItem struct {
3297− // A short title like 'Retry', 'Open Log' etc.
3298− Title string `json:"title"`
3299−}
3300−
3301−// The message type
3302−type MessageType uint32
3303−
3304−// Moniker definition to match LSIF 0.5 moniker definition.
3305−//
3306−// @since 3.16.0
3307−//
3308−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#moniker
3309−type Moniker struct {
3310− // The scheme of the moniker. For example tsc or .Net
3311− Scheme string `json:"scheme"`
3312− // The identifier of the moniker. The value is opaque in LSIF however
3313− // schema owners are allowed to define the structure if they want.
3314− Identifier string `json:"identifier"`
3315− // The scope in which the moniker is unique
3316− Unique UniquenessLevel `json:"unique"`
3317− // The moniker kind if known.
3318− Kind *MonikerKind `json:"kind,omitempty"`
3319−}
3320−
3321−// Client capabilities specific to the moniker request.
3322−//
3323−// @since 3.16.0
3324−//
3325−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#monikerClientCapabilities
3326−type MonikerClientCapabilities struct {
3327− // Whether moniker supports dynamic registration. If this is set to `true`
3328− // the client supports the new `MonikerRegistrationOptions` return value
3329− // for the corresponding server capability as well.
3330− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
3331−}
3332−
3333−// The moniker kind.
3334−//
3335−// @since 3.16.0
3336−type MonikerKind string
3337−
3338−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#monikerOptions
3339−type MonikerOptions struct {
3340− WorkDoneProgressOptions
3341−}
3342−
3343−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#monikerParams
3344−type MonikerParams struct {
3345− TextDocumentPositionParams
3346− WorkDoneProgressParams
3347− PartialResultParams
3348−}
3349−
3350−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#monikerRegistrationOptions
3351−type MonikerRegistrationOptions struct {
3352− TextDocumentRegistrationOptions
3353− MonikerOptions
3354−}
3355−
3356−// A notebook cell.
3357−//
3358−// A cell's document URI must be unique across ALL notebook
3359−// cells and can therefore be used to uniquely identify a
3360−// notebook cell or the cell's text document.
3361−//
3362−// @since 3.17.0
3363−//
3364−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookCell
3365−type NotebookCell struct {
3366− // The cell's kind
3367− Kind NotebookCellKind `json:"kind"`
3368− // The URI of the cell's text document
3369− // content.
3370− Document DocumentURI `json:"document"`
3371− // Additional metadata stored with the cell.
3372− //
3373− // Note: should always be an object literal (e.g. LSPObject)
3374− Metadata *LSPObject `json:"metadata,omitempty"`
3375− // Additional execution summary information
3376− // if supported by the client.
3377− ExecutionSummary *ExecutionSummary `json:"executionSummary,omitempty"`
3378−}
3379−
3380−// A change describing how to move a `NotebookCell`
3381−// array from state S to S'.
3382−//
3383−// @since 3.17.0
3384−//
3385−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookCellArrayChange
3386−type NotebookCellArrayChange struct {
3387− // The start oftest of the cell that changed.
3388− Start uint32 `json:"start"`
3389− // The deleted cells
3390− DeleteCount uint32 `json:"deleteCount"`
3391− // The new cells, if any
3392− Cells []NotebookCell `json:"cells,omitempty"`
3393−}
3394−
3395−// A notebook cell kind.
3396−//
3397−// @since 3.17.0
3398−type NotebookCellKind uint32
3399−
3400−// @since 3.18.0
3401−//
3402−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookCellLanguage
3403−type NotebookCellLanguage struct {
3404− Language string `json:"language"`
3405−}
3406−
3407−// A notebook cell text document filter denotes a cell text
3408−// document by different properties.
3409−//
3410−// @since 3.17.0
3411−//
3412−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookCellTextDocumentFilter
3413−type NotebookCellTextDocumentFilter struct {
3414− // A filter that matches against the notebook
3415− // containing the notebook cell. If a string
3416− // value is provided it matches against the
3417− // notebook type. '*' matches every notebook.
3418− Notebook Or_NotebookCellTextDocumentFilter_notebook `json:"notebook"`
3419− // A language id like `python`.
3420− //
3421− // Will be matched against the language id of the
3422− // notebook cell document. '*' matches every language.
3423− Language string `json:"language,omitempty"`
3424−}
3425−
3426−// A notebook document.
3427−//
3428−// @since 3.17.0
3429−//
3430−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocument
3431−type NotebookDocument struct {
3432− // The notebook document's uri.
3433− URI URI `json:"uri"`
3434− // The type of the notebook.
3435− NotebookType string `json:"notebookType"`
3436− // The version number of this document (it will increase after each
3437− // change, including undo/redo).
3438− Version int32 `json:"version"`
3439− // Additional metadata stored with the notebook
3440− // document.
3441− //
3442− // Note: should always be an object literal (e.g. LSPObject)
3443− Metadata *LSPObject `json:"metadata,omitempty"`
3444− // The cells of a notebook.
3445− Cells []NotebookCell `json:"cells"`
3446−}
3447−
3448−// Structural changes to cells in a notebook document.
3449−//
3450−// @since 3.18.0
3451−//
3452−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentCellChangeStructure
3453−type NotebookDocumentCellChangeStructure struct {
3454− // The change to the cell array.
3455− Array NotebookCellArrayChange `json:"array"`
3456− // Additional opened cell text documents.
3457− DidOpen []TextDocumentItem `json:"didOpen,omitempty"`
3458− // Additional closed cell text documents.
3459− DidClose []TextDocumentIdentifier `json:"didClose,omitempty"`
3460−}
3461−
3462−// Cell changes to a notebook document.
3463−//
3464−// @since 3.18.0
3465−//
3466−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentCellChanges
3467−type NotebookDocumentCellChanges struct {
3468− // Changes to the cell structure to add or
3469− // remove cells.
3470− Structure *NotebookDocumentCellChangeStructure `json:"structure,omitempty"`
3471− // Changes to notebook cells properties like its
3472− // kind, execution summary or metadata.
3473− Data []NotebookCell `json:"data,omitempty"`
3474− // Changes to the text content of notebook cells.
3475− TextContent []NotebookDocumentCellContentChanges `json:"textContent,omitempty"`
3476−}
3477−
3478−// Content changes to a cell in a notebook document.
3479−//
3480−// @since 3.18.0
3481−//
3482−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentCellContentChanges
3483−type NotebookDocumentCellContentChanges struct {
3484− Document VersionedTextDocumentIdentifier `json:"document"`
3485− Changes []TextDocumentContentChangeEvent `json:"changes"`
3486−}
3487−
3488−// A change event for a notebook document.
3489−//
3490−// @since 3.17.0
3491−//
3492−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentChangeEvent
3493−type NotebookDocumentChangeEvent struct {
3494− // The changed meta data if any.
3495− //
3496− // Note: should always be an object literal (e.g. LSPObject)
3497− Metadata *LSPObject `json:"metadata,omitempty"`
3498− // Changes to cells
3499− Cells *NotebookDocumentCellChanges `json:"cells,omitempty"`
3500−}
3501−
3502−// Capabilities specific to the notebook document support.
3503−//
3504−// @since 3.17.0
3505−//
3506−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentClientCapabilities
3507−type NotebookDocumentClientCapabilities struct {
3508− // Capabilities specific to notebook document synchronization
3509− //
3510− // @since 3.17.0
3511− Synchronization NotebookDocumentSyncClientCapabilities `json:"synchronization"`
3512−}
3513−
3514−// A notebook document filter denotes a notebook document by
3515−// different properties. The properties will be match
3516−// against the notebook's URI (same as with documents)
3517−//
3518−// @since 3.17.0
3519−//
3520−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentFilter
3521−type (
3522− NotebookDocumentFilter = Or_NotebookDocumentFilter // (alias)
3523− // A notebook document filter where `notebookType` is required field.
3524− //
3525− // @since 3.18.0
3526− //
3527− // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentFilterNotebookType
3528− NotebookDocumentFilterNotebookType struct {
3529− // The type of the enclosing notebook.
3530− NotebookType string `json:"notebookType"`
3531− // A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
3532− Scheme string `json:"scheme,omitempty"`
3533− // A glob pattern.
3534− Pattern *GlobPattern `json:"pattern,omitempty"`
3535− }
3536−)
3537−
3538−// A notebook document filter where `pattern` is required field.
3539−//
3540−// @since 3.18.0
3541−//
3542−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentFilterPattern
3543−type NotebookDocumentFilterPattern struct {
3544− // The type of the enclosing notebook.
3545− NotebookType string `json:"notebookType,omitempty"`
3546− // A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
3547− Scheme string `json:"scheme,omitempty"`
3548− // A glob pattern.
3549− Pattern GlobPattern `json:"pattern"`
3550−}
3551−
3552−// A notebook document filter where `scheme` is required field.
3553−//
3554−// @since 3.18.0
3555−//
3556−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentFilterScheme
3557−type NotebookDocumentFilterScheme struct {
3558− // The type of the enclosing notebook.
3559− NotebookType string `json:"notebookType,omitempty"`
3560− // A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
3561− Scheme string `json:"scheme"`
3562− // A glob pattern.
3563− Pattern *GlobPattern `json:"pattern,omitempty"`
3564−}
3565−
3566−// @since 3.18.0
3567−//
3568−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentFilterWithCells
3569−type NotebookDocumentFilterWithCells struct {
3570− // The notebook to be synced If a string
3571− // value is provided it matches against the
3572− // notebook type. '*' matches every notebook.
3573− Notebook *Or_NotebookDocumentFilterWithCells_notebook `json:"notebook,omitempty"`
3574− // The cells of the matching notebook to be synced.
3575− Cells []NotebookCellLanguage `json:"cells"`
3576−}
3577−
3578−// @since 3.18.0
3579−//
3580−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentFilterWithNotebook
3581−type NotebookDocumentFilterWithNotebook struct {
3582− // The notebook to be synced If a string
3583− // value is provided it matches against the
3584− // notebook type. '*' matches every notebook.
3585− Notebook Or_NotebookDocumentFilterWithNotebook_notebook `json:"notebook"`
3586− // The cells of the matching notebook to be synced.
3587− Cells []NotebookCellLanguage `json:"cells,omitempty"`
3588−}
3589−
3590−// A literal to identify a notebook document in the client.
3591−//
3592−// @since 3.17.0
3593−//
3594−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentIdentifier
3595−type NotebookDocumentIdentifier struct {
3596− // The notebook document's uri.
3597− URI URI `json:"uri"`
3598−}
3599−
3600−// Notebook specific client capabilities.
3601−//
3602−// @since 3.17.0
3603−//
3604−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentSyncClientCapabilities
3605−type NotebookDocumentSyncClientCapabilities struct {
3606− // Whether implementation supports dynamic registration. If this is
3607− // set to `true` the client supports the new
3608− // `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
3609− // return value for the corresponding server capability as well.
3610− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
3611− // The client supports sending execution summary data per cell.
3612− ExecutionSummarySupport bool `json:"executionSummarySupport,omitempty"`
3613−}
3614−
3615−// Options specific to a notebook plus its cells
3616−// to be synced to the server.
3617−//
3618−// If a selector provides a notebook document
3619−// filter but no cell selector all cells of a
3620−// matching notebook document will be synced.
3621−//
3622−// If a selector provides no notebook document
3623−// filter but only a cell selector all notebook
3624−// document that contain at least one matching
3625−// cell will be synced.
3626−//
3627−// @since 3.17.0
3628−//
3629−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentSyncOptions
3630−type NotebookDocumentSyncOptions struct {
3631− // The notebooks to be synced
3632− NotebookSelector []Or_NotebookDocumentSyncOptions_notebookSelector_Elem `json:"notebookSelector"`
3633− // Whether save notification should be forwarded to
3634− // the server. Will only be honored if mode === `notebook`.
3635− Save bool `json:"save,omitempty"`
3636−}
3637−
3638−// Registration options specific to a notebook.
3639−//
3640−// @since 3.17.0
3641−//
3642−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentSyncRegistrationOptions
3643−type NotebookDocumentSyncRegistrationOptions struct {
3644− NotebookDocumentSyncOptions
3645− StaticRegistrationOptions
3646−}
3647−
3648−// A text document identifier to optionally denote a specific version of a text document.
3649−//
3650−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#optionalVersionedTextDocumentIdentifier
3651−type OptionalVersionedTextDocumentIdentifier struct {
3652− // The version number of this document. If a versioned text document identifier
3653− // is sent from the server to the client and the file is not open in the editor
3654− // (the server has not received an open notification before) the server can send
3655− // `null` to indicate that the version is unknown and the content on disk is the
3656− // truth (as specified with document content ownership).
3657− Version int32 `json:"version"`
3658− TextDocumentIdentifier
3659−}
3660−
3661−// created for Or [int32 string]
3662−type Or_CancelParams_id struct {
3663− Value interface{} `json:"value"`
3664−}
3665−
3666−// created for Or [ClientSemanticTokensRequestFullDelta bool]
3667−type Or_ClientSemanticTokensRequestOptions_full struct {
3668− Value interface{} `json:"value"`
3669−}
3670−
3671−// created for Or [Lit_ClientSemanticTokensRequestOptions_range_Item1 bool]
3672−type Or_ClientSemanticTokensRequestOptions_range struct {
3673− Value interface{} `json:"value"`
3674−}
3675−
3676−// created for Or [EditRangeWithInsertReplace Range]
3677−type Or_CompletionItemDefaults_editRange struct {
3678− Value interface{} `json:"value"`
3679−}
3680−
3681−// created for Or [MarkupContent string]
3682−type Or_CompletionItem_documentation struct {
3683− Value interface{} `json:"value"`
3684−}
3685−
3686−// created for Or [InsertReplaceEdit TextEdit]
3687−type Or_CompletionItem_textEdit struct {
3688− Value interface{} `json:"value"`
3689−}
3690−
3691−// created for Or [Location []Location]
3692−type Or_Declaration struct {
3693− Value interface{} `json:"value"`
3694−}
3695−
3696−// created for Or [Location []Location]
3697−type Or_Definition struct {
3698− Value interface{} `json:"value"`
3699−}
3700−
3701−// created for Or [int32 string]
3702−type Or_Diagnostic_code struct {
3703− Value interface{} `json:"value"`
3704−}
3705−
3706−// created for Or [[]string string]
3707−type Or_DidChangeConfigurationRegistrationOptions_section struct {
3708− Value interface{} `json:"value"`
3709−}
3710−
3711−// created for Or [RelatedFullDocumentDiagnosticReport RelatedUnchangedDocumentDiagnosticReport]
3712−type Or_DocumentDiagnosticReport struct {
3713− Value interface{} `json:"value"`
3714−}
3715−
3716−// created for Or [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]
3717−type Or_DocumentDiagnosticReportPartialResult_relatedDocuments_Value struct {
3718− Value interface{} `json:"value"`
3719−}
3720−
3721−// created for Or [NotebookCellTextDocumentFilter TextDocumentFilter]
3722−type Or_DocumentFilter struct {
3723− Value interface{} `json:"value"`
3724−}
3725−
3726−// created for Or [Pattern RelativePattern]
3727−type Or_GlobPattern struct {
3728− Value interface{} `json:"value"`
3729−}
3730−
3731−// created for Or [MarkedString MarkupContent []MarkedString]
3732−type Or_Hover_contents struct {
3733− Value interface{} `json:"value"`
3734−}
3735−
3736−// created for Or [MarkupContent string]
3737−type Or_InlayHintLabelPart_tooltip struct {
3738− Value interface{} `json:"value"`
3739−}
3740−
3741−// created for Or [[]InlayHintLabelPart string]
3742−type Or_InlayHint_label struct {
3743− Value interface{} `json:"value"`
3744−}
3745−
3746−// created for Or [MarkupContent string]
3747−type Or_InlayHint_tooltip struct {
3748− Value interface{} `json:"value"`
3749−}
3750−
3751−// created for Or [StringValue string]
3752−type Or_InlineCompletionItem_insertText struct {
3753− Value interface{} `json:"value"`
3754−}
3755−
3756−// created for Or [InlineValueEvaluatableExpression InlineValueText InlineValueVariableLookup]
3757−type Or_InlineValue struct {
3758− Value interface{} `json:"value"`
3759−}
3760−
3761−// created for Or [LSPArray LSPObject bool float64 int32 string uint32]
3762−type Or_LSPAny struct {
3763− Value interface{} `json:"value"`
3764−}
3765−
3766−// created for Or [MarkedStringWithLanguage string]
3767−type Or_MarkedString struct {
3768− Value interface{} `json:"value"`
3769−}
3770−
3771−// created for Or [NotebookDocumentFilter string]
3772−type Or_NotebookCellTextDocumentFilter_notebook struct {
3773− Value interface{} `json:"value"`
3774−}
3775−
3776−// created for Or [NotebookDocumentFilterNotebookType NotebookDocumentFilterPattern NotebookDocumentFilterScheme]
3777−type Or_NotebookDocumentFilter struct {
3778− Value interface{} `json:"value"`
3779−}
3780−
3781−// created for Or [NotebookDocumentFilter string]
3782−type Or_NotebookDocumentFilterWithCells_notebook struct {
3783− Value interface{} `json:"value"`
3784−}
3785−
3786−// created for Or [NotebookDocumentFilter string]
3787−type Or_NotebookDocumentFilterWithNotebook_notebook struct {
3788− Value interface{} `json:"value"`
3789−}
3790−
3791−// created for Or [NotebookDocumentFilterWithCells NotebookDocumentFilterWithNotebook]
3792−type Or_NotebookDocumentSyncOptions_notebookSelector_Elem struct {
3793− Value interface{} `json:"value"`
3794−}
3795−
3796−// created for Or [MarkupContent string]
3797−type Or_ParameterInformation_documentation struct {
3798− Value interface{} `json:"value"`
3799−}
3800−
3801−// created for Or [Tuple_ParameterInformation_label_Item1 string]
3802−type Or_ParameterInformation_label struct {
3803− Value interface{} `json:"value"`
3804−}
3805−
3806−// created for Or [PrepareRenameDefaultBehavior PrepareRenamePlaceholder Range]
3807−type Or_PrepareRenameResult struct {
3808− Value interface{} `json:"value"`
3809−}
3810−
3811−// created for Or [int32 string]
3812−type Or_ProgressToken struct {
3813− Value interface{} `json:"value"`
3814−}
3815−
3816−// created for Or [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]
3817−type Or_RelatedFullDocumentDiagnosticReport_relatedDocuments_Value struct {
3818− Value interface{} `json:"value"`
3819−}
3820−
3821−// created for Or [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]
3822−type Or_RelatedUnchangedDocumentDiagnosticReport_relatedDocuments_Value struct {
3823− Value interface{} `json:"value"`
3824−}
3825−
3826−// created for Or [URI WorkspaceFolder]
3827−type Or_RelativePattern_baseUri struct {
3828− Value interface{} `json:"value"`
3829−}
3830−
3831−// created for Or [CodeAction Command]
3832−type Or_Result_textDocument_codeAction_Item0_Elem struct {
3833− Value interface{} `json:"value"`
3834−}
3835−
3836−// created for Or [CompletionList []CompletionItem]
3837−type Or_Result_textDocument_completion struct {
3838− Value interface{} `json:"value"`
3839−}
3840−
3841−// created for Or [Declaration []DeclarationLink]
3842−type Or_Result_textDocument_declaration struct {
3843− Value interface{} `json:"value"`
3844−}
3845−
3846−// created for Or [Definition []DefinitionLink]
3847−type Or_Result_textDocument_definition struct {
3848− Value interface{} `json:"value"`
3849−}
3850−
3851−// created for Or [[]DocumentSymbol []SymbolInformation]
3852−type Or_Result_textDocument_documentSymbol struct {
3853− Value interface{} `json:"value"`
3854−}
3855−
3856−// created for Or [Definition []DefinitionLink]
3857−type Or_Result_textDocument_implementation struct {
3858− Value interface{} `json:"value"`
3859−}
3860−
3861−// created for Or [InlineCompletionList []InlineCompletionItem]
3862−type Or_Result_textDocument_inlineCompletion struct {
3863− Value interface{} `json:"value"`
3864−}
3865−
3866−// created for Or [SemanticTokens SemanticTokensDelta]
3867−type Or_Result_textDocument_semanticTokens_full_delta struct {
3868− Value interface{} `json:"value"`
3869−}
3870−
3871−// created for Or [Definition []DefinitionLink]
3872−type Or_Result_textDocument_typeDefinition struct {
3873− Value interface{} `json:"value"`
3874−}
3875−
3876−// created for Or [[]SymbolInformation []WorkspaceSymbol]
3877−type Or_Result_workspace_symbol struct {
3878− Value interface{} `json:"value"`
3879−}
3880−
3881−// created for Or [SemanticTokensFullDelta bool]
3882−type Or_SemanticTokensOptions_full struct {
3883− Value interface{} `json:"value"`
3884−}
3885−
3886−// created for Or [Lit_SemanticTokensOptions_range_Item1 bool]
3887−type Or_SemanticTokensOptions_range struct {
3888− Value interface{} `json:"value"`
3889−}
3890−
3891−// created for Or [CallHierarchyOptions CallHierarchyRegistrationOptions bool]
3892−type Or_ServerCapabilities_callHierarchyProvider struct {
3893− Value interface{} `json:"value"`
3894−}
3895−
3896−// created for Or [CodeActionOptions bool]
3897−type Or_ServerCapabilities_codeActionProvider struct {
3898− Value interface{} `json:"value"`
3899−}
3900−
3901−// created for Or [DocumentColorOptions DocumentColorRegistrationOptions bool]
3902−type Or_ServerCapabilities_colorProvider struct {
3903− Value interface{} `json:"value"`
3904−}
3905−
3906−// created for Or [DeclarationOptions DeclarationRegistrationOptions bool]
3907−type Or_ServerCapabilities_declarationProvider struct {
3908− Value interface{} `json:"value"`
3909−}
3910−
3911−// created for Or [DefinitionOptions bool]
3912−type Or_ServerCapabilities_definitionProvider struct {
3913− Value interface{} `json:"value"`
3914−}
3915−
3916−// created for Or [DiagnosticOptions DiagnosticRegistrationOptions]
3917−type Or_ServerCapabilities_diagnosticProvider struct {
3918− Value interface{} `json:"value"`
3919−}
3920−
3921−// created for Or [DocumentFormattingOptions bool]
3922−type Or_ServerCapabilities_documentFormattingProvider struct {
3923− Value interface{} `json:"value"`
3924−}
3925−
3926−// created for Or [DocumentHighlightOptions bool]
3927−type Or_ServerCapabilities_documentHighlightProvider struct {
3928− Value interface{} `json:"value"`
3929−}
3930−
3931−// created for Or [DocumentRangeFormattingOptions bool]
3932−type Or_ServerCapabilities_documentRangeFormattingProvider struct {
3933− Value interface{} `json:"value"`
3934−}
3935−
3936−// created for Or [DocumentSymbolOptions bool]
3937−type Or_ServerCapabilities_documentSymbolProvider struct {
3938− Value interface{} `json:"value"`
3939−}
3940−
3941−// created for Or [FoldingRangeOptions FoldingRangeRegistrationOptions bool]
3942−type Or_ServerCapabilities_foldingRangeProvider struct {
3943− Value interface{} `json:"value"`
3944−}
3945−
3946−// created for Or [HoverOptions bool]
3947−type Or_ServerCapabilities_hoverProvider struct {
3948− Value interface{} `json:"value"`
3949−}
3950−
3951−// created for Or [ImplementationOptions ImplementationRegistrationOptions bool]
3952−type Or_ServerCapabilities_implementationProvider struct {
3953− Value interface{} `json:"value"`
3954−}
3955−
3956−// created for Or [InlayHintOptions InlayHintRegistrationOptions bool]
3957−type Or_ServerCapabilities_inlayHintProvider struct {
3958− Value interface{} `json:"value"`
3959−}
3960−
3961−// created for Or [InlineCompletionOptions bool]
3962−type Or_ServerCapabilities_inlineCompletionProvider struct {
3963− Value interface{} `json:"value"`
3964−}
3965−
3966−// created for Or [InlineValueOptions InlineValueRegistrationOptions bool]
3967−type Or_ServerCapabilities_inlineValueProvider struct {
3968− Value interface{} `json:"value"`
3969−}
3970−
3971−// created for Or [LinkedEditingRangeOptions LinkedEditingRangeRegistrationOptions bool]
3972−type Or_ServerCapabilities_linkedEditingRangeProvider struct {
3973− Value interface{} `json:"value"`
3974−}
3975−
3976−// created for Or [MonikerOptions MonikerRegistrationOptions bool]
3977−type Or_ServerCapabilities_monikerProvider struct {
3978− Value interface{} `json:"value"`
3979−}
3980−
3981−// created for Or [NotebookDocumentSyncOptions NotebookDocumentSyncRegistrationOptions]
3982−type Or_ServerCapabilities_notebookDocumentSync struct {
3983− Value interface{} `json:"value"`
3984−}
3985−
3986−// created for Or [ReferenceOptions bool]
3987−type Or_ServerCapabilities_referencesProvider struct {
3988− Value interface{} `json:"value"`
3989−}
3990−
3991−// created for Or [RenameOptions bool]
3992−type Or_ServerCapabilities_renameProvider struct {
3993− Value interface{} `json:"value"`
3994−}
3995−
3996−// created for Or [SelectionRangeOptions SelectionRangeRegistrationOptions bool]
3997−type Or_ServerCapabilities_selectionRangeProvider struct {
3998− Value interface{} `json:"value"`
3999−}
4000−
4001−// created for Or [SemanticTokensOptions SemanticTokensRegistrationOptions]
4002−type Or_ServerCapabilities_semanticTokensProvider struct {
4003− Value interface{} `json:"value"`
4004−}
4005−
4006−// created for Or [TextDocumentSyncKind TextDocumentSyncOptions]
4007−type Or_ServerCapabilities_textDocumentSync struct {
4008− Value interface{} `json:"value"`
4009−}
4010−
4011−// created for Or [TypeDefinitionOptions TypeDefinitionRegistrationOptions bool]
4012−type Or_ServerCapabilities_typeDefinitionProvider struct {
4013− Value interface{} `json:"value"`
4014−}
4015−
4016−// created for Or [TypeHierarchyOptions TypeHierarchyRegistrationOptions bool]
4017−type Or_ServerCapabilities_typeHierarchyProvider struct {
4018− Value interface{} `json:"value"`
4019−}
4020−
4021−// created for Or [WorkspaceSymbolOptions bool]
4022−type Or_ServerCapabilities_workspaceSymbolProvider struct {
4023− Value interface{} `json:"value"`
4024−}
4025−
4026−// created for Or [MarkupContent string]
4027−type Or_SignatureInformation_documentation struct {
4028− Value interface{} `json:"value"`
4029−}
4030−
4031−// created for Or [TextDocumentContentChangePartial TextDocumentContentChangeWholeDocument]
4032−type Or_TextDocumentContentChangeEvent struct {
4033− Value interface{} `json:"value"`
4034−}
4035−
4036−// created for Or [AnnotatedTextEdit SnippetTextEdit TextEdit]
4037−type Or_TextDocumentEdit_edits_Elem struct {
4038− Value interface{} `json:"value"`
4039−}
4040−
4041−// created for Or [TextDocumentFilterLanguage TextDocumentFilterPattern TextDocumentFilterScheme]
4042−type Or_TextDocumentFilter struct {
4043− Value interface{} `json:"value"`
4044−}
4045−
4046−// created for Or [SaveOptions bool]
4047−type Or_TextDocumentSyncOptions_save struct {
4048− Value interface{} `json:"value"`
4049−}
4050−
4051−// created for Or [WorkspaceFullDocumentDiagnosticReport WorkspaceUnchangedDocumentDiagnosticReport]
4052−type Or_WorkspaceDocumentDiagnosticReport struct {
4053− Value interface{} `json:"value"`
4054−}
4055−
4056−// created for Or [CreateFile DeleteFile RenameFile TextDocumentEdit]
4057−type Or_WorkspaceEdit_documentChanges_Elem struct {
4058− Value interface{} `json:"value"`
4059−}
4060−
4061−// created for Or [bool string]
4062−type Or_WorkspaceFoldersServerCapabilities_changeNotifications struct {
4063− Value interface{} `json:"value"`
4064−}
4065−
4066−// created for Or [TextDocumentContentOptions TextDocumentContentRegistrationOptions]
4067−type Or_WorkspaceOptions_textDocumentContent struct {
4068− Value interface{} `json:"value"`
4069−}
4070−
4071−// created for Or [Location LocationUriOnly]
4072−type Or_WorkspaceSymbol_location struct {
4073− Value interface{} `json:"value"`
4074−}
4075−
4076−// The parameters of a configuration request.
4077−//
4078−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#configurationParams
4079−type ParamConfiguration struct {
4080− Items []ConfigurationItem `json:"items"`
4081−}
4082−
4083−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#initializeParams
4084−type ParamInitialize struct {
4085− XInitializeParams
4086− WorkspaceFoldersInitializeParams
4087−}
4088−
4089−// Represents a parameter of a callable-signature. A parameter can
4090−// have a label and a doc-comment.
4091−//
4092−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#parameterInformation
4093−type ParameterInformation struct {
4094− // The label of this parameter information.
4095− //
4096− // Either a string or an inclusive start and exclusive end offsets within its containing
4097− // signature label. (see SignatureInformation.label). The offsets are based on a UTF-16
4098− // string representation as `Position` and `Range` does.
4099− //
4100− // To avoid ambiguities a server should use the [start, end] offset value instead of using
4101− // a substring. Whether a client support this is controlled via `labelOffsetSupport` client
4102− // capability.
4103− //
4104− // *Note*: a label of type string should be a substring of its containing signature label.
4105− // Its intended use case is to highlight the parameter label part in the `SignatureInformation.label`.
4106− Label Or_ParameterInformation_label `json:"label"`
4107− // The human-readable doc-comment of this parameter. Will be shown
4108− // in the UI but can be omitted.
4109− Documentation *Or_ParameterInformation_documentation `json:"documentation,omitempty"`
4110−}
4111−
4112−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#partialResultParams
4113−type PartialResultParams struct {
4114− // An optional token that a server can use to report partial results (e.g. streaming) to
4115− // the client.
4116− PartialResultToken *ProgressToken `json:"partialResultToken,omitempty"`
4117−}
4118−
4119−// The glob pattern to watch relative to the base path. Glob patterns can have the following syntax:
4120−//
4121−// - `*` to match one or more characters in a path segment
4122−// - `?` to match on one character in a path segment
4123−// - `**` to match any number of path segments, including none
4124−// - `{}` to group conditions (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files)
4125−// - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …)
4126−// - `[!...]` 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`)
4127−//
4128−// @since 3.17.0
4129−//
4130−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#pattern
4131−type (
4132− Pattern = string // (alias)
4133− // Position in a text document expressed as zero-based line and character
4134− // offset. Prior to 3.17 the offsets were always based on a UTF-16 string
4135− // representation. So a string of the form `a𐐀b` the character offset of the
4136− // character `a` is 0, the character offset of `𐐀` is 1 and the character
4137− // offset of b is 3 since `𐐀` is represented using two code units in UTF-16.
4138− // Since 3.17 clients and servers can agree on a different string encoding
4139− // representation (e.g. UTF-8). The client announces it's supported encoding
4140− // via the client capability [`general.positionEncodings`](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#clientCapabilities).
4141− // The value is an array of position encodings the client supports, with
4142− // decreasing preference (e.g. the encoding at index `0` is the most preferred
4143− // one). To stay backwards compatible the only mandatory encoding is UTF-16
4144− // represented via the string `utf-16`. The server can pick one of the
4145− // encodings offered by the client and signals that encoding back to the
4146− // client via the initialize result's property
4147− // [`capabilities.positionEncoding`](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#serverCapabilities). If the string value
4148− // `utf-16` is missing from the client's capability `general.positionEncodings`
4149− // servers can safely assume that the client supports UTF-16. If the server
4150− // omits the position encoding in its initialize result the encoding defaults
4151− // to the string value `utf-16`. Implementation considerations: since the
4152− // conversion from one encoding into another requires the content of the
4153− // file / line the conversion is best done where the file is read which is
4154− // usually on the server side.
4155− //
4156− // Positions are line end character agnostic. So you can not specify a position
4157− // that denotes `\r|\n` or `\n|` where `|` represents the character offset.
4158− //
4159− // @since 3.17.0 - support for negotiated position encoding.
4160− //
4161− // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#position
4162− Position struct {
4163− // Line position in a document (zero-based).
4164− //
4165− // 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.
4166− // If a line number is negative, it defaults to 0.
4167− Line uint32 `json:"line"`
4168− // Character offset on a line in a document (zero-based).
4169− //
4170− // The meaning of this offset is determined by the negotiated
4171− // `PositionEncodingKind`.
4172− //
4173− // If the character value is greater than the line length it defaults back to the
4174− // line length.
4175− Character uint32 `json:"character"`
4176− }
4177−)
4178−
4179−// A set of predefined position encoding kinds.
4180−//
4181−// @since 3.17.0
4182−type PositionEncodingKind string
4183−
4184−// @since 3.18.0
4185−//
4186−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#prepareRenameDefaultBehavior
4187−type PrepareRenameDefaultBehavior struct {
4188− DefaultBehavior bool `json:"defaultBehavior"`
4189−}
4190−
4191−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#prepareRenameParams
4192−type PrepareRenameParams struct {
4193− TextDocumentPositionParams
4194− WorkDoneProgressParams
4195−}
4196−
4197−// @since 3.18.0
4198−//
4199−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#prepareRenamePlaceholder
4200−type PrepareRenamePlaceholder struct {
4201− Range Range `json:"range"`
4202− Placeholder string `json:"placeholder"`
4203−}
4204−
4205−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#prepareRenameResult
4206−type (
4207− PrepareRenameResult = Or_PrepareRenameResult // (alias)
4208− PrepareSupportDefaultBehavior uint32
4209−)
4210−
4211−// A previous result id in a workspace pull request.
4212−//
4213−// @since 3.17.0
4214−//
4215−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#previousResultId
4216−type PreviousResultID struct {
4217− // The URI for which the client knowns a
4218− // result id.
4219− URI DocumentURI `json:"uri"`
4220− // The value of the previous result id.
4221− Value string `json:"value"`
4222−}
4223−
4224−// A previous result id in a workspace pull request.
4225−//
4226−// @since 3.17.0
4227−//
4228−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#previousResultId
4229−type PreviousResultId struct {
4230− // The URI for which the client knowns a
4231− // result id.
4232− URI DocumentURI `json:"uri"`
4233− // The value of the previous result id.
4234− Value string `json:"value"`
4235−}
4236−
4237−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#progressParams
4238−type ProgressParams struct {
4239− // The progress token provided by the client or server.
4240− Token ProgressToken `json:"token"`
4241− // The progress data.
4242− Value interface{} `json:"value"`
4243−}
4244−
4245−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#progressToken
4246−type (
4247− ProgressToken = Or_ProgressToken // (alias)
4248− // The publish diagnostic client capabilities.
4249− //
4250− // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#publishDiagnosticsClientCapabilities
4251− PublishDiagnosticsClientCapabilities struct {
4252− // Whether the client interprets the version property of the
4253− // `textDocument/publishDiagnostics` notification's parameter.
4254− //
4255− // @since 3.15.0
4256− VersionSupport bool `json:"versionSupport,omitempty"`
4257− DiagnosticsCapabilities
4258− }
4259−)
4260−
4261−// The publish diagnostic notification's parameters.
4262−//
4263−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#publishDiagnosticsParams
4264−type PublishDiagnosticsParams struct {
4265− // The URI for which diagnostic information is reported.
4266− URI DocumentURI `json:"uri"`
4267− // Optional the version number of the document the diagnostics are published for.
4268− //
4269− // @since 3.15.0
4270− Version int32 `json:"version,omitempty"`
4271− // An array of diagnostic information items.
4272− Diagnostics []Diagnostic `json:"diagnostics"`
4273−}
4274−
4275−// A range in a text document expressed as (zero-based) start and end positions.
4276−//
4277−// If you want to specify a range that contains a line including the line ending
4278−// character(s) then use an end position denoting the start of the next line.
4279−// For example:
4280−// ```ts
4281−//
4282−// {
4283−// start: { line: 5, character: 23 }
4284−// end : { line 6, character : 0 }
4285−// }
4286−//
4287−// ```
4288−//
4289−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#range
4290−type Range struct {
4291− // The range's start position.
4292− Start Position `json:"start"`
4293− // The range's end position.
4294− End Position `json:"end"`
4295−}
4296−
4297−// Client Capabilities for a {@link ReferencesRequest}.
4298−//
4299−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#referenceClientCapabilities
4300−type ReferenceClientCapabilities struct {
4301− // Whether references supports dynamic registration.
4302− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
4303−}
4304−
4305−// Value-object that contains additional information when
4306−// requesting references.
4307−//
4308−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#referenceContext
4309−type ReferenceContext struct {
4310− // Include the declaration of the current symbol.
4311− IncludeDeclaration bool `json:"includeDeclaration"`
4312−}
4313−
4314−// Reference options.
4315−//
4316−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#referenceOptions
4317−type ReferenceOptions struct {
4318− WorkDoneProgressOptions
4319−}
4320−
4321−// Parameters for a {@link ReferencesRequest}.
4322−//
4323−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#referenceParams
4324−type ReferenceParams struct {
4325− Context ReferenceContext `json:"context"`
4326− TextDocumentPositionParams
4327− WorkDoneProgressParams
4328− PartialResultParams
4329−}
4330−
4331−// Registration options for a {@link ReferencesRequest}.
4332−//
4333−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#referenceRegistrationOptions
4334−type ReferenceRegistrationOptions struct {
4335− TextDocumentRegistrationOptions
4336− ReferenceOptions
4337−}
4338−
4339−// General parameters to register for a notification or to register a provider.
4340−//
4341−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#registration
4342−type Registration struct {
4343− // The id used to register the request. The id can be used to deregister
4344− // the request again.
4345− ID string `json:"id"`
4346− // The method / capability to register for.
4347− Method string `json:"method"`
4348− // Options necessary for the registration.
4349− RegisterOptions interface{} `json:"registerOptions,omitempty"`
4350−}
4351−
4352−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#registrationParams
4353−type RegistrationParams struct {
4354− Registrations []Registration `json:"registrations"`
4355−}
4356−
4357−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#regularExpressionEngineKind
4358−type (
4359− RegularExpressionEngineKind = string // (alias)
4360− // Client capabilities specific to regular expressions.
4361− //
4362− // @since 3.16.0
4363− //
4364− // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#regularExpressionsClientCapabilities
4365− RegularExpressionsClientCapabilities struct {
4366− // The engine's name.
4367− Engine RegularExpressionEngineKind `json:"engine"`
4368− // The engine's version.
4369− Version string `json:"version,omitempty"`
4370− }
4371−)
4372−
4373−// A full diagnostic report with a set of related documents.
4374−//
4375−// @since 3.17.0
4376−//
4377−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#relatedFullDocumentDiagnosticReport
4378−type RelatedFullDocumentDiagnosticReport struct {
4379− // Diagnostics of related documents. This information is useful
4380− // in programming languages where code in a file A can generate
4381− // diagnostics in a file B which A depends on. An example of
4382− // such a language is C/C++ where marco definitions in a file
4383− // a.cpp and result in errors in a header file b.hpp.
4384− //
4385− // @since 3.17.0
4386− RelatedDocuments map[DocumentURI]interface{} `json:"relatedDocuments,omitempty"`
4387− FullDocumentDiagnosticReport
4388−}
4389−
4390−// An unchanged diagnostic report with a set of related documents.
4391−//
4392−// @since 3.17.0
4393−//
4394−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#relatedUnchangedDocumentDiagnosticReport
4395−type RelatedUnchangedDocumentDiagnosticReport struct {
4396− // Diagnostics of related documents. This information is useful
4397− // in programming languages where code in a file A can generate
4398− // diagnostics in a file B which A depends on. An example of
4399− // such a language is C/C++ where marco definitions in a file
4400− // a.cpp and result in errors in a header file b.hpp.
4401− //
4402− // @since 3.17.0
4403− RelatedDocuments map[DocumentURI]interface{} `json:"relatedDocuments,omitempty"`
4404− UnchangedDocumentDiagnosticReport
4405−}
4406−
4407−// A relative pattern is a helper to construct glob patterns that are matched
4408−// relatively to a base URI. The common value for a `baseUri` is a workspace
4409−// folder root, but it can be another absolute URI as well.
4410−//
4411−// @since 3.17.0
4412−//
4413−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#relativePattern
4414−type RelativePattern struct {
4415− // A workspace folder or a base URI to which this pattern will be matched
4416− // against relatively.
4417− BaseURI Or_RelativePattern_baseUri `json:"baseUri"`
4418− // The actual glob pattern;
4419− Pattern Pattern `json:"pattern"`
4420−}
4421−
4422−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#renameClientCapabilities
4423−type RenameClientCapabilities struct {
4424− // Whether rename supports dynamic registration.
4425− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
4426− // Client supports testing for validity of rename operations
4427− // before execution.
4428− //
4429− // @since 3.12.0
4430− PrepareSupport bool `json:"prepareSupport,omitempty"`
4431− // Client supports the default behavior result.
4432− //
4433− // The value indicates the default behavior used by the
4434− // client.
4435− //
4436− // @since 3.16.0
4437− PrepareSupportDefaultBehavior *PrepareSupportDefaultBehavior `json:"prepareSupportDefaultBehavior,omitempty"`
4438− // Whether the client honors the change annotations in
4439− // text edits and resource operations returned via the
4440− // rename request's workspace edit by for example presenting
4441− // the workspace edit in the user interface and asking
4442− // for confirmation.
4443− //
4444− // @since 3.16.0
4445− HonorsChangeAnnotations bool `json:"honorsChangeAnnotations,omitempty"`
4446−}
4447−
4448−// Rename file operation
4449−//
4450−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#renameFile
4451−type RenameFile struct {
4452− // A rename
4453− Kind string `json:"kind"`
4454− // The old (existing) location.
4455− OldURI DocumentURI `json:"oldUri"`
4456− // The new location.
4457− NewURI DocumentURI `json:"newUri"`
4458− // Rename options.
4459− Options *RenameFileOptions `json:"options,omitempty"`
4460− ResourceOperation
4461−}
4462−
4463−// Rename file options
4464−//
4465−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#renameFileOptions
4466−type RenameFileOptions struct {
4467− // Overwrite target if existing. Overwrite wins over `ignoreIfExists`
4468− Overwrite bool `json:"overwrite,omitempty"`
4469− // Ignores if target exists.
4470− IgnoreIfExists bool `json:"ignoreIfExists,omitempty"`
4471−}
4472−
4473−// The parameters sent in notifications/requests for user-initiated renames of
4474−// files.
4475−//
4476−// @since 3.16.0
4477−//
4478−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#renameFilesParams
4479−type RenameFilesParams struct {
4480− // An array of all files/folders renamed in this operation. When a folder is renamed, only
4481− // the folder will be included, and not its children.
4482− Files []FileRename `json:"files"`
4483−}
4484−
4485−// Provider options for a {@link RenameRequest}.
4486−//
4487−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#renameOptions
4488−type RenameOptions struct {
4489− // Renames should be checked and tested before being executed.
4490− //
4491− // @since version 3.12.0
4492− PrepareProvider bool `json:"prepareProvider,omitempty"`
4493− WorkDoneProgressOptions
4494−}
4495−
4496−// The parameters of a {@link RenameRequest}.
4497−//
4498−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#renameParams
4499−type RenameParams struct {
4500− // The document to rename.
4501− TextDocument TextDocumentIdentifier `json:"textDocument"`
4502− // The position at which this request was sent.
4503− Position Position `json:"position"`
4504− // The new name of the symbol. If the given name is not valid the
4505− // request must return a {@link ResponseError} with an
4506− // appropriate message set.
4507− NewName string `json:"newName"`
4508− WorkDoneProgressParams
4509−}
4510−
4511−// Registration options for a {@link RenameRequest}.
4512−//
4513−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#renameRegistrationOptions
4514−type RenameRegistrationOptions struct {
4515− TextDocumentRegistrationOptions
4516− RenameOptions
4517−}
4518−
4519−// A generic resource operation.
4520−//
4521−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#resourceOperation
4522−type ResourceOperation struct {
4523− // The resource operation kind.
4524− Kind string `json:"kind"`
4525− // An optional annotation identifier describing the operation.
4526− //
4527− // @since 3.16.0
4528− AnnotationID *ChangeAnnotationIdentifier `json:"annotationId,omitempty"`
4529−}
4530−type ResourceOperationKind string
4531−
4532−// Save options.
4533−//
4534−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#saveOptions
4535−type SaveOptions struct {
4536− // The client is supposed to include the content on save.
4537− IncludeText bool `json:"includeText,omitempty"`
4538−}
4539−
4540−// Describes the currently selected completion item.
4541−//
4542−// @since 3.18.0
4543−// @proposed
4544−//
4545−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#selectedCompletionInfo
4546−type SelectedCompletionInfo struct {
4547− // The range that will be replaced if this completion item is accepted.
4548− Range Range `json:"range"`
4549− // The text the range will be replaced with if this completion is accepted.
4550− Text string `json:"text"`
4551−}
4552−
4553−// A selection range represents a part of a selection hierarchy. A selection range
4554−// may have a parent selection range that contains it.
4555−//
4556−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#selectionRange
4557−type SelectionRange struct {
4558− // The {@link Range range} of this selection range.
4559− Range Range `json:"range"`
4560− // The parent selection range containing this range. Therefore `parent.range` must contain `this.range`.
4561− Parent *SelectionRange `json:"parent,omitempty"`
4562−}
4563−
4564−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#selectionRangeClientCapabilities
4565−type SelectionRangeClientCapabilities struct {
4566− // Whether implementation supports dynamic registration for selection range providers. If this is set to `true`
4567− // the client supports the new `SelectionRangeRegistrationOptions` return value for the corresponding server
4568− // capability as well.
4569− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
4570−}
4571−
4572−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#selectionRangeOptions
4573−type SelectionRangeOptions struct {
4574− WorkDoneProgressOptions
4575−}
4576−
4577−// A parameter literal used in selection range requests.
4578−//
4579−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#selectionRangeParams
4580−type SelectionRangeParams struct {
4581− // The text document.
4582− TextDocument TextDocumentIdentifier `json:"textDocument"`
4583− // The positions inside the text document.
4584− Positions []Position `json:"positions"`
4585− WorkDoneProgressParams
4586− PartialResultParams
4587−}
4588−
4589−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#selectionRangeRegistrationOptions
4590−type SelectionRangeRegistrationOptions struct {
4591− SelectionRangeOptions
4592− TextDocumentRegistrationOptions
4593− StaticRegistrationOptions
4594−}
4595−
4596−// A set of predefined token modifiers. This set is not fixed
4597−// an clients can specify additional token types via the
4598−// corresponding client capabilities.
4599−//
4600−// @since 3.16.0
4601−type SemanticTokenModifiers string
4602−
4603−// A set of predefined token types. This set is not fixed
4604−// an clients can specify additional token types via the
4605−// corresponding client capabilities.
4606−//
4607−// @since 3.16.0
4608−type SemanticTokenTypes string
4609−
4610−// @since 3.16.0
4611−//
4612−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokens
4613−type SemanticTokens struct {
4614− // An optional result id. If provided and clients support delta updating
4615− // the client will include the result id in the next semantic token request.
4616− // A server can then instead of computing all semantic tokens again simply
4617− // send a delta.
4618− ResultID string `json:"resultId,omitempty"`
4619− // The actual tokens.
4620− Data []uint32 `json:"data"`
4621−}
4622−
4623−// @since 3.16.0
4624−//
4625−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensClientCapabilities
4626−type SemanticTokensClientCapabilities struct {
4627− // Whether implementation supports dynamic registration. If this is set to `true`
4628− // the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
4629− // return value for the corresponding server capability as well.
4630− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
4631− // Which requests the client supports and might send to the server
4632− // depending on the server's capability. Please note that clients might not
4633− // show semantic tokens or degrade some of the user experience if a range
4634− // or full request is advertised by the client but not provided by the
4635− // server. If for example the client capability `requests.full` and
4636− // `request.range` are both set to true but the server only provides a
4637− // range provider the client might not render a minimap correctly or might
4638− // even decide to not show any semantic tokens at all.
4639− Requests ClientSemanticTokensRequestOptions `json:"requests"`
4640− // The token types that the client supports.
4641− TokenTypes []string `json:"tokenTypes"`
4642− // The token modifiers that the client supports.
4643− TokenModifiers []string `json:"tokenModifiers"`
4644− // The token formats the clients supports.
4645− Formats []TokenFormat `json:"formats"`
4646− // Whether the client supports tokens that can overlap each other.
4647− OverlappingTokenSupport bool `json:"overlappingTokenSupport,omitempty"`
4648− // Whether the client supports tokens that can span multiple lines.
4649− MultilineTokenSupport bool `json:"multilineTokenSupport,omitempty"`
4650− // Whether the client allows the server to actively cancel a
4651− // semantic token request, e.g. supports returning
4652− // LSPErrorCodes.ServerCancelled. If a server does the client
4653− // needs to retrigger the request.
4654− //
4655− // @since 3.17.0
4656− ServerCancelSupport bool `json:"serverCancelSupport,omitempty"`
4657− // Whether the client uses semantic tokens to augment existing
4658− // syntax tokens. If set to `true` client side created syntax
4659− // tokens and semantic tokens are both used for colorization. If
4660− // set to `false` the client only uses the returned semantic tokens
4661− // for colorization.
4662− //
4663− // If the value is `undefined` then the client behavior is not
4664− // specified.
4665− //
4666− // @since 3.17.0
4667− AugmentsSyntaxTokens bool `json:"augmentsSyntaxTokens,omitempty"`
4668−}
4669−
4670−// @since 3.16.0
4671−//
4672−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensDelta
4673−type SemanticTokensDelta struct {
4674− ResultID string `json:"resultId,omitempty"`
4675− // The semantic token edits to transform a previous result into a new result.
4676− Edits []SemanticTokensEdit `json:"edits"`
4677−}
4678−
4679−// @since 3.16.0
4680−//
4681−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensDeltaParams
4682−type SemanticTokensDeltaParams struct {
4683− // The text document.
4684− TextDocument TextDocumentIdentifier `json:"textDocument"`
4685− // The result id of a previous response. The result Id can either point to a full response
4686− // or a delta response depending on what was received last.
4687− PreviousResultID string `json:"previousResultId"`
4688− WorkDoneProgressParams
4689− PartialResultParams
4690−}
4691−
4692−// @since 3.16.0
4693−//
4694−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensDeltaPartialResult
4695−type SemanticTokensDeltaPartialResult struct {
4696− Edits []SemanticTokensEdit `json:"edits"`
4697−}
4698−
4699−// @since 3.16.0
4700−//
4701−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensEdit
4702−type SemanticTokensEdit struct {
4703− // The start offset of the edit.
4704− Start uint32 `json:"start"`
4705− // The count of elements to remove.
4706− DeleteCount uint32 `json:"deleteCount"`
4707− // The elements to insert.
4708− Data []uint32 `json:"data,omitempty"`
4709−}
4710−
4711−// Semantic tokens options to support deltas for full documents
4712−//
4713−// @since 3.18.0
4714−//
4715−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensFullDelta
4716−type SemanticTokensFullDelta struct {
4717− // The server supports deltas for full documents.
4718− Delta bool `json:"delta,omitempty"`
4719−}
4720−
4721−// @since 3.16.0
4722−//
4723−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensLegend
4724−type SemanticTokensLegend struct {
4725− // The token types a server uses.
4726− TokenTypes []string `json:"tokenTypes"`
4727− // The token modifiers a server uses.
4728− TokenModifiers []string `json:"tokenModifiers"`
4729−}
4730−
4731−// @since 3.16.0
4732−//
4733−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensOptions
4734−type SemanticTokensOptions struct {
4735− // The legend used by the server
4736− Legend SemanticTokensLegend `json:"legend"`
4737− // Server supports providing semantic tokens for a specific range
4738− // of a document.
4739− Range *Or_SemanticTokensOptions_range `json:"range,omitempty"`
4740− // Server supports providing semantic tokens for a full document.
4741− Full *Or_SemanticTokensOptions_full `json:"full,omitempty"`
4742− WorkDoneProgressOptions
4743−}
4744−
4745−// @since 3.16.0
4746−//
4747−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensParams
4748−type SemanticTokensParams struct {
4749− // The text document.
4750− TextDocument TextDocumentIdentifier `json:"textDocument"`
4751− WorkDoneProgressParams
4752− PartialResultParams
4753−}
4754−
4755−// @since 3.16.0
4756−//
4757−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensPartialResult
4758−type SemanticTokensPartialResult struct {
4759− Data []uint32 `json:"data"`
4760−}
4761−
4762−// @since 3.16.0
4763−//
4764−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensRangeParams
4765−type SemanticTokensRangeParams struct {
4766− // The text document.
4767− TextDocument TextDocumentIdentifier `json:"textDocument"`
4768− // The range the semantic tokens are requested for.
4769− Range Range `json:"range"`
4770− WorkDoneProgressParams
4771− PartialResultParams
4772−}
4773−
4774−// @since 3.16.0
4775−//
4776−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensRegistrationOptions
4777−type SemanticTokensRegistrationOptions struct {
4778− TextDocumentRegistrationOptions
4779− SemanticTokensOptions
4780− StaticRegistrationOptions
4781−}
4782−
4783−// @since 3.16.0
4784−//
4785−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensWorkspaceClientCapabilities
4786−type SemanticTokensWorkspaceClientCapabilities struct {
4787− // Whether the client implementation supports a refresh request sent from
4788− // the server to the client.
4789− //
4790− // Note that this event is global and will force the client to refresh all
4791− // semantic tokens currently shown. It should be used with absolute care
4792− // and is useful for situation where a server for example detects a project
4793− // wide change that requires such a calculation.
4794− RefreshSupport bool `json:"refreshSupport,omitempty"`
4795−}
4796−
4797−// Defines the capabilities provided by a language
4798−// server.
4799−//
4800−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#serverCapabilities
4801−type ServerCapabilities struct {
4802− // The position encoding the server picked from the encodings offered
4803− // by the client via the client capability `general.positionEncodings`.
4804− //
4805− // If the client didn't provide any position encodings the only valid
4806− // value that a server can return is 'utf-16'.
4807− //
4808− // If omitted it defaults to 'utf-16'.
4809− //
4810− // @since 3.17.0
4811− PositionEncoding *PositionEncodingKind `json:"positionEncoding,omitempty"`
4812− // Defines how text documents are synced. Is either a detailed structure
4813− // defining each notification or for backwards compatibility the
4814− // TextDocumentSyncKind number.
4815− TextDocumentSync interface{} `json:"textDocumentSync,omitempty"`
4816− // Defines how notebook documents are synced.
4817− //
4818− // @since 3.17.0
4819− NotebookDocumentSync *Or_ServerCapabilities_notebookDocumentSync `json:"notebookDocumentSync,omitempty"`
4820− // The server provides completion support.
4821− CompletionProvider *CompletionOptions `json:"completionProvider,omitempty"`
4822− // The server provides hover support.
4823− HoverProvider *Or_ServerCapabilities_hoverProvider `json:"hoverProvider,omitempty"`
4824− // The server provides signature help support.
4825− SignatureHelpProvider *SignatureHelpOptions `json:"signatureHelpProvider,omitempty"`
4826− // The server provides Goto Declaration support.
4827− DeclarationProvider *Or_ServerCapabilities_declarationProvider `json:"declarationProvider,omitempty"`
4828− // The server provides goto definition support.
4829− DefinitionProvider *Or_ServerCapabilities_definitionProvider `json:"definitionProvider,omitempty"`
4830− // The server provides Goto Type Definition support.
4831− TypeDefinitionProvider *Or_ServerCapabilities_typeDefinitionProvider `json:"typeDefinitionProvider,omitempty"`
4832− // The server provides Goto Implementation support.
4833− ImplementationProvider *Or_ServerCapabilities_implementationProvider `json:"implementationProvider,omitempty"`
4834− // The server provides find references support.
4835− ReferencesProvider *Or_ServerCapabilities_referencesProvider `json:"referencesProvider,omitempty"`
4836− // The server provides document highlight support.
4837− DocumentHighlightProvider *Or_ServerCapabilities_documentHighlightProvider `json:"documentHighlightProvider,omitempty"`
4838− // The server provides document symbol support.
4839− DocumentSymbolProvider *Or_ServerCapabilities_documentSymbolProvider `json:"documentSymbolProvider,omitempty"`
4840− // The server provides code actions. CodeActionOptions may only be
4841− // specified if the client states that it supports
4842− // `codeActionLiteralSupport` in its initial `initialize` request.
4843− CodeActionProvider interface{} `json:"codeActionProvider,omitempty"`
4844− // The server provides code lens.
4845− CodeLensProvider *CodeLensOptions `json:"codeLensProvider,omitempty"`
4846− // The server provides document link support.
4847− DocumentLinkProvider *DocumentLinkOptions `json:"documentLinkProvider,omitempty"`
4848− // The server provides color provider support.
4849− ColorProvider *Or_ServerCapabilities_colorProvider `json:"colorProvider,omitempty"`
4850− // The server provides workspace symbol support.
4851− WorkspaceSymbolProvider *Or_ServerCapabilities_workspaceSymbolProvider `json:"workspaceSymbolProvider,omitempty"`
4852− // The server provides document formatting.
4853− DocumentFormattingProvider *Or_ServerCapabilities_documentFormattingProvider `json:"documentFormattingProvider,omitempty"`
4854− // The server provides document range formatting.
4855− DocumentRangeFormattingProvider *Or_ServerCapabilities_documentRangeFormattingProvider `json:"documentRangeFormattingProvider,omitempty"`
4856− // The server provides document formatting on typing.
4857− DocumentOnTypeFormattingProvider *DocumentOnTypeFormattingOptions `json:"documentOnTypeFormattingProvider,omitempty"`
4858− // The server provides rename support. RenameOptions may only be
4859− // specified if the client states that it supports
4860− // `prepareSupport` in its initial `initialize` request.
4861− RenameProvider interface{} `json:"renameProvider,omitempty"`
4862− // The server provides folding provider support.
4863− FoldingRangeProvider *Or_ServerCapabilities_foldingRangeProvider `json:"foldingRangeProvider,omitempty"`
4864− // The server provides selection range support.
4865− SelectionRangeProvider *Or_ServerCapabilities_selectionRangeProvider `json:"selectionRangeProvider,omitempty"`
4866− // The server provides execute command support.
4867− ExecuteCommandProvider *ExecuteCommandOptions `json:"executeCommandProvider,omitempty"`
4868− // The server provides call hierarchy support.
4869− //
4870− // @since 3.16.0
4871− CallHierarchyProvider *Or_ServerCapabilities_callHierarchyProvider `json:"callHierarchyProvider,omitempty"`
4872− // The server provides linked editing range support.
4873− //
4874− // @since 3.16.0
4875− LinkedEditingRangeProvider *Or_ServerCapabilities_linkedEditingRangeProvider `json:"linkedEditingRangeProvider,omitempty"`
4876− // The server provides semantic tokens support.
4877− //
4878− // @since 3.16.0
4879− SemanticTokensProvider interface{} `json:"semanticTokensProvider,omitempty"`
4880− // The server provides moniker support.
4881− //
4882− // @since 3.16.0
4883− MonikerProvider *Or_ServerCapabilities_monikerProvider `json:"monikerProvider,omitempty"`
4884− // The server provides type hierarchy support.
4885− //
4886− // @since 3.17.0
4887− TypeHierarchyProvider *Or_ServerCapabilities_typeHierarchyProvider `json:"typeHierarchyProvider,omitempty"`
4888− // The server provides inline values.
4889− //
4890− // @since 3.17.0
4891− InlineValueProvider *Or_ServerCapabilities_inlineValueProvider `json:"inlineValueProvider,omitempty"`
4892− // The server provides inlay hints.
4893− //
4894− // @since 3.17.0
4895− InlayHintProvider interface{} `json:"inlayHintProvider,omitempty"`
4896− // The server has support for pull model diagnostics.
4897− //
4898− // @since 3.17.0
4899− DiagnosticProvider *Or_ServerCapabilities_diagnosticProvider `json:"diagnosticProvider,omitempty"`
4900− // Inline completion options used during static registration.
4901− //
4902− // @since 3.18.0
4903− // @proposed
4904− InlineCompletionProvider *Or_ServerCapabilities_inlineCompletionProvider `json:"inlineCompletionProvider,omitempty"`
4905− // Workspace specific server capabilities.
4906− Workspace *WorkspaceOptions `json:"workspace,omitempty"`
4907− // Experimental server capabilities.
4908− Experimental interface{} `json:"experimental,omitempty"`
4909−}
4910−
4911−// @since 3.18.0
4912−//
4913−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#serverCompletionItemOptions
4914−type ServerCompletionItemOptions struct {
4915− // The server has support for completion item label
4916− // details (see also `CompletionItemLabelDetails`) when
4917− // receiving a completion item in a resolve call.
4918− //
4919− // @since 3.17.0
4920− LabelDetailsSupport bool `json:"labelDetailsSupport,omitempty"`
4921−}
4922−
4923−// Information about the server
4924−//
4925−// @since 3.15.0
4926−// @since 3.18.0 ServerInfo type name added.
4927−//
4928−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#serverInfo
4929−type ServerInfo struct {
4930− // The name of the server as defined by the server.
4931− Name string `json:"name"`
4932− // The server's version as defined by the server.
4933− Version string `json:"version,omitempty"`
4934−}
4935−
4936−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#setTraceParams
4937−type SetTraceParams struct {
4938− Value TraceValue `json:"value"`
4939−}
4940−
4941−// Client capabilities for the showDocument request.
4942−//
4943−// @since 3.16.0
4944−//
4945−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#showDocumentClientCapabilities
4946−type ShowDocumentClientCapabilities struct {
4947− // The client has support for the showDocument
4948− // request.
4949− Support bool `json:"support"`
4950−}
4951−
4952−// Params to show a resource in the UI.
4953−//
4954−// @since 3.16.0
4955−//
4956−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#showDocumentParams
4957−type ShowDocumentParams struct {
4958− // The uri to show.
4959− URI URI `json:"uri"`
4960− // Indicates to show the resource in an external program.
4961− // To show, for example, `https://code.visualstudio.com/`
4962− // in the default WEB browser set `external` to `true`.
4963− External bool `json:"external,omitempty"`
4964− // An optional property to indicate whether the editor
4965− // showing the document should take focus or not.
4966− // Clients might ignore this property if an external
4967− // program is started.
4968− TakeFocus bool `json:"takeFocus,omitempty"`
4969− // An optional selection range if the document is a text
4970− // document. Clients might ignore the property if an
4971− // external program is started or the file is not a text
4972− // file.
4973− Selection *Range `json:"selection,omitempty"`
4974−}
4975−
4976−// The result of a showDocument request.
4977−//
4978−// @since 3.16.0
4979−//
4980−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#showDocumentResult
4981−type ShowDocumentResult struct {
4982− // A boolean indicating if the show was successful.
4983− Success bool `json:"success"`
4984−}
4985−
4986−// The parameters of a notification message.
4987−//
4988−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#showMessageParams
4989−type ShowMessageParams struct {
4990− // The message type. See {@link MessageType}
4991− Type MessageType `json:"type"`
4992− // The actual message.
4993− Message string `json:"message"`
4994−}
4995−
4996−// Show message request client capabilities
4997−//
4998−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#showMessageRequestClientCapabilities
4999−type ShowMessageRequestClientCapabilities struct {
5000− // Capabilities specific to the `MessageActionItem` type.
5001− MessageActionItem *ClientShowMessageActionItemOptions `json:"messageActionItem,omitempty"`
5002−}
5003−
5004−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#showMessageRequestParams
5005−type ShowMessageRequestParams struct {
5006− // The message type. See {@link MessageType}
5007− Type MessageType `json:"type"`
5008− // The actual message.
5009− Message string `json:"message"`
5010− // The message action items to present.
5011− Actions []MessageActionItem `json:"actions,omitempty"`
5012−}
5013−
5014−// Signature help represents the signature of something
5015−// callable. There can be multiple signature but only one
5016−// active and only one active parameter.
5017−//
5018−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#signatureHelp
5019−type SignatureHelp struct {
5020− // One or more signatures.
5021− Signatures []SignatureInformation `json:"signatures"`
5022− // The active signature. If omitted or the value lies outside the
5023− // range of `signatures` the value defaults to zero or is ignored if
5024− // the `SignatureHelp` has no signatures.
5025− //
5026− // Whenever possible implementors should make an active decision about
5027− // the active signature and shouldn't rely on a default value.
5028− //
5029− // In future version of the protocol this property might become
5030− // mandatory to better express this.
5031− ActiveSignature uint32 `json:"activeSignature,omitempty"`
5032− // The active parameter of the active signature.
5033− //
5034− // If `null`, no parameter of the signature is active (for example a named
5035− // argument that does not match any declared parameters). This is only valid
5036− // if the client specifies the client capability
5037− // `textDocument.signatureHelp.noActiveParameterSupport === true`
5038− //
5039− // If omitted or the value lies outside the range of
5040− // `signatures[activeSignature].parameters` defaults to 0 if the active
5041− // signature has parameters.
5042− //
5043− // If the active signature has no parameters it is ignored.
5044− //
5045− // In future version of the protocol this property might become
5046− // mandatory (but still nullable) to better express the active parameter if
5047− // the active signature does have any.
5048− ActiveParameter uint32 `json:"activeParameter,omitempty"`
5049−}
5050−
5051−// Client Capabilities for a {@link SignatureHelpRequest}.
5052−//
5053−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#signatureHelpClientCapabilities
5054−type SignatureHelpClientCapabilities struct {
5055− // Whether signature help supports dynamic registration.
5056− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
5057− // The client supports the following `SignatureInformation`
5058− // specific properties.
5059− SignatureInformation *ClientSignatureInformationOptions `json:"signatureInformation,omitempty"`
5060− // The client supports to send additional context information for a
5061− // `textDocument/signatureHelp` request. A client that opts into
5062− // contextSupport will also support the `retriggerCharacters` on
5063− // `SignatureHelpOptions`.
5064− //
5065− // @since 3.15.0
5066− ContextSupport bool `json:"contextSupport,omitempty"`
5067−}
5068−
5069−// Additional information about the context in which a signature help request was triggered.
5070−//
5071−// @since 3.15.0
5072−//
5073−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#signatureHelpContext
5074−type SignatureHelpContext struct {
5075− // Action that caused signature help to be triggered.
5076− TriggerKind SignatureHelpTriggerKind `json:"triggerKind"`
5077− // Character that caused signature help to be triggered.
5078− //
5079− // This is undefined when `triggerKind !== SignatureHelpTriggerKind.TriggerCharacter`
5080− TriggerCharacter string `json:"triggerCharacter,omitempty"`
5081− // `true` if signature help was already showing when it was triggered.
5082− //
5083− // Retriggers occurs when the signature help is already active and can be caused by actions such as
5084− // typing a trigger character, a cursor move, or document content changes.
5085− IsRetrigger bool `json:"isRetrigger"`
5086− // The currently active `SignatureHelp`.
5087− //
5088− // The `activeSignatureHelp` has its `SignatureHelp.activeSignature` field updated based on
5089− // the user navigating through available signatures.
5090− ActiveSignatureHelp *SignatureHelp `json:"activeSignatureHelp,omitempty"`
5091−}
5092−
5093−// Server Capabilities for a {@link SignatureHelpRequest}.
5094−//
5095−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#signatureHelpOptions
5096−type SignatureHelpOptions struct {
5097− // List of characters that trigger signature help automatically.
5098− TriggerCharacters []string `json:"triggerCharacters,omitempty"`
5099− // List of characters that re-trigger signature help.
5100− //
5101− // These trigger characters are only active when signature help is already showing. All trigger characters
5102− // are also counted as re-trigger characters.
5103− //
5104− // @since 3.15.0
5105− RetriggerCharacters []string `json:"retriggerCharacters,omitempty"`
5106− WorkDoneProgressOptions
5107−}
5108−
5109−// Parameters for a {@link SignatureHelpRequest}.
5110−//
5111−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#signatureHelpParams
5112−type SignatureHelpParams struct {
5113− // The signature help context. This is only available if the client specifies
5114− // to send this using the client capability `textDocument.signatureHelp.contextSupport === true`
5115− //
5116− // @since 3.15.0
5117− Context *SignatureHelpContext `json:"context,omitempty"`
5118− TextDocumentPositionParams
5119− WorkDoneProgressParams
5120−}
5121−
5122−// Registration options for a {@link SignatureHelpRequest}.
5123−//
5124−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#signatureHelpRegistrationOptions
5125−type SignatureHelpRegistrationOptions struct {
5126− TextDocumentRegistrationOptions
5127− SignatureHelpOptions
5128−}
5129−
5130−// How a signature help was triggered.
5131−//
5132−// @since 3.15.0
5133−type SignatureHelpTriggerKind uint32
5134−
5135−// Represents the signature of something callable. A signature
5136−// can have a label, like a function-name, a doc-comment, and
5137−// a set of parameters.
5138−//
5139−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#signatureInformation
5140−type SignatureInformation struct {
5141− // The label of this signature. Will be shown in
5142− // the UI.
5143− Label string `json:"label"`
5144− // The human-readable doc-comment of this signature. Will be shown
5145− // in the UI but can be omitted.
5146− Documentation *Or_SignatureInformation_documentation `json:"documentation,omitempty"`
5147− // The parameters of this signature.
5148− Parameters []ParameterInformation `json:"parameters,omitempty"`
5149− // The index of the active parameter.
5150− //
5151− // If `null`, no parameter of the signature is active (for example a named
5152− // argument that does not match any declared parameters). This is only valid
5153− // if the client specifies the client capability
5154− // `textDocument.signatureHelp.noActiveParameterSupport === true`
5155− //
5156− // If provided (or `null`), this is used in place of
5157− // `SignatureHelp.activeParameter`.
5158− //
5159− // @since 3.16.0
5160− ActiveParameter uint32 `json:"activeParameter,omitempty"`
5161−}
5162−
5163−// An interactive text edit.
5164−//
5165−// @since 3.18.0
5166−// @proposed
5167−//
5168−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#snippetTextEdit
5169−type SnippetTextEdit struct {
5170− // The range of the text document to be manipulated.
5171− Range Range `json:"range"`
5172− // The snippet to be inserted.
5173− Snippet StringValue `json:"snippet"`
5174− // The actual identifier of the snippet edit.
5175− AnnotationID *ChangeAnnotationIdentifier `json:"annotationId,omitempty"`
5176−}
5177−
5178−// @since 3.18.0
5179−//
5180−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#staleRequestSupportOptions
5181−type StaleRequestSupportOptions struct {
5182− // The client will actively cancel the request.
5183− Cancel bool `json:"cancel"`
5184− // The list of requests for which the client
5185− // will retry the request if it receives a
5186− // response with error code `ContentModified`
5187− RetryOnContentModified []string `json:"retryOnContentModified"`
5188−}
5189−
5190−// Static registration options to be returned in the initialize
5191−// request.
5192−//
5193−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#staticRegistrationOptions
5194−type StaticRegistrationOptions struct {
5195− // The id used to register the request. The id can be used to deregister
5196− // the request again. See also Registration#id.
5197− ID string `json:"id,omitempty"`
5198−}
5199−
5200−// A string value used as a snippet is a template which allows to insert text
5201−// and to control the editor cursor when insertion happens.
5202−//
5203−// A snippet can define tab stops and placeholders with `$1`, `$2`
5204−// and `${3:foo}`. `$0` defines the final tab stop, it defaults to
5205−// the end of the snippet. Variables are defined with `$name` and
5206−// `${name:default value}`.
5207−//
5208−// @since 3.18.0
5209−// @proposed
5210−//
5211−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#stringValue
5212−type StringValue struct {
5213− // The kind of string value.
5214− Kind string `json:"kind"`
5215− // The snippet string.
5216− Value string `json:"value"`
5217−}
5218−
5219−// Represents information about programming constructs like variables, classes,
5220−// interfaces etc.
5221−//
5222−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#symbolInformation
5223−type SymbolInformation struct {
5224− // extends BaseSymbolInformation
5225− // Indicates if this symbol is deprecated.
5226− //
5227− // @deprecated Use tags instead
5228− Deprecated bool `json:"deprecated,omitempty"`
5229− // The location of this symbol. The location's range is used by a tool
5230− // to reveal the location in the editor. If the symbol is selected in the
5231− // tool the range's start information is used to position the cursor. So
5232− // the range usually spans more than the actual symbol's name and does
5233− // normally include things like visibility modifiers.
5234− //
5235− // The range doesn't have to denote a node range in the sense of an abstract
5236− // syntax tree. It can therefore not be used to re-construct a hierarchy of
5237− // the symbols.
5238− Location Location `json:"location"`
5239− // The name of this symbol.
5240− Name string `json:"name"`
5241− // The kind of this symbol.
5242− Kind SymbolKind `json:"kind"`
5243− // Tags for this symbol.
5244− //
5245− // @since 3.16.0
5246− Tags []SymbolTag `json:"tags,omitempty"`
5247− // The name of the symbol containing this symbol. This information is for
5248− // user interface purposes (e.g. to render a qualifier in the user interface
5249− // if necessary). It can't be used to re-infer a hierarchy for the document
5250− // symbols.
5251− ContainerName string `json:"containerName,omitempty"`
5252−}
5253−
5254−// A symbol kind.
5255−type SymbolKind uint32
5256−
5257−// Symbol tags are extra annotations that tweak the rendering of a symbol.
5258−//
5259−// @since 3.16
5260−type SymbolTag uint32
5261−
5262−// Describe options to be used when registered for text document change events.
5263−//
5264−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentChangeRegistrationOptions
5265−type TextDocumentChangeRegistrationOptions struct {
5266− // How documents are synced to the server.
5267− SyncKind TextDocumentSyncKind `json:"syncKind"`
5268− TextDocumentRegistrationOptions
5269−}
5270−
5271−// Text document specific client capabilities.
5272−//
5273−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentClientCapabilities
5274−type TextDocumentClientCapabilities struct {
5275− // Defines which synchronization capabilities the client supports.
5276− Synchronization *TextDocumentSyncClientCapabilities `json:"synchronization,omitempty"`
5277− // Capabilities specific to the `textDocument/completion` request.
5278− Completion CompletionClientCapabilities `json:"completion,omitempty"`
5279− // Capabilities specific to the `textDocument/hover` request.
5280− Hover *HoverClientCapabilities `json:"hover,omitempty"`
5281− // Capabilities specific to the `textDocument/signatureHelp` request.
5282− SignatureHelp *SignatureHelpClientCapabilities `json:"signatureHelp,omitempty"`
5283− // Capabilities specific to the `textDocument/declaration` request.
5284− //
5285− // @since 3.14.0
5286− Declaration *DeclarationClientCapabilities `json:"declaration,omitempty"`
5287− // Capabilities specific to the `textDocument/definition` request.
5288− Definition *DefinitionClientCapabilities `json:"definition,omitempty"`
5289− // Capabilities specific to the `textDocument/typeDefinition` request.
5290− //
5291− // @since 3.6.0
5292− TypeDefinition *TypeDefinitionClientCapabilities `json:"typeDefinition,omitempty"`
5293− // Capabilities specific to the `textDocument/implementation` request.
5294− //
5295− // @since 3.6.0
5296− Implementation *ImplementationClientCapabilities `json:"implementation,omitempty"`
5297− // Capabilities specific to the `textDocument/references` request.
5298− References *ReferenceClientCapabilities `json:"references,omitempty"`
5299− // Capabilities specific to the `textDocument/documentHighlight` request.
5300− DocumentHighlight *DocumentHighlightClientCapabilities `json:"documentHighlight,omitempty"`
5301− // Capabilities specific to the `textDocument/documentSymbol` request.
5302− DocumentSymbol DocumentSymbolClientCapabilities `json:"documentSymbol,omitempty"`
5303− // Capabilities specific to the `textDocument/codeAction` request.
5304− CodeAction CodeActionClientCapabilities `json:"codeAction,omitempty"`
5305− // Capabilities specific to the `textDocument/codeLens` request.
5306− CodeLens *CodeLensClientCapabilities `json:"codeLens,omitempty"`
5307− // Capabilities specific to the `textDocument/documentLink` request.
5308− DocumentLink *DocumentLinkClientCapabilities `json:"documentLink,omitempty"`
5309− // Capabilities specific to the `textDocument/documentColor` and the
5310− // `textDocument/colorPresentation` request.
5311− //
5312− // @since 3.6.0
5313− ColorProvider *DocumentColorClientCapabilities `json:"colorProvider,omitempty"`
5314− // Capabilities specific to the `textDocument/formatting` request.
5315− Formatting *DocumentFormattingClientCapabilities `json:"formatting,omitempty"`
5316− // Capabilities specific to the `textDocument/rangeFormatting` request.
5317− RangeFormatting *DocumentRangeFormattingClientCapabilities `json:"rangeFormatting,omitempty"`
5318− // Capabilities specific to the `textDocument/onTypeFormatting` request.
5319− OnTypeFormatting *DocumentOnTypeFormattingClientCapabilities `json:"onTypeFormatting,omitempty"`
5320− // Capabilities specific to the `textDocument/rename` request.
5321− Rename *RenameClientCapabilities `json:"rename,omitempty"`
5322− // Capabilities specific to the `textDocument/foldingRange` request.
5323− //
5324− // @since 3.10.0
5325− FoldingRange *FoldingRangeClientCapabilities `json:"foldingRange,omitempty"`
5326− // Capabilities specific to the `textDocument/selectionRange` request.
5327− //
5328− // @since 3.15.0
5329− SelectionRange *SelectionRangeClientCapabilities `json:"selectionRange,omitempty"`
5330− // Capabilities specific to the `textDocument/publishDiagnostics` notification.
5331− PublishDiagnostics PublishDiagnosticsClientCapabilities `json:"publishDiagnostics,omitempty"`
5332− // Capabilities specific to the various call hierarchy requests.
5333− //
5334− // @since 3.16.0
5335− CallHierarchy *CallHierarchyClientCapabilities `json:"callHierarchy,omitempty"`
5336− // Capabilities specific to the various semantic token request.
5337− //
5338− // @since 3.16.0
5339− SemanticTokens SemanticTokensClientCapabilities `json:"semanticTokens,omitempty"`
5340− // Capabilities specific to the `textDocument/linkedEditingRange` request.
5341− //
5342− // @since 3.16.0
5343− LinkedEditingRange *LinkedEditingRangeClientCapabilities `json:"linkedEditingRange,omitempty"`
5344− // Client capabilities specific to the `textDocument/moniker` request.
5345− //
5346− // @since 3.16.0
5347− Moniker *MonikerClientCapabilities `json:"moniker,omitempty"`
5348− // Capabilities specific to the various type hierarchy requests.
5349− //
5350− // @since 3.17.0
5351− TypeHierarchy *TypeHierarchyClientCapabilities `json:"typeHierarchy,omitempty"`
5352− // Capabilities specific to the `textDocument/inlineValue` request.
5353− //
5354− // @since 3.17.0
5355− InlineValue *InlineValueClientCapabilities `json:"inlineValue,omitempty"`
5356− // Capabilities specific to the `textDocument/inlayHint` request.
5357− //
5358− // @since 3.17.0
5359− InlayHint *InlayHintClientCapabilities `json:"inlayHint,omitempty"`
5360− // Capabilities specific to the diagnostic pull model.
5361− //
5362− // @since 3.17.0
5363− Diagnostic *DiagnosticClientCapabilities `json:"diagnostic,omitempty"`
5364− // Client capabilities specific to inline completions.
5365− //
5366− // @since 3.18.0
5367− // @proposed
5368− InlineCompletion *InlineCompletionClientCapabilities `json:"inlineCompletion,omitempty"`
5369−}
5370−
5371−// An event describing a change to a text document. If only a text is provided
5372−// it is considered to be the full content of the document.
5373−//
5374−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentContentChangeEvent
5375−type (
5376− TextDocumentContentChangeEvent = Or_TextDocumentContentChangeEvent // (alias)
5377− // @since 3.18.0
5378− //
5379− // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentContentChangePartial
5380− TextDocumentContentChangePartial struct {
5381− // The range of the document that changed.
5382− Range *Range `json:"range,omitempty"`
5383− // The optional length of the range that got replaced.
5384− //
5385− // @deprecated use range instead.
5386− RangeLength uint32 `json:"rangeLength,omitempty"`
5387− // The new text for the provided range.
5388− Text string `json:"text"`
5389− }
5390−)
5391−
5392−// @since 3.18.0
5393−//
5394−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentContentChangeWholeDocument
5395−type TextDocumentContentChangeWholeDocument struct {
5396− // The new text of the whole document.
5397− Text string `json:"text"`
5398−}
5399−
5400−// Client capabilities for a text document content provider.
5401−//
5402−// @since 3.18.0
5403−// @proposed
5404−//
5405−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentContentClientCapabilities
5406−type TextDocumentContentClientCapabilities struct {
5407− // Text document content provider supports dynamic registration.
5408− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
5409−}
5410−
5411−// Text document content provider options.
5412−//
5413−// @since 3.18.0
5414−// @proposed
5415−//
5416−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentContentOptions
5417−type TextDocumentContentOptions struct {
5418− // The scheme for which the server provides content.
5419− Scheme string `json:"scheme"`
5420−}
5421−
5422−// Parameters for the `workspace/textDocumentContent` request.
5423−//
5424−// @since 3.18.0
5425−// @proposed
5426−//
5427−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentContentParams
5428−type TextDocumentContentParams struct {
5429− // The uri of the text document.
5430− URI DocumentURI `json:"uri"`
5431−}
5432−
5433−// Parameters for the `workspace/textDocumentContent/refresh` request.
5434−//
5435−// @since 3.18.0
5436−// @proposed
5437−//
5438−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentContentRefreshParams
5439−type TextDocumentContentRefreshParams struct {
5440− // The uri of the text document to refresh.
5441− URI DocumentURI `json:"uri"`
5442−}
5443−
5444−// Text document content provider registration options.
5445−//
5446−// @since 3.18.0
5447−// @proposed
5448−//
5449−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentContentRegistrationOptions
5450−type TextDocumentContentRegistrationOptions struct {
5451− TextDocumentContentOptions
5452− StaticRegistrationOptions
5453−}
5454−
5455−// Describes textual changes on a text document. A TextDocumentEdit describes all changes
5456−// on a document version Si and after they are applied move the document to version Si+1.
5457−// So the creator of a TextDocumentEdit doesn't need to sort the array of edits or do any
5458−// kind of ordering. However the edits must be non overlapping.
5459−//
5460−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentEdit
5461−type TextDocumentEdit struct {
5462− // The text document to change.
5463− TextDocument OptionalVersionedTextDocumentIdentifier `json:"textDocument"`
5464− // The edits to be applied.
5465− //
5466− // @since 3.16.0 - support for AnnotatedTextEdit. This is guarded using a
5467− // client capability.
5468− //
5469− // @since 3.18.0 - support for SnippetTextEdit. This is guarded using a
5470− // client capability.
5471− Edits []Or_TextDocumentEdit_edits_Elem `json:"edits"`
5472−}
5473−
5474−// A document filter denotes a document by different properties like
5475−// the {@link TextDocument.languageId language}, the {@link Uri.scheme scheme} of
5476−// its resource, or a glob-pattern that is applied to the {@link TextDocument.fileName path}.
5477−//
5478−// Glob patterns can have the following syntax:
5479−//
5480−// - `*` to match one or more characters in a path segment
5481−// - `?` to match on one character in a path segment
5482−// - `**` to match any number of path segments, including none
5483−// - `{}` to group sub patterns into an OR expression. (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files)
5484−// - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …)
5485−// - `[!...]` 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`)
5486−//
5487−// @sample A language filter that applies to typescript files on disk: `{ language: 'typescript', scheme: 'file' }`
5488−// @sample A language filter that applies to all package.json paths: `{ language: 'json', pattern: '**package.json' }`
5489−//
5490−// @since 3.17.0
5491−//
5492−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentFilter
5493−type (
5494− TextDocumentFilter = Or_TextDocumentFilter // (alias)
5495− // A document filter where `language` is required field.
5496− //
5497− // @since 3.18.0
5498− //
5499− // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentFilterLanguage
5500− TextDocumentFilterLanguage struct {
5501− // A language id, like `typescript`.
5502− Language string `json:"language"`
5503− // A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
5504− Scheme string `json:"scheme,omitempty"`
5505− // A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples.
5506− //
5507− // @since 3.18.0 - support for relative patterns.
5508− Pattern *GlobPattern `json:"pattern,omitempty"`
5509− }
5510−)
5511−
5512−// A document filter where `pattern` is required field.
5513−//
5514−// @since 3.18.0
5515−//
5516−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentFilterPattern
5517−type TextDocumentFilterPattern struct {
5518− // A language id, like `typescript`.
5519− Language string `json:"language,omitempty"`
5520− // A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
5521− Scheme string `json:"scheme,omitempty"`
5522− // A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples.
5523− //
5524− // @since 3.18.0 - support for relative patterns.
5525− Pattern GlobPattern `json:"pattern"`
5526−}
5527−
5528−// A document filter where `scheme` is required field.
5529−//
5530−// @since 3.18.0
5531−//
5532−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentFilterScheme
5533−type TextDocumentFilterScheme struct {
5534− // A language id, like `typescript`.
5535− Language string `json:"language,omitempty"`
5536− // A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
5537− Scheme string `json:"scheme"`
5538− // A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples.
5539− //
5540− // @since 3.18.0 - support for relative patterns.
5541− Pattern *GlobPattern `json:"pattern,omitempty"`
5542−}
5543−
5544−// A literal to identify a text document in the client.
5545−//
5546−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentIdentifier
5547−type TextDocumentIdentifier struct {
5548− // The text document's uri.
5549− URI DocumentURI `json:"uri"`
5550−}
5551−
5552−// An item to transfer a text document from the client to the
5553−// server.
5554−//
5555−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentItem
5556−type TextDocumentItem struct {
5557− // The text document's uri.
5558− URI DocumentURI `json:"uri"`
5559− // The text document's language identifier.
5560− LanguageID LanguageKind `json:"languageId"`
5561− // The version number of this document (it will increase after each
5562− // change, including undo/redo).
5563− Version int32 `json:"version"`
5564− // The content of the opened text document.
5565− Text string `json:"text"`
5566−}
5567−
5568−// A parameter literal used in requests to pass a text document and a position inside that
5569−// document.
5570−//
5571−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentPositionParams
5572−type TextDocumentPositionParams struct {
5573− // The text document.
5574− TextDocument TextDocumentIdentifier `json:"textDocument"`
5575− // The position inside the text document.
5576− Position Position `json:"position"`
5577−}
5578−
5579−// General text document registration options.
5580−//
5581−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentRegistrationOptions
5582−type TextDocumentRegistrationOptions struct {
5583− // A document selector to identify the scope of the registration. If set to null
5584− // the document selector provided on the client side will be used.
5585− DocumentSelector DocumentSelector `json:"documentSelector"`
5586−}
5587−
5588−// Represents reasons why a text document is saved.
5589−type TextDocumentSaveReason uint32
5590−
5591−// Save registration options.
5592−//
5593−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentSaveRegistrationOptions
5594−type TextDocumentSaveRegistrationOptions struct {
5595− TextDocumentRegistrationOptions
5596− SaveOptions
5597−}
5598−
5599−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentSyncClientCapabilities
5600−type TextDocumentSyncClientCapabilities struct {
5601− // Whether text document synchronization supports dynamic registration.
5602− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
5603− // The client supports sending will save notifications.
5604− WillSave bool `json:"willSave,omitempty"`
5605− // The client supports sending a will save request and
5606− // waits for a response providing text edits which will
5607− // be applied to the document before it is saved.
5608− WillSaveWaitUntil bool `json:"willSaveWaitUntil,omitempty"`
5609− // The client supports did save notifications.
5610− DidSave bool `json:"didSave,omitempty"`
5611−}
5612−
5613−// Defines how the host (editor) should sync
5614−// document changes to the language server.
5615−type TextDocumentSyncKind uint32
5616−
5617−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentSyncOptions
5618−type TextDocumentSyncOptions struct {
5619− // Open and close notifications are sent to the server. If omitted open close notification should not
5620− // be sent.
5621− OpenClose bool `json:"openClose,omitempty"`
5622− // Change notifications are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full
5623− // and TextDocumentSyncKind.Incremental. If omitted it defaults to TextDocumentSyncKind.None.
5624− Change TextDocumentSyncKind `json:"change,omitempty"`
5625− // If present will save notifications are sent to the server. If omitted the notification should not be
5626− // sent.
5627− WillSave bool `json:"willSave,omitempty"`
5628− // If present will save wait until requests are sent to the server. If omitted the request should not be
5629− // sent.
5630− WillSaveWaitUntil bool `json:"willSaveWaitUntil,omitempty"`
5631− // If present save notifications are sent to the server. If omitted the notification should not be
5632− // sent.
5633− Save *SaveOptions `json:"save,omitempty"`
5634−}
5635−
5636−// A text edit applicable to a text document.
5637−//
5638−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textEdit
5639−type TextEdit struct {
5640− // The range of the text document to be manipulated. To insert
5641− // text into a document create a range where start === end.
5642− Range Range `json:"range"`
5643− // The string to be inserted. For delete operations use an
5644− // empty string.
5645− NewText string `json:"newText"`
5646−}
5647−type (
5648− TokenFormat string
5649− TraceValue string
5650−)
5651−
5652−// created for Tuple
5653−type Tuple_ParameterInformation_label_Item1 struct {
5654− Fld0 uint32 `json:"fld0"`
5655− Fld1 uint32 `json:"fld1"`
5656−}
5657−
5658−// Since 3.6.0
5659−//
5660−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeDefinitionClientCapabilities
5661−type TypeDefinitionClientCapabilities struct {
5662− // Whether implementation supports dynamic registration. If this is set to `true`
5663− // the client supports the new `TypeDefinitionRegistrationOptions` return value
5664− // for the corresponding server capability as well.
5665− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
5666− // The client supports additional metadata in the form of definition links.
5667− //
5668− // Since 3.14.0
5669− LinkSupport bool `json:"linkSupport,omitempty"`
5670−}
5671−
5672−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeDefinitionOptions
5673−type TypeDefinitionOptions struct {
5674− WorkDoneProgressOptions
5675−}
5676−
5677−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeDefinitionParams
5678−type TypeDefinitionParams struct {
5679− TextDocumentPositionParams
5680− WorkDoneProgressParams
5681− PartialResultParams
5682−}
5683−
5684−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeDefinitionRegistrationOptions
5685−type TypeDefinitionRegistrationOptions struct {
5686− TextDocumentRegistrationOptions
5687− TypeDefinitionOptions
5688− StaticRegistrationOptions
5689−}
5690−
5691−// @since 3.17.0
5692−//
5693−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeHierarchyClientCapabilities
5694−type TypeHierarchyClientCapabilities struct {
5695− // Whether implementation supports dynamic registration. If this is set to `true`
5696− // the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
5697− // return value for the corresponding server capability as well.
5698− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
5699−}
5700−
5701−// @since 3.17.0
5702−//
5703−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeHierarchyItem
5704−type TypeHierarchyItem struct {
5705− // The name of this item.
5706− Name string `json:"name"`
5707− // The kind of this item.
5708− Kind SymbolKind `json:"kind"`
5709− // Tags for this item.
5710− Tags []SymbolTag `json:"tags,omitempty"`
5711− // More detail for this item, e.g. the signature of a function.
5712− Detail string `json:"detail,omitempty"`
5713− // The resource identifier of this item.
5714− URI DocumentURI `json:"uri"`
5715− // The range enclosing this symbol not including leading/trailing whitespace
5716− // but everything else, e.g. comments and code.
5717− Range Range `json:"range"`
5718− // The range that should be selected and revealed when this symbol is being
5719− // picked, e.g. the name of a function. Must be contained by the
5720− // {@link TypeHierarchyItem.range `range`}.
5721− SelectionRange Range `json:"selectionRange"`
5722− // A data entry field that is preserved between a type hierarchy prepare and
5723− // supertypes or subtypes requests. It could also be used to identify the
5724− // type hierarchy in the server, helping improve the performance on
5725− // resolving supertypes and subtypes.
5726− Data interface{} `json:"data,omitempty"`
5727−}
5728−
5729−// Type hierarchy options used during static registration.
5730−//
5731−// @since 3.17.0
5732−//
5733−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeHierarchyOptions
5734−type TypeHierarchyOptions struct {
5735− WorkDoneProgressOptions
5736−}
5737−
5738−// The parameter of a `textDocument/prepareTypeHierarchy` request.
5739−//
5740−// @since 3.17.0
5741−//
5742−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeHierarchyPrepareParams
5743−type TypeHierarchyPrepareParams struct {
5744− TextDocumentPositionParams
5745− WorkDoneProgressParams
5746−}
5747−
5748−// Type hierarchy options used during static or dynamic registration.
5749−//
5750−// @since 3.17.0
5751−//
5752−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeHierarchyRegistrationOptions
5753−type TypeHierarchyRegistrationOptions struct {
5754− TextDocumentRegistrationOptions
5755− TypeHierarchyOptions
5756− StaticRegistrationOptions
5757−}
5758−
5759−// The parameter of a `typeHierarchy/subtypes` request.
5760−//
5761−// @since 3.17.0
5762−//
5763−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeHierarchySubtypesParams
5764−type TypeHierarchySubtypesParams struct {
5765− Item TypeHierarchyItem `json:"item"`
5766− WorkDoneProgressParams
5767− PartialResultParams
5768−}
5769−
5770−// The parameter of a `typeHierarchy/supertypes` request.
5771−//
5772−// @since 3.17.0
5773−//
5774−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeHierarchySupertypesParams
5775−type TypeHierarchySupertypesParams struct {
5776− Item TypeHierarchyItem `json:"item"`
5777− WorkDoneProgressParams
5778− PartialResultParams
5779−}
5780−
5781−// A diagnostic report indicating that the last returned
5782−// report is still accurate.
5783−//
5784−// @since 3.17.0
5785−//
5786−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#unchangedDocumentDiagnosticReport
5787−type UnchangedDocumentDiagnosticReport struct {
5788− // A document diagnostic report indicating
5789− // no changes to the last result. A server can
5790− // only return `unchanged` if result ids are
5791− // provided.
5792− Kind string `json:"kind"`
5793− // A result id which will be sent on the next
5794− // diagnostic request for the same document.
5795− ResultID string `json:"resultId"`
5796−}
5797−
5798−// Moniker uniqueness level to define scope of the moniker.
5799−//
5800−// @since 3.16.0
5801−type UniquenessLevel string
5802−
5803−// General parameters to unregister a request or notification.
5804−//
5805−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#unregistration
5806−type Unregistration struct {
5807− // The id used to unregister the request or notification. Usually an id
5808− // provided during the register request.
5809− ID string `json:"id"`
5810− // The method to unregister for.
5811− Method string `json:"method"`
5812−}
5813−
5814−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#unregistrationParams
5815−type UnregistrationParams struct {
5816− Unregisterations []Unregistration `json:"unregisterations"`
5817−}
5818−
5819−// A versioned notebook document identifier.
5820−//
5821−// @since 3.17.0
5822−//
5823−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#versionedNotebookDocumentIdentifier
5824−type VersionedNotebookDocumentIdentifier struct {
5825− // The version number of this notebook document.
5826− Version int32 `json:"version"`
5827− // The notebook document's uri.
5828− URI URI `json:"uri"`
5829−}
5830−
5831−// A text document identifier to denote a specific version of a text document.
5832−//
5833−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#versionedTextDocumentIdentifier
5834−type VersionedTextDocumentIdentifier struct {
5835− // The version number of this document.
5836− Version int32 `json:"version"`
5837− TextDocumentIdentifier
5838−}
5839−type (
5840− WatchKind = uint32 // The parameters sent in a will save text document notification.
5841− // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#willSaveTextDocumentParams
5842− WillSaveTextDocumentParams struct {
5843− // The document that will be saved.
5844− TextDocument TextDocumentIdentifier `json:"textDocument"`
5845− // The 'TextDocumentSaveReason'.
5846− Reason TextDocumentSaveReason `json:"reason"`
5847− }
5848−)
5849−
5850−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#windowClientCapabilities
5851−type WindowClientCapabilities struct {
5852− // It indicates whether the client supports server initiated
5853− // progress using the `window/workDoneProgress/create` request.
5854− //
5855− // The capability also controls Whether client supports handling
5856− // of progress notifications. If set servers are allowed to report a
5857− // `workDoneProgress` property in the request specific server
5858− // capabilities.
5859− //
5860− // @since 3.15.0
5861− WorkDoneProgress bool `json:"workDoneProgress,omitempty"`
5862− // Capabilities specific to the showMessage request.
5863− //
5864− // @since 3.16.0
5865− ShowMessage *ShowMessageRequestClientCapabilities `json:"showMessage,omitempty"`
5866− // Capabilities specific to the showDocument request.
5867− //
5868− // @since 3.16.0
5869− ShowDocument *ShowDocumentClientCapabilities `json:"showDocument,omitempty"`
5870−}
5871−
5872−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workDoneProgressBegin
5873−type WorkDoneProgressBegin struct {
5874− Kind string `json:"kind"`
5875− // Mandatory title of the progress operation. Used to briefly inform about
5876− // the kind of operation being performed.
5877− //
5878− // Examples: "Indexing" or "Linking dependencies".
5879− Title string `json:"title"`
5880− // Controls if a cancel button should show to allow the user to cancel the
5881− // long running operation. Clients that don't support cancellation are allowed
5882− // to ignore the setting.
5883− Cancellable bool `json:"cancellable,omitempty"`
5884− // Optional, more detailed associated progress message. Contains
5885− // complementary information to the `title`.
5886− //
5887− // Examples: "3/25 files", "project/src/module2", "node_modules/some_dep".
5888− // If unset, the previous progress message (if any) is still valid.
5889− Message string `json:"message,omitempty"`
5890− // Optional progress percentage to display (value 100 is considered 100%).
5891− // If not provided infinite progress is assumed and clients are allowed
5892− // to ignore the `percentage` value in subsequent in report notifications.
5893− //
5894− // The value should be steadily rising. Clients are free to ignore values
5895− // that are not following this rule. The value range is [0, 100].
5896− Percentage uint32 `json:"percentage,omitempty"`
5897−}
5898−
5899−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workDoneProgressCancelParams
5900−type WorkDoneProgressCancelParams struct {
5901− // The token to be used to report progress.
5902− Token ProgressToken `json:"token"`
5903−}
5904−
5905−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workDoneProgressCreateParams
5906−type WorkDoneProgressCreateParams struct {
5907− // The token to be used to report progress.
5908− Token ProgressToken `json:"token"`
5909−}
5910−
5911−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workDoneProgressEnd
5912−type WorkDoneProgressEnd struct {
5913− Kind string `json:"kind"`
5914− // Optional, a final message indicating to for example indicate the outcome
5915− // of the operation.
5916− Message string `json:"message,omitempty"`
5917−}
5918−
5919−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workDoneProgressOptions
5920−type WorkDoneProgressOptions struct {
5921− WorkDoneProgress bool `json:"workDoneProgress,omitempty"`
5922−}
5923−
5924−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workDoneProgressParams
5925−type WorkDoneProgressParams struct {
5926− // An optional token that a server can use to report work done progress.
5927− WorkDoneToken ProgressToken `json:"workDoneToken,omitempty"`
5928−}
5929−
5930−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workDoneProgressReport
5931−type WorkDoneProgressReport struct {
5932− Kind string `json:"kind"`
5933− // Controls enablement state of a cancel button.
5934− //
5935− // Clients that don't support cancellation or don't support controlling the button's
5936− // enablement state are allowed to ignore the property.
5937− Cancellable bool `json:"cancellable,omitempty"`
5938− // Optional, more detailed associated progress message. Contains
5939− // complementary information to the `title`.
5940− //
5941− // Examples: "3/25 files", "project/src/module2", "node_modules/some_dep".
5942− // If unset, the previous progress message (if any) is still valid.
5943− Message string `json:"message,omitempty"`
5944− // Optional progress percentage to display (value 100 is considered 100%).
5945− // If not provided infinite progress is assumed and clients are allowed
5946− // to ignore the `percentage` value in subsequent in report notifications.
5947− //
5948− // The value should be steadily rising. Clients are free to ignore values
5949− // that are not following this rule. The value range is [0, 100]
5950− Percentage uint32 `json:"percentage,omitempty"`
5951−}
5952−
5953−// Workspace specific client capabilities.
5954−//
5955−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceClientCapabilities
5956−type WorkspaceClientCapabilities struct {
5957− // The client supports applying batch edits
5958− // to the workspace by supporting the request
5959− // 'workspace/applyEdit'
5960− ApplyEdit bool `json:"applyEdit,omitempty"`
5961− // Capabilities specific to `WorkspaceEdit`s.
5962− WorkspaceEdit *WorkspaceEditClientCapabilities `json:"workspaceEdit,omitempty"`
5963− // Capabilities specific to the `workspace/didChangeConfiguration` notification.
5964− DidChangeConfiguration DidChangeConfigurationClientCapabilities `json:"didChangeConfiguration,omitempty"`
5965− // Capabilities specific to the `workspace/didChangeWatchedFiles` notification.
5966− DidChangeWatchedFiles DidChangeWatchedFilesClientCapabilities `json:"didChangeWatchedFiles,omitempty"`
5967− // Capabilities specific to the `workspace/symbol` request.
5968− Symbol *WorkspaceSymbolClientCapabilities `json:"symbol,omitempty"`
5969− // Capabilities specific to the `workspace/executeCommand` request.
5970− ExecuteCommand *ExecuteCommandClientCapabilities `json:"executeCommand,omitempty"`
5971− // The client has support for workspace folders.
5972− //
5973− // @since 3.6.0
5974− WorkspaceFolders bool `json:"workspaceFolders,omitempty"`
5975− // The client supports `workspace/configuration` requests.
5976− //
5977− // @since 3.6.0
5978− Configuration bool `json:"configuration,omitempty"`
5979− // Capabilities specific to the semantic token requests scoped to the
5980− // workspace.
5981− //
5982− // @since 3.16.0.
5983− SemanticTokens *SemanticTokensWorkspaceClientCapabilities `json:"semanticTokens,omitempty"`
5984− // Capabilities specific to the code lens requests scoped to the
5985− // workspace.
5986− //
5987− // @since 3.16.0.
5988− CodeLens *CodeLensWorkspaceClientCapabilities `json:"codeLens,omitempty"`
5989− // The client has support for file notifications/requests for user operations on files.
5990− //
5991− // Since 3.16.0
5992− FileOperations *FileOperationClientCapabilities `json:"fileOperations,omitempty"`
5993− // Capabilities specific to the inline values requests scoped to the
5994− // workspace.
5995− //
5996− // @since 3.17.0.
5997− InlineValue *InlineValueWorkspaceClientCapabilities `json:"inlineValue,omitempty"`
5998− // Capabilities specific to the inlay hint requests scoped to the
5999− // workspace.
6000− //
6001− // @since 3.17.0.
6002− InlayHint *InlayHintWorkspaceClientCapabilities `json:"inlayHint,omitempty"`
6003− // Capabilities specific to the diagnostic requests scoped to the
6004− // workspace.
6005− //
6006− // @since 3.17.0.
6007− Diagnostics *DiagnosticWorkspaceClientCapabilities `json:"diagnostics,omitempty"`
6008− // Capabilities specific to the folding range requests scoped to the workspace.
6009− //
6010− // @since 3.18.0
6011− // @proposed
6012− FoldingRange *FoldingRangeWorkspaceClientCapabilities `json:"foldingRange,omitempty"`
6013− // Capabilities specific to the `workspace/textDocumentContent` request.
6014− //
6015− // @since 3.18.0
6016− // @proposed
6017− TextDocumentContent *TextDocumentContentClientCapabilities `json:"textDocumentContent,omitempty"`
6018−}
6019−
6020−// Parameters of the workspace diagnostic request.
6021−//
6022−// @since 3.17.0
6023−//
6024−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceDiagnosticParams
6025−type WorkspaceDiagnosticParams struct {
6026− // The additional identifier provided during registration.
6027− Identifier string `json:"identifier,omitempty"`
6028− // The currently known diagnostic reports with their
6029− // previous result ids.
6030− PreviousResultIds []PreviousResultId `json:"previousResultIds"`
6031− WorkDoneProgressParams
6032− PartialResultParams
6033−}
6034−
6035−// A workspace diagnostic report.
6036−//
6037−// @since 3.17.0
6038−//
6039−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceDiagnosticReport
6040−type WorkspaceDiagnosticReport struct {
6041− Items []WorkspaceDocumentDiagnosticReport `json:"items"`
6042−}
6043−
6044−// A partial result for a workspace diagnostic report.
6045−//
6046−// @since 3.17.0
6047−//
6048−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceDiagnosticReportPartialResult
6049−type WorkspaceDiagnosticReportPartialResult struct {
6050− Items []WorkspaceDocumentDiagnosticReport `json:"items"`
6051−}
6052−
6053−// A workspace diagnostic document report.
6054−//
6055−// @since 3.17.0
6056−//
6057−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceDocumentDiagnosticReport
6058−type (
6059− WorkspaceDocumentDiagnosticReport = Or_WorkspaceDocumentDiagnosticReport // (alias)
6060− // A workspace edit represents changes to many resources managed in the workspace. The edit
6061− // should either provide `changes` or `documentChanges`. If documentChanges are present
6062− // they are preferred over `changes` if the client can handle versioned document edits.
6063− //
6064− // Since version 3.13.0 a workspace edit can contain resource operations as well. If resource
6065− // operations are present clients need to execute the operations in the order in which they
6066− // are provided. So a workspace edit for example can consist of the following two changes:
6067− // (1) a create file a.txt and (2) a text document edit which insert text into file a.txt.
6068− //
6069− // An invalid sequence (e.g. (1) delete file a.txt and (2) insert text into file a.txt) will
6070− // cause failure of the operation. How the client recovers from the failure is described by
6071− // the client capability: `workspace.workspaceEdit.failureHandling`
6072− //
6073− // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceEdit
6074− WorkspaceEdit struct {
6075− // Holds changes to existing resources.
6076− Changes map[DocumentURI][]TextEdit `json:"changes,omitempty"`
6077− // Depending on the client capability `workspace.workspaceEdit.resourceOperations` document changes
6078− // are either an array of `TextDocumentEdit`s to express changes to n different text documents
6079− // where each text document edit addresses a specific version of a text document. Or it can contain
6080− // above `TextDocumentEdit`s mixed with create, rename and delete file / folder operations.
6081− //
6082− // Whether a client supports versioned document edits is expressed via
6083− // `workspace.workspaceEdit.documentChanges` client capability.
6084− //
6085− // If a client neither supports `documentChanges` nor `workspace.workspaceEdit.resourceOperations` then
6086− // only plain `TextEdit`s using the `changes` property are supported.
6087− DocumentChanges []DocumentChange `json:"documentChanges,omitempty"`
6088− // A map of change annotations that can be referenced in `AnnotatedTextEdit`s or create, rename and
6089− // delete file / folder operations.
6090− //
6091− // Whether clients honor this property depends on the client capability `workspace.changeAnnotationSupport`.
6092− //
6093− // @since 3.16.0
6094− ChangeAnnotations map[ChangeAnnotationIdentifier]ChangeAnnotation `json:"changeAnnotations,omitempty"`
6095− }
6096−)
6097−
6098−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceEditClientCapabilities
6099−type WorkspaceEditClientCapabilities struct {
6100− // The client supports versioned document changes in `WorkspaceEdit`s
6101− DocumentChanges bool `json:"documentChanges,omitempty"`
6102− // The resource operations the client supports. Clients should at least
6103− // support 'create', 'rename' and 'delete' files and folders.
6104− //
6105− // @since 3.13.0
6106− ResourceOperations []ResourceOperationKind `json:"resourceOperations,omitempty"`
6107− // The failure handling strategy of a client if applying the workspace edit
6108− // fails.
6109− //
6110− // @since 3.13.0
6111− FailureHandling *FailureHandlingKind `json:"failureHandling,omitempty"`
6112− // Whether the client normalizes line endings to the client specific
6113− // setting.
6114− // If set to `true` the client will normalize line ending characters
6115− // in a workspace edit to the client-specified new line
6116− // character.
6117− //
6118− // @since 3.16.0
6119− NormalizesLineEndings bool `json:"normalizesLineEndings,omitempty"`
6120− // Whether the client in general supports change annotations on text edits,
6121− // create file, rename file and delete file changes.
6122− //
6123− // @since 3.16.0
6124− ChangeAnnotationSupport *ChangeAnnotationsSupportOptions `json:"changeAnnotationSupport,omitempty"`
6125− // Whether the client supports `WorkspaceEditMetadata` in `WorkspaceEdit`s.
6126− //
6127− // @since 3.18.0
6128− // @proposed
6129− MetadataSupport bool `json:"metadataSupport,omitempty"`
6130− // Whether the client supports snippets as text edits.
6131− //
6132− // @since 3.18.0
6133− // @proposed
6134− SnippetEditSupport bool `json:"snippetEditSupport,omitempty"`
6135−}
6136−
6137−// Additional data about a workspace edit.
6138−//
6139−// @since 3.18.0
6140−// @proposed
6141−//
6142−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceEditMetadata
6143−type WorkspaceEditMetadata struct {
6144− // Signal to the editor that this edit is a refactoring.
6145− IsRefactoring bool `json:"isRefactoring,omitempty"`
6146−}
6147−
6148−// A workspace folder inside a client.
6149−//
6150−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceFolder
6151−type WorkspaceFolder struct {
6152− // The associated URI for this workspace folder.
6153− URI URI `json:"uri"`
6154− // The name of the workspace folder. Used to refer to this
6155− // workspace folder in the user interface.
6156− Name string `json:"name"`
6157−}
6158−
6159−// The workspace folder change event.
6160−//
6161−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceFoldersChangeEvent
6162−type WorkspaceFoldersChangeEvent struct {
6163− // The array of added workspace folders
6164− Added []WorkspaceFolder `json:"added"`
6165− // The array of the removed workspace folders
6166− Removed []WorkspaceFolder `json:"removed"`
6167−}
6168−
6169−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceFoldersInitializeParams
6170−type WorkspaceFoldersInitializeParams struct {
6171− // The workspace folders configured in the client when the server starts.
6172− //
6173− // This property is only available if the client supports workspace folders.
6174− // It can be `null` if the client supports workspace folders but none are
6175− // configured.
6176− //
6177− // @since 3.6.0
6178− WorkspaceFolders []WorkspaceFolder `json:"workspaceFolders,omitempty"`
6179−}
6180−
6181−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceFoldersServerCapabilities
6182−type WorkspaceFoldersServerCapabilities struct {
6183− // The server has support for workspace folders
6184− Supported bool `json:"supported,omitempty"`
6185− // Whether the server wants to receive workspace folder
6186− // change notifications.
6187− //
6188− // If a string is provided the string is treated as an ID
6189− // under which the notification is registered on the client
6190− // side. The ID can be used to unregister for these events
6191− // using the `client/unregisterCapability` request.
6192− ChangeNotifications *Or_WorkspaceFoldersServerCapabilities_changeNotifications `json:"changeNotifications,omitempty"`
6193−}
6194−
6195−// A full document diagnostic report for a workspace diagnostic result.
6196−//
6197−// @since 3.17.0
6198−//
6199−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceFullDocumentDiagnosticReport
6200−type WorkspaceFullDocumentDiagnosticReport struct {
6201− // The URI for which diagnostic information is reported.
6202− URI DocumentURI `json:"uri"`
6203− // The version number for which the diagnostics are reported.
6204− // If the document is not marked as open `null` can be provided.
6205− Version int32 `json:"version"`
6206− FullDocumentDiagnosticReport
6207−}
6208−
6209−// Defines workspace specific capabilities of the server.
6210−//
6211−// @since 3.18.0
6212−//
6213−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceOptions
6214−type WorkspaceOptions struct {
6215− // The server supports workspace folder.
6216− //
6217− // @since 3.6.0
6218− WorkspaceFolders *WorkspaceFoldersServerCapabilities `json:"workspaceFolders,omitempty"`
6219− // The server is interested in notifications/requests for operations on files.
6220− //
6221− // @since 3.16.0
6222− FileOperations *FileOperationOptions `json:"fileOperations,omitempty"`
6223− // The server supports the `workspace/textDocumentContent` request.
6224− //
6225− // @since 3.18.0
6226− // @proposed
6227− TextDocumentContent *Or_WorkspaceOptions_textDocumentContent `json:"textDocumentContent,omitempty"`
6228−}
6229−
6230−// A special workspace symbol that supports locations without a range.
6231−//
6232−// See also SymbolInformation.
6233−//
6234−// @since 3.17.0
6235−//
6236−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceSymbol
6237−type WorkspaceSymbol struct {
6238− // The location of the symbol. Whether a server is allowed to
6239− // return a location without a range depends on the client
6240− // capability `workspace.symbol.resolveSupport`.
6241− //
6242− // See SymbolInformation#location for more details.
6243− Location Or_WorkspaceSymbol_location `json:"location"`
6244− // A data entry field that is preserved on a workspace symbol between a
6245− // workspace symbol request and a workspace symbol resolve request.
6246− Data interface{} `json:"data,omitempty"`
6247− BaseSymbolInformation
6248−}
6249−
6250−// Client capabilities for a {@link WorkspaceSymbolRequest}.
6251−//
6252−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceSymbolClientCapabilities
6253−type WorkspaceSymbolClientCapabilities struct {
6254− // Symbol request supports dynamic registration.
6255− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
6256− // Specific capabilities for the `SymbolKind` in the `workspace/symbol` request.
6257− SymbolKind *ClientSymbolKindOptions `json:"symbolKind,omitempty"`
6258− // The client supports tags on `SymbolInformation`.
6259− // Clients supporting tags have to handle unknown tags gracefully.
6260− //
6261− // @since 3.16.0
6262− TagSupport *ClientSymbolTagOptions `json:"tagSupport,omitempty"`
6263− // The client support partial workspace symbols. The client will send the
6264− // request `workspaceSymbol/resolve` to the server to resolve additional
6265− // properties.
6266− //
6267− // @since 3.17.0
6268− ResolveSupport *ClientSymbolResolveOptions `json:"resolveSupport,omitempty"`
6269−}
6270−
6271−// Server capabilities for a {@link WorkspaceSymbolRequest}.
6272−//
6273−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceSymbolOptions
6274−type WorkspaceSymbolOptions struct {
6275− // The server provides support to resolve additional
6276− // information for a workspace symbol.
6277− //
6278− // @since 3.17.0
6279− ResolveProvider bool `json:"resolveProvider,omitempty"`
6280− WorkDoneProgressOptions
6281−}
6282−
6283−// The parameters of a {@link WorkspaceSymbolRequest}.
6284−//
6285−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceSymbolParams
6286−type WorkspaceSymbolParams struct {
6287− // A query string to filter symbols by. Clients may send an empty
6288− // string here to request all symbols.
6289− //
6290− // The `query`-parameter should be interpreted in a *relaxed way* as editors
6291− // will apply their own highlighting and scoring on the results. A good rule
6292− // of thumb is to match case-insensitive and to simply check that the
6293− // characters of *query* appear in their order in a candidate symbol.
6294− // Servers shouldn't use prefix, substring, or similar strict matching.
6295− Query string `json:"query"`
6296− WorkDoneProgressParams
6297− PartialResultParams
6298−}
6299−
6300−// Registration options for a {@link WorkspaceSymbolRequest}.
6301−//
6302−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceSymbolRegistrationOptions
6303−type WorkspaceSymbolRegistrationOptions struct {
6304− WorkspaceSymbolOptions
6305−}
6306−
6307−// An unchanged document diagnostic report for a workspace diagnostic result.
6308−//
6309−// @since 3.17.0
6310−//
6311−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceUnchangedDocumentDiagnosticReport
6312−type WorkspaceUnchangedDocumentDiagnosticReport struct {
6313− // The URI for which diagnostic information is reported.
6314− URI DocumentURI `json:"uri"`
6315− // The version number for which the diagnostics are reported.
6316− // If the document is not marked as open `null` can be provided.
6317− Version int32 `json:"version"`
6318− UnchangedDocumentDiagnosticReport
6319−}
6320−
6321−// The initialize parameters
6322−//
6323−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#_InitializeParams
6324−type XInitializeParams struct {
6325− // The process Id of the parent process that started
6326− // the server.
6327− //
6328− // Is `null` if the process has not been started by another process.
6329− // If the parent process is not alive then the server should exit.
6330− ProcessID int32 `json:"processId"`
6331− // Information about the client
6332− //
6333− // @since 3.15.0
6334− ClientInfo *ClientInfo `json:"clientInfo,omitempty"`
6335− // The locale the client is currently showing the user interface
6336− // in. This must not necessarily be the locale of the operating
6337− // system.
6338− //
6339− // Uses IETF language tags as the value's syntax
6340− // (See https://en.wikipedia.org/wiki/IETF_language_tag)
6341− //
6342− // @since 3.16.0
6343− Locale string `json:"locale,omitempty"`
6344− // The rootPath of the workspace. Is null
6345− // if no folder is open.
6346− //
6347− // @deprecated in favour of rootUri.
6348− RootPath string `json:"rootPath,omitempty"`
6349− // The rootUri of the workspace. Is null if no
6350− // folder is open. If both `rootPath` and `rootUri` are set
6351− // `rootUri` wins.
6352− //
6353− // @deprecated in favour of workspaceFolders.
6354− RootURI DocumentURI `json:"rootUri"`
6355− // The capabilities provided by the client (editor or tool)
6356− Capabilities ClientCapabilities `json:"capabilities"`
6357− // User provided initialization options.
6358− InitializationOptions interface{} `json:"initializationOptions,omitempty"`
6359− // The initial trace setting. If omitted trace is disabled ('off').
6360− Trace *TraceValue `json:"trace,omitempty"`
6361− WorkDoneProgressParams
6362−}
6363−
6364−// The initialize parameters
6365−//
6366−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#_InitializeParams
6367−type _InitializeParams struct {
6368− // The process Id of the parent process that started
6369− // the server.
6370− //
6371− // Is `null` if the process has not been started by another process.
6372− // If the parent process is not alive then the server should exit.
6373− ProcessID int32 `json:"processId"`
6374− // Information about the client
6375− //
6376− // @since 3.15.0
6377− ClientInfo *ClientInfo `json:"clientInfo,omitempty"`
6378− // The locale the client is currently showing the user interface
6379− // in. This must not necessarily be the locale of the operating
6380− // system.
6381− //
6382− // Uses IETF language tags as the value's syntax
6383− // (See https://en.wikipedia.org/wiki/IETF_language_tag)
6384− //
6385− // @since 3.16.0
6386− Locale string `json:"locale,omitempty"`
6387− // The rootPath of the workspace. Is null
6388− // if no folder is open.
6389− //
6390− // @deprecated in favour of rootUri.
6391− RootPath string `json:"rootPath,omitempty"`
6392− // The rootUri of the workspace. Is null if no
6393− // folder is open. If both `rootPath` and `rootUri` are set
6394− // `rootUri` wins.
6395− //
6396− // @deprecated in favour of workspaceFolders.
6397− RootURI DocumentURI `json:"rootUri"`
6398− // The capabilities provided by the client (editor or tool)
6399− Capabilities ClientCapabilities `json:"capabilities"`
6400− // User provided initialization options.
6401− InitializationOptions interface{} `json:"initializationOptions,omitempty"`
6402− // The initial trace setting. If omitted trace is disabled ('off').
6403− Trace *TraceValue `json:"trace,omitempty"`
6404− WorkDoneProgressParams
6405−}
6406−
6407−const (
6408− // A set of predefined code action kinds
6409− // Empty kind.
6410− Empty CodeActionKind = ""
6411− // Base kind for quickfix actions: 'quickfix'
6412− QuickFix CodeActionKind = "quickfix"
6413− // Base kind for refactoring actions: 'refactor'
6414− Refactor CodeActionKind = "refactor"
6415− // Base kind for refactoring extraction actions: 'refactor.extract'
6416− //
6417− // Example extract actions:
6418− //
6419− //
6420− // - Extract method
6421− // - Extract function
6422− // - Extract variable
6423− // - Extract interface from class
6424− // - ...
6425− RefactorExtract CodeActionKind = "refactor.extract"
6426− // Base kind for refactoring inline actions: 'refactor.inline'
6427− //
6428− // Example inline actions:
6429− //
6430− //
6431− // - Inline function
6432− // - Inline variable
6433− // - Inline constant
6434− // - ...
6435− RefactorInline CodeActionKind = "refactor.inline"
6436− // Base kind for refactoring move actions: `refactor.move`
6437− //
6438− // Example move actions:
6439− //
6440− //
6441− // - Move a function to a new file
6442− // - Move a property between classes
6443− // - Move method to base class
6444− // - ...
6445− //
6446− // @since 3.18.0
6447− // @proposed
6448− RefactorMove CodeActionKind = "refactor.move"
6449− // Base kind for refactoring rewrite actions: 'refactor.rewrite'
6450− //
6451− // Example rewrite actions:
6452− //
6453− //
6454− // - Convert JavaScript function to class
6455− // - Add or remove parameter
6456− // - Encapsulate field
6457− // - Make method static
6458− // - Move method to base class
6459− // - ...
6460− RefactorRewrite CodeActionKind = "refactor.rewrite"
6461− // Base kind for source actions: `source`
6462− //
6463− // Source code actions apply to the entire file.
6464− Source CodeActionKind = "source"
6465− // Base kind for an organize imports source action: `source.organizeImports`
6466− SourceOrganizeImports CodeActionKind = "source.organizeImports"
6467− // Base kind for auto-fix source actions: `source.fixAll`.
6468− //
6469− // Fix all actions automatically fix errors that have a clear fix that do not require user input.
6470− // They should not suppress errors or perform unsafe fixes such as generating new types or classes.
6471− //
6472− // @since 3.15.0
6473− SourceFixAll CodeActionKind = "source.fixAll"
6474− // Base kind for all code actions applying to the entire notebook's scope. CodeActionKinds using
6475− // this should always begin with `notebook.`
6476− //
6477− // @since 3.18.0
6478− Notebook CodeActionKind = "notebook"
6479− // The reason why code actions were requested.
6480− //
6481− // @since 3.17.0
6482− // Code actions were explicitly requested by the user or by an extension.
6483− CodeActionInvoked CodeActionTriggerKind = 1
6484− // Code actions were requested automatically.
6485− //
6486− // This typically happens when current selection in a file changes, but can
6487− // also be triggered when file content changes.
6488− CodeActionAutomatic CodeActionTriggerKind = 2
6489− // The kind of a completion entry.
6490− TextCompletion CompletionItemKind = 1
6491− MethodCompletion CompletionItemKind = 2
6492− FunctionCompletion CompletionItemKind = 3
6493− ConstructorCompletion CompletionItemKind = 4
6494− FieldCompletion CompletionItemKind = 5
6495− VariableCompletion CompletionItemKind = 6
6496− ClassCompletion CompletionItemKind = 7
6497− InterfaceCompletion CompletionItemKind = 8
6498− ModuleCompletion CompletionItemKind = 9
6499− PropertyCompletion CompletionItemKind = 10
6500− UnitCompletion CompletionItemKind = 11
6501− ValueCompletion CompletionItemKind = 12
6502− EnumCompletion CompletionItemKind = 13
6503− KeywordCompletion CompletionItemKind = 14
6504− SnippetCompletion CompletionItemKind = 15
6505− ColorCompletion CompletionItemKind = 16
6506− FileCompletion CompletionItemKind = 17
6507− ReferenceCompletion CompletionItemKind = 18
6508− FolderCompletion CompletionItemKind = 19
6509− EnumMemberCompletion CompletionItemKind = 20
6510− ConstantCompletion CompletionItemKind = 21
6511− StructCompletion CompletionItemKind = 22
6512− EventCompletion CompletionItemKind = 23
6513− OperatorCompletion CompletionItemKind = 24
6514− TypeParameterCompletion CompletionItemKind = 25
6515− // Completion item tags are extra annotations that tweak the rendering of a completion
6516− // item.
6517− //
6518− // @since 3.15.0
6519− // Render a completion as obsolete, usually using a strike-out.
6520− ComplDeprecated CompletionItemTag = 1
6521− // How a completion was triggered
6522− // Completion was triggered by typing an identifier (24x7 code
6523− // complete), manual invocation (e.g Ctrl+Space) or via API.
6524− Invoked CompletionTriggerKind = 1
6525− // Completion was triggered by a trigger character specified by
6526− // the `triggerCharacters` properties of the `CompletionRegistrationOptions`.
6527− TriggerCharacter CompletionTriggerKind = 2
6528− // Completion was re-triggered as current completion list is incomplete
6529− TriggerForIncompleteCompletions CompletionTriggerKind = 3
6530− // The diagnostic's severity.
6531− // Reports an error.
6532− SeverityError DiagnosticSeverity = 1
6533− // Reports a warning.
6534− SeverityWarning DiagnosticSeverity = 2
6535− // Reports an information.
6536− SeverityInformation DiagnosticSeverity = 3
6537− // Reports a hint.
6538− SeverityHint DiagnosticSeverity = 4
6539− // The diagnostic tags.
6540− //
6541− // @since 3.15.0
6542− // Unused or unnecessary code.
6543− //
6544− // Clients are allowed to render diagnostics with this tag faded out instead of having
6545− // an error squiggle.
6546− Unnecessary DiagnosticTag = 1
6547− // Deprecated or obsolete code.
6548− //
6549− // Clients are allowed to rendered diagnostics with this tag strike through.
6550− Deprecated DiagnosticTag = 2
6551− // The document diagnostic report kinds.
6552− //
6553− // @since 3.17.0
6554− // A diagnostic report with a full
6555− // set of problems.
6556− DiagnosticFull DocumentDiagnosticReportKind = "full"
6557− // A report indicating that the last
6558− // returned report is still accurate.
6559− DiagnosticUnchanged DocumentDiagnosticReportKind = "unchanged"
6560− // A document highlight kind.
6561− // A textual occurrence.
6562− Text DocumentHighlightKind = 1
6563− // Read-access of a symbol, like reading a variable.
6564− Read DocumentHighlightKind = 2
6565− // Write-access of a symbol, like writing to a variable.
6566− Write DocumentHighlightKind = 3
6567− // Predefined error codes.
6568− ParseError ErrorCodes = -32700
6569− InvalidRequest ErrorCodes = -32600
6570− MethodNotFound ErrorCodes = -32601
6571− InvalidParams ErrorCodes = -32602
6572− InternalError ErrorCodes = -32603
6573− // Error code indicating that a server received a notification or
6574− // request before the server has received the `initialize` request.
6575− ServerNotInitialized ErrorCodes = -32002
6576− UnknownErrorCode ErrorCodes = -32001
6577− // Applying the workspace change is simply aborted if one of the changes provided
6578− // fails. All operations executed before the failing operation stay executed.
6579− Abort FailureHandlingKind = "abort"
6580− // All operations are executed transactional. That means they either all
6581− // succeed or no changes at all are applied to the workspace.
6582− Transactional FailureHandlingKind = "transactional"
6583− // If the workspace edit contains only textual file changes they are executed transactional.
6584− // If resource changes (create, rename or delete file) are part of the change the failure
6585− // handling strategy is abort.
6586− TextOnlyTransactional FailureHandlingKind = "textOnlyTransactional"
6587− // The client tries to undo the operations already executed. But there is no
6588− // guarantee that this is succeeding.
6589− Undo FailureHandlingKind = "undo"
6590− // The file event type
6591− // The file got created.
6592− Created FileChangeType = 1
6593− // The file got changed.
6594− Changed FileChangeType = 2
6595− // The file got deleted.
6596− Deleted FileChangeType = 3
6597− // A pattern kind describing if a glob pattern matches a file a folder or
6598− // both.
6599− //
6600− // @since 3.16.0
6601− // The pattern matches a file only.
6602− FilePattern FileOperationPatternKind = "file"
6603− // The pattern matches a folder only.
6604− FolderPattern FileOperationPatternKind = "folder"
6605− // A set of predefined range kinds.
6606− // Folding range for a comment
6607− Comment FoldingRangeKind = "comment"
6608− // Folding range for an import or include
6609− Imports FoldingRangeKind = "imports"
6610− // Folding range for a region (e.g. `#region`)
6611− Region FoldingRangeKind = "region"
6612− // Inlay hint kinds.
6613− //
6614− // @since 3.17.0
6615− // An inlay hint that for a type annotation.
6616− Type InlayHintKind = 1
6617− // An inlay hint that is for a parameter.
6618− Parameter InlayHintKind = 2
6619− // Describes how an {@link InlineCompletionItemProvider inline completion provider} was triggered.
6620− //
6621− // @since 3.18.0
6622− // @proposed
6623− // Completion was triggered explicitly by a user gesture.
6624− InlineInvoked InlineCompletionTriggerKind = 1
6625− // Completion was triggered automatically while editing.
6626− InlineAutomatic InlineCompletionTriggerKind = 2
6627− // Defines whether the insert text in a completion item should be interpreted as
6628− // plain text or a snippet.
6629− // The primary text to be inserted is treated as a plain string.
6630− PlainTextTextFormat InsertTextFormat = 1
6631− // The primary text to be inserted is treated as a snippet.
6632− //
6633− // A snippet can define tab stops and placeholders with `$1`, `$2`
6634− // and `${3:foo}`. `$0` defines the final tab stop, it defaults to
6635− // the end of the snippet. Placeholders with equal identifiers are linked,
6636− // that is typing in one will update others too.
6637− //
6638− // See also: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax
6639− SnippetTextFormat InsertTextFormat = 2
6640− // How whitespace and indentation is handled during completion
6641− // item insertion.
6642− //
6643− // @since 3.16.0
6644− // The insertion or replace strings is taken as it is. If the
6645− // value is multi line the lines below the cursor will be
6646− // inserted using the indentation defined in the string value.
6647− // The client will not apply any kind of adjustments to the
6648− // string.
6649− AsIs InsertTextMode = 1
6650− // The editor adjusts leading whitespace of new lines so that
6651− // they match the indentation up to the cursor of the line for
6652− // which the item is accepted.
6653− //
6654− // Consider a line like this: <2tabs><cursor><3tabs>foo. Accepting a
6655− // multi line completion item is indented using 2 tabs and all
6656− // following lines inserted will be indented using 2 tabs as well.
6657− AdjustIndentation InsertTextMode = 2
6658− // A request failed but it was syntactically correct, e.g the
6659− // method name was known and the parameters were valid. The error
6660− // message should contain human readable information about why
6661− // the request failed.
6662− //
6663− // @since 3.17.0
6664− RequestFailed LSPErrorCodes = -32803
6665− // The server cancelled the request. This error code should
6666− // only be used for requests that explicitly support being
6667− // server cancellable.
6668− //
6669− // @since 3.17.0
6670− ServerCancelled LSPErrorCodes = -32802
6671− // The server detected that the content of a document got
6672− // modified outside normal conditions. A server should
6673− // NOT send this error code if it detects a content change
6674− // in it unprocessed messages. The result even computed
6675− // on an older state might still be useful for the client.
6676− //
6677− // If a client decides that a result is not of any use anymore
6678− // the client should cancel the request.
6679− ContentModified LSPErrorCodes = -32801
6680− // The client has canceled a request and a server has detected
6681− // the cancel.
6682− RequestCancelled LSPErrorCodes = -32800
6683− // Predefined Language kinds
6684− // @since 3.18.0
6685− // @proposed
6686− LangABAP LanguageKind = "abap"
6687− LangWindowsBat LanguageKind = "bat"
6688− LangBibTeX LanguageKind = "bibtex"
6689− LangClojure LanguageKind = "clojure"
6690− LangCoffeescript LanguageKind = "coffeescript"
6691− LangC LanguageKind = "c"
6692− LangCPP LanguageKind = "cpp"
6693− LangCSharp LanguageKind = "csharp"
6694− LangCSS LanguageKind = "css"
6695− // @since 3.18.0
6696− // @proposed
6697− LangD LanguageKind = "d"
6698− // @since 3.18.0
6699− // @proposed
6700− LangDelphi LanguageKind = "pascal"
6701− LangDiff LanguageKind = "diff"
6702− LangDart LanguageKind = "dart"
6703− LangDockerfile LanguageKind = "dockerfile"
6704− LangElixir LanguageKind = "elixir"
6705− LangErlang LanguageKind = "erlang"
6706− LangFSharp LanguageKind = "fsharp"
6707− LangGitCommit LanguageKind = "git-commit"
6708− LangGitRebase LanguageKind = "rebase"
6709− LangGo LanguageKind = "go"
6710− LangGroovy LanguageKind = "groovy"
6711− LangHandlebars LanguageKind = "handlebars"
6712− LangHaskell LanguageKind = "haskell"
6713− LangHTML LanguageKind = "html"
6714− LangIni LanguageKind = "ini"
6715− LangJava LanguageKind = "java"
6716− LangJavaScript LanguageKind = "javascript"
6717− LangJavaScriptReact LanguageKind = "javascriptreact"
6718− LangJSON LanguageKind = "json"
6719− LangLaTeX LanguageKind = "latex"
6720− LangLess LanguageKind = "less"
6721− LangLua LanguageKind = "lua"
6722− LangMakefile LanguageKind = "makefile"
6723− LangMarkdown LanguageKind = "markdown"
6724− LangObjectiveC LanguageKind = "objective-c"
6725− LangObjectiveCPP LanguageKind = "objective-cpp"
6726− // @since 3.18.0
6727− // @proposed
6728− LangPascal LanguageKind = "pascal"
6729− LangPerl LanguageKind = "perl"
6730− LangPerl6 LanguageKind = "perl6"
6731− LangPHP LanguageKind = "php"
6732− LangPowershell LanguageKind = "powershell"
6733− LangPug LanguageKind = "jade"
6734− LangPython LanguageKind = "python"
6735− LangR LanguageKind = "r"
6736− LangRazor LanguageKind = "razor"
6737− LangRuby LanguageKind = "ruby"
6738− LangRust LanguageKind = "rust"
6739− LangSCSS LanguageKind = "scss"
6740− LangSASS LanguageKind = "sass"
6741− LangScala LanguageKind = "scala"
6742− LangShaderLab LanguageKind = "shaderlab"
6743− LangShellScript LanguageKind = "shellscript"
6744− LangSQL LanguageKind = "sql"
6745− LangSwift LanguageKind = "swift"
6746− LangTypeScript LanguageKind = "typescript"
6747− LangTypeScriptReact LanguageKind = "typescriptreact"
6748− LangTeX LanguageKind = "tex"
6749− LangVisualBasic LanguageKind = "vb"
6750− LangXML LanguageKind = "xml"
6751− LangXSL LanguageKind = "xsl"
6752− LangYAML LanguageKind = "yaml"
6753− // Describes the content type that a client supports in various
6754− // result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
6755− //
6756− // Please note that `MarkupKinds` must not start with a `$`. This kinds
6757− // are reserved for internal usage.
6758− // Plain text is supported as a content format
6759− PlainText MarkupKind = "plaintext"
6760− // Markdown is supported as a content format
6761− Markdown MarkupKind = "markdown"
6762− // The message type
6763− // An error message.
6764− Error MessageType = 1
6765− // A warning message.
6766− Warning MessageType = 2
6767− // An information message.
6768− Info MessageType = 3
6769− // A log message.
6770− Log MessageType = 4
6771− // A debug message.
6772− //
6773− // @since 3.18.0
6774− // @proposed
6775− Debug MessageType = 5
6776− // The moniker kind.
6777− //
6778− // @since 3.16.0
6779− // The moniker represent a symbol that is imported into a project
6780− Import MonikerKind = "import"
6781− // The moniker represents a symbol that is exported from a project
6782− Export MonikerKind = "export"
6783− // The moniker represents a symbol that is local to a project (e.g. a local
6784− // variable of a function, a class not visible outside the project, ...)
6785− Local MonikerKind = "local"
6786− // A notebook cell kind.
6787− //
6788− // @since 3.17.0
6789− // A markup-cell is formatted source that is used for display.
6790− Markup NotebookCellKind = 1
6791− // A code-cell is source code.
6792− Code NotebookCellKind = 2
6793− // A set of predefined position encoding kinds.
6794− //
6795− // @since 3.17.0
6796− // Character offsets count UTF-8 code units (e.g. bytes).
6797− UTF8 PositionEncodingKind = "utf-8"
6798− // Character offsets count UTF-16 code units.
6799− //
6800− // This is the default and must always be supported
6801− // by servers
6802− UTF16 PositionEncodingKind = "utf-16"
6803− // Character offsets count UTF-32 code units.
6804− //
6805− // Implementation note: these are the same as Unicode codepoints,
6806− // so this `PositionEncodingKind` may also be used for an
6807− // encoding-agnostic representation of character offsets.
6808− UTF32 PositionEncodingKind = "utf-32"
6809− // The client's default behavior is to select the identifier
6810− // according the to language's syntax rule.
6811− Identifier PrepareSupportDefaultBehavior = 1
6812− // Supports creating new files and folders.
6813− Create ResourceOperationKind = "create"
6814− // Supports renaming existing files and folders.
6815− Rename ResourceOperationKind = "rename"
6816− // Supports deleting existing files and folders.
6817− Delete ResourceOperationKind = "delete"
6818− // A set of predefined token modifiers. This set is not fixed
6819− // an clients can specify additional token types via the
6820− // corresponding client capabilities.
6821− //
6822− // @since 3.16.0
6823− ModDeclaration SemanticTokenModifiers = "declaration"
6824− ModDefinition SemanticTokenModifiers = "definition"
6825− ModReadonly SemanticTokenModifiers = "readonly"
6826− ModStatic SemanticTokenModifiers = "static"
6827− ModDeprecated SemanticTokenModifiers = "deprecated"
6828− ModAbstract SemanticTokenModifiers = "abstract"
6829− ModAsync SemanticTokenModifiers = "async"
6830− ModModification SemanticTokenModifiers = "modification"
6831− ModDocumentation SemanticTokenModifiers = "documentation"
6832− ModDefaultLibrary SemanticTokenModifiers = "defaultLibrary"
6833− // A set of predefined token types. This set is not fixed
6834− // an clients can specify additional token types via the
6835− // corresponding client capabilities.
6836− //
6837− // @since 3.16.0
6838− NamespaceType SemanticTokenTypes = "namespace"
6839− // Represents a generic type. Acts as a fallback for types which can't be mapped to
6840− // a specific type like class or enum.
6841− TypeType SemanticTokenTypes = "type"
6842− ClassType SemanticTokenTypes = "class"
6843− EnumType SemanticTokenTypes = "enum"
6844− InterfaceType SemanticTokenTypes = "interface"
6845− StructType SemanticTokenTypes = "struct"
6846− TypeParameterType SemanticTokenTypes = "typeParameter"
6847− ParameterType SemanticTokenTypes = "parameter"
6848− VariableType SemanticTokenTypes = "variable"
6849− PropertyType SemanticTokenTypes = "property"
6850− EnumMemberType SemanticTokenTypes = "enumMember"
6851− EventType SemanticTokenTypes = "event"
6852− FunctionType SemanticTokenTypes = "function"
6853− MethodType SemanticTokenTypes = "method"
6854− MacroType SemanticTokenTypes = "macro"
6855− KeywordType SemanticTokenTypes = "keyword"
6856− ModifierType SemanticTokenTypes = "modifier"
6857− CommentType SemanticTokenTypes = "comment"
6858− StringType SemanticTokenTypes = "string"
6859− NumberType SemanticTokenTypes = "number"
6860− RegexpType SemanticTokenTypes = "regexp"
6861− OperatorType SemanticTokenTypes = "operator"
6862− // @since 3.17.0
6863− DecoratorType SemanticTokenTypes = "decorator"
6864− // @since 3.18.0
6865− LabelType SemanticTokenTypes = "label"
6866− // How a signature help was triggered.
6867− //
6868− // @since 3.15.0
6869− // Signature help was invoked manually by the user or by a command.
6870− SigInvoked SignatureHelpTriggerKind = 1
6871− // Signature help was triggered by a trigger character.
6872− SigTriggerCharacter SignatureHelpTriggerKind = 2
6873− // Signature help was triggered by the cursor moving or by the document content changing.
6874− SigContentChange SignatureHelpTriggerKind = 3
6875− // A symbol kind.
6876− File SymbolKind = 1
6877− Module SymbolKind = 2
6878− Namespace SymbolKind = 3
6879− Package SymbolKind = 4
6880− Class SymbolKind = 5
6881− Method SymbolKind = 6
6882− Property SymbolKind = 7
6883− Field SymbolKind = 8
6884− Constructor SymbolKind = 9
6885− Enum SymbolKind = 10
6886− Interface SymbolKind = 11
6887− Function SymbolKind = 12
6888− Variable SymbolKind = 13
6889− Constant SymbolKind = 14
6890− String SymbolKind = 15
6891− Number SymbolKind = 16
6892− Boolean SymbolKind = 17
6893− Array SymbolKind = 18
6894− Object SymbolKind = 19
6895− Key SymbolKind = 20
6896− Null SymbolKind = 21
6897− EnumMember SymbolKind = 22
6898− Struct SymbolKind = 23
6899− Event SymbolKind = 24
6900− Operator SymbolKind = 25
6901− TypeParameter SymbolKind = 26
6902− // Symbol tags are extra annotations that tweak the rendering of a symbol.
6903− //
6904− // @since 3.16
6905− // Render a symbol as obsolete, usually using a strike-out.
6906− DeprecatedSymbol SymbolTag = 1
6907− // Represents reasons why a text document is saved.
6908− // Manually triggered, e.g. by the user pressing save, by starting debugging,
6909− // or by an API call.
6910− Manual TextDocumentSaveReason = 1
6911− // Automatic after a delay.
6912− AfterDelay TextDocumentSaveReason = 2
6913− // When the editor lost focus.
6914− FocusOut TextDocumentSaveReason = 3
6915− // Defines how the host (editor) should sync
6916− // document changes to the language server.
6917− // Documents should not be synced at all.
6918− None TextDocumentSyncKind = 0
6919− // Documents are synced by always sending the full content
6920− // of the document.
6921− Full TextDocumentSyncKind = 1
6922− // Documents are synced by sending the full content on open.
6923− // After that only incremental updates to the document are
6924− // send.
6925− Incremental TextDocumentSyncKind = 2
6926− Relative TokenFormat = "relative"
6927− // Turn tracing off.
6928− Off TraceValue = "off"
6929− // Trace messages only.
6930− Messages TraceValue = "messages"
6931− // Verbose message tracing.
6932− Verbose TraceValue = "verbose"
6933− // Moniker uniqueness level to define scope of the moniker.
6934− //
6935− // @since 3.16.0
6936− // The moniker is only unique inside a document
6937− Document UniquenessLevel = "document"
6938− // The moniker is unique inside a project for which a dump got created
6939− Project UniquenessLevel = "project"
6940− // The moniker is unique inside the group to which a project belongs
6941− Group UniquenessLevel = "group"
6942− // The moniker is unique inside the moniker scheme.
6943− Scheme UniquenessLevel = "scheme"
6944− // The moniker is globally unique
6945− Global UniquenessLevel = "global"
6946− // Interested in create events.
6947− WatchCreate WatchKind = 1
6948− // Interested in change events
6949− WatchChange WatchKind = 2
6950− // Interested in delete events
6951− WatchDelete WatchKind = 4
6952−)
internal/lsp/protocol/uri.godeleted−229
@@ -1,229 +0,0 @@
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, error) {
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− return "", fmt.Errorf("invalid URI %q: %w", uri, err)
83− }
84− return filepath.FromSlash(filename), nil
85−}
86−
87−// Dir returns the URI for the directory containing the receiver.
88−func (uri DocumentURI) Dir() (DocumentURI, error) {
89− // XXX: Legacy comment:
90− // This function could be more efficiently implemented by avoiding any call
91− // to Path(), but at least consolidates URI manipulation.
92−
93− path, err := uri.DirPath()
94− if err != nil {
95− return "", fmt.Errorf("invalid URI %q: %w", uri, err)
96− }
97−
98− return URIFromPath(path), nil
99−}
100−
101−// DirPath returns the file path to the directory containing this URI, which
102−// must be a file URI.
103−func (uri DocumentURI) DirPath() (string, error) {
104− path, err := uri.Path()
105− if err != nil {
106− return "", err
107− }
108− return filepath.Dir(path), nil
109−}
110−
111−func filename(uri DocumentURI) (string, error) {
112− if uri == "" {
113− return "", nil
114− }
115−
116− // This conservative check for the common case
117− // of a simple non-empty absolute POSIX filename
118− // avoids the allocation of a net.URL.
119− if strings.HasPrefix(string(uri), "file:///") {
120− rest := string(uri)[len("file://"):] // leave one slash
121− for i := range len(rest) {
122− b := rest[i]
123− // Reject these cases:
124− if b < ' ' || b == 0x7f || // control character
125− b == '%' || b == '+' || // URI escape
126− b == ':' || // Windows drive letter
127− b == '@' || b == '&' || b == '?' { // authority or query
128− goto slow
129− }
130− }
131− return rest, nil
132− }
133−slow:
134−
135− u, err := url.ParseRequestURI(string(uri))
136− if err != nil {
137− return "", err
138− }
139− if u.Scheme != fileScheme {
140− return "", fmt.Errorf("only file URIs are supported, got %q from %q", u.Scheme, uri)
141− }
142− // If the URI is a Windows URI, we trim the leading "/" and uppercase
143− // the drive letter, which will never be case sensitive.
144− if isWindowsDriveURIPath(u.Path) {
145− u.Path = strings.ToUpper(string(u.Path[1])) + u.Path[2:]
146− }
147−
148− return u.Path, nil
149−}
150−
151−// ParseDocumentURI interprets a string as a DocumentUri, applying VS
152−// Code workarounds; see [DocumentURI.UnmarshalText] for details.
153−func ParseDocumentURI(s string) (DocumentURI, error) {
154− if s == "" {
155− return "", nil
156− }
157−
158− if !strings.HasPrefix(s, "file://") {
159− return "", fmt.Errorf("DocumentUri scheme is not 'file': %s", s)
160− }
161−
162− // VS Code sends URLs with only two slashes,
163− // which are invalid. golang/go#39789.
164− if !strings.HasPrefix(s, "file:///") {
165− s = "file:///" + s[len("file://"):]
166− }
167−
168− // Even though the input is a URI, it may not be in canonical form. VS Code
169− // in particular over-escapes :, @, etc. Unescape and re-encode to canonicalize.
170− path, err := url.PathUnescape(s[len("file://"):])
171− if err != nil {
172− return "", err
173− }
174−
175− // File URIs from Windows may have lowercase drive letters.
176− // Since drive letters are guaranteed to be case insensitive,
177− // we change them to uppercase to remain consistent.
178− // For example, file:///c:/x/y/z becomes file:///C:/x/y/z.
179− if isWindowsDriveURIPath(path) {
180− path = path[:1] + strings.ToUpper(string(path[1])) + path[2:]
181− }
182− u := url.URL{Scheme: fileScheme, Path: path}
183− return DocumentURI(u.String()), nil
184−}
185−
186−// URIFromPath returns DocumentUri for the supplied file path.
187−// Given "", it returns "".
188−func URIFromPath(path string) DocumentURI {
189− if path == "" {
190− return ""
191− }
192− if !isWindowsDrivePath(path) {
193− if abs, err := filepath.Abs(path); err == nil {
194− path = abs
195− }
196− }
197− // Check the file path again, in case it became absolute.
198− if isWindowsDrivePath(path) {
199− path = "/" + strings.ToUpper(string(path[0])) + path[1:]
200− }
201− path = filepath.ToSlash(path)
202− u := url.URL{
203− Scheme: fileScheme,
204− Path: path,
205− }
206− return DocumentURI(u.String())
207−}
208−
209−const fileScheme = "file"
210−
211−// isWindowsDrivePath returns true if the file path is of the form used by
212−// Windows. We check if the path begins with a drive letter, followed by a ":".
213−// For example: C:/x/y/z.
214−func isWindowsDrivePath(path string) bool {
215− if len(path) < 3 {
216− return false
217− }
218− return unicode.IsLetter(rune(path[0])) && path[1] == ':'
219−}
220−
221−// isWindowsDriveURIPath returns true if the file URI is of the format used by
222−// Windows URIs. The url.Parse package does not specially handle Windows paths
223−// (see golang/go#6027), so we check if the URI path has a drive prefix (e.g. "/C:").
224−func isWindowsDriveURIPath(uri string) bool {
225− if len(uri) < 4 {
226− return false
227− }
228− return uri[0] == '/' && unicode.IsLetter(rune(uri[1])) && uri[2] == ':'
229−}
internal/lsp/rootmarkers_test.gonew file+37
@@ -0,0 +1,37 @@
1+package lsp
2+
3+import (
4+ "os"
5+ "path/filepath"
6+ "testing"
7+
8+ "github.com/stretchr/testify/require"
9+)
10+
11+func TestHasRootMarkers(t *testing.T) {
12+ t.Parallel()
13+
14+ // Create a temporary directory for testing
15+ tmpDir := t.TempDir()
16+
17+ // Test with empty root markers (should return true)
18+ require.True(t, HasRootMarkers(tmpDir, []string{}))
19+
20+ // Test with non-existent markers
21+ require.False(t, HasRootMarkers(tmpDir, []string{"go.mod", "package.json"}))
22+
23+ // Create a go.mod file
24+ goModPath := filepath.Join(tmpDir, "go.mod")
25+ err := os.WriteFile(goModPath, []byte("module test"), 0o644)
26+ require.NoError(t, err)
27+
28+ // Test with existing marker
29+ require.True(t, HasRootMarkers(tmpDir, []string{"go.mod", "package.json"}))
30+
31+ // Test with only non-existent markers
32+ require.False(t, HasRootMarkers(tmpDir, []string{"package.json", "Cargo.toml"}))
33+
34+ // Test with glob patterns
35+ require.True(t, HasRootMarkers(tmpDir, []string{"*.mod"}))
36+ require.False(t, HasRootMarkers(tmpDir, []string{"*.json"}))
37+}
internal/lsp/transport.godeleted−284
@@ -1,284 +0,0 @@
1−package lsp
2−
3−import (
4− "bufio"
5− "context"
6− "encoding/json"
7− "fmt"
8− "io"
9− "log/slog"
10− "strings"
11−
12− "github.com/charmbracelet/crush/internal/config"
13−)
14−
15−// WriteMessage writes an LSP message to the given writer
16−func WriteMessage(w io.Writer, msg *Message) error {
17− data, err := json.Marshal(msg)
18− if err != nil {
19− return fmt.Errorf("failed to marshal message: %w", err)
20− }
21− cfg := config.Get()
22−
23− if cfg.Options.DebugLSP {
24− slog.Debug("Sending message to server", "method", msg.Method, "id", msg.ID)
25− }
26−
27− _, err = fmt.Fprintf(w, "Content-Length: %d\r\n\r\n", len(data))
28− if err != nil {
29− return fmt.Errorf("failed to write header: %w", err)
30− }
31−
32− _, err = w.Write(data)
33− if err != nil {
34− return fmt.Errorf("failed to write message: %w", err)
35− }
36−
37− return nil
38−}
39−
40−// ReadMessage reads a single LSP message from the given reader
41−func ReadMessage(r *bufio.Reader) (*Message, error) {
42− cfg := config.Get()
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 cfg.Options.DebugLSP {
53− slog.Debug("Received header", "line", 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 cfg.Options.DebugLSP {
69− slog.Debug("Content-Length", "length", 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 cfg.Options.DebugLSP {
80− slog.Debug("Received content", "content", 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− cfg := config.Get()
95− for {
96− msg, err := ReadMessage(c.stdout)
97− if err != nil {
98− if cfg.Options.DebugLSP {
99− slog.Error("Error reading message", "error", err)
100− }
101− return
102− }
103−
104− // Handle server->client request (has both Method and ID)
105− if msg.Method != "" && msg.ID != 0 {
106− if cfg.Options.DebugLSP {
107− slog.Debug("Received request from server", "method", msg.Method, "id", msg.ID)
108− }
109−
110− response := &Message{
111− JSONRPC: "2.0",
112− ID: msg.ID,
113− }
114−
115− // Look up handler for this method
116− c.serverHandlersMu.RLock()
117− handler, ok := c.serverRequestHandlers[msg.Method]
118− c.serverHandlersMu.RUnlock()
119−
120− if ok {
121− result, err := handler(msg.Params)
122− if err != nil {
123− response.Error = &ResponseError{
124− Code: -32603,
125− Message: err.Error(),
126− }
127− } else {
128− rawJSON, err := json.Marshal(result)
129− if err != nil {
130− response.Error = &ResponseError{
131− Code: -32603,
132− Message: fmt.Sprintf("failed to marshal response: %v", err),
133− }
134− } else {
135− response.Result = rawJSON
136− }
137− }
138− } else {
139− response.Error = &ResponseError{
140− Code: -32601,
141− Message: fmt.Sprintf("method not found: %s", msg.Method),
142− }
143− }
144−
145− // Send response back to server
146− if err := WriteMessage(c.stdin, response); err != nil {
147− slog.Error("Error sending response to server", "error", err)
148− }
149−
150− continue
151− }
152−
153− // Handle notification (has Method but no ID)
154− if msg.Method != "" && msg.ID == 0 {
155− c.notificationMu.RLock()
156− handler, ok := c.notificationHandlers[msg.Method]
157− c.notificationMu.RUnlock()
158−
159− if ok {
160− if cfg.Options.DebugLSP {
161− slog.Debug("Handling notification", "method", msg.Method)
162− }
163− go handler(msg.Params)
164− } else if cfg.Options.DebugLSP {
165− slog.Debug("No handler for notification", "method", msg.Method)
166− }
167− continue
168− }
169−
170− // Handle response to our request (has ID but no Method)
171− if msg.ID != 0 && msg.Method == "" {
172− c.handlersMu.RLock()
173− ch, ok := c.handlers[msg.ID]
174− c.handlersMu.RUnlock()
175−
176− if ok {
177− if cfg.Options.DebugLSP {
178− slog.Debug("Received response for request", "id", msg.ID)
179− }
180− ch <- msg
181− close(ch)
182− } else if cfg.Options.DebugLSP {
183− slog.Debug("No handler for response", "id", msg.ID)
184− }
185− }
186− }
187−}
188−
189−// Call makes a request and waits for the response
190−func (c *Client) Call(ctx context.Context, method string, params any, result any) error {
191− if !c.IsMethodSupported(method) {
192− return fmt.Errorf("method not supported by server: %s", method)
193− }
194− id := c.nextID.Add(1)
195−
196− cfg := config.Get()
197− if cfg.Options.DebugLSP {
198− slog.Debug("Making call", "method", method, "id", id)
199− }
200−
201− msg, err := NewRequest(id, method, params)
202− if err != nil {
203− return fmt.Errorf("failed to create request: %w", err)
204− }
205−
206− // Create response channel
207− ch := make(chan *Message, 1)
208− c.handlersMu.Lock()
209− c.handlers[id] = ch
210− c.handlersMu.Unlock()
211−
212− defer func() {
213− c.handlersMu.Lock()
214− delete(c.handlers, id)
215− c.handlersMu.Unlock()
216− }()
217−
218− // Send request
219− if err := WriteMessage(c.stdin, msg); err != nil {
220− return fmt.Errorf("failed to send request: %w", err)
221− }
222−
223− if cfg.Options.DebugLSP {
224− slog.Debug("Request sent", "method", method, "id", id)
225− }
226−
227− // Wait for response
228− select {
229− case <-ctx.Done():
230− return ctx.Err()
231− case resp := <-ch:
232− if cfg.Options.DebugLSP {
233− slog.Debug("Received response", "id", id)
234− }
235−
236− if resp.Error != nil {
237− return fmt.Errorf("request failed: %s (code: %d)", resp.Error.Message, resp.Error.Code)
238− }
239−
240− if result != nil {
241− // If result is a json.RawMessage, just copy the raw bytes
242− if rawMsg, ok := result.(*json.RawMessage); ok {
243− *rawMsg = resp.Result
244− return nil
245− }
246− // Otherwise unmarshal into the provided type
247− if err := json.Unmarshal(resp.Result, result); err != nil {
248− return fmt.Errorf("failed to unmarshal result: %w", err)
249− }
250− }
251−
252− return nil
253− }
254−}
255−
256−// Notify sends a notification (a request without an ID that doesn't expect a response)
257−func (c *Client) Notify(ctx context.Context, method string, params any) error {
258− cfg := config.Get()
259− if !c.IsMethodSupported(method) {
260− if cfg.Options.DebugLSP {
261− slog.Debug("Skipping notification: method not supported by server", "method", method)
262− }
263− return nil
264− }
265− if cfg.Options.DebugLSP {
266− slog.Debug("Sending notification", "method", method)
267− }
268−
269− msg, err := NewNotification(method, params)
270− if err != nil {
271− return fmt.Errorf("failed to create notification: %w", err)
272− }
273−
274− if err := WriteMessage(c.stdin, msg); err != nil {
275− return fmt.Errorf("failed to send notification: %w", err)
276− }
277−
278− return nil
279−}
280−
281−type (
282− NotificationHandler func(params json.RawMessage)
283− ServerRequestHandler func(params json.RawMessage) (any, error)
284−)
internal/lsp/util/edit.go+1−1
@@ -7,7 +7,7 @@ import (
77 "sort"
88 "strings"
99
10− "github.com/charmbracelet/crush/internal/lsp/protocol"
10+ "github.com/charmbracelet/x/powernap/pkg/lsp/protocol"
1111)
1212
1313func applyTextEdits(uri protocol.DocumentURI, edits []protocol.TextEdit) error {
internal/lsp/watcher/global_watcher.go+1−1
@@ -15,7 +15,7 @@ import (
1515 "github.com/charmbracelet/crush/internal/config"
1616 "github.com/charmbracelet/crush/internal/csync"
1717 "github.com/charmbracelet/crush/internal/fsext"
18− "github.com/charmbracelet/crush/internal/lsp/protocol"
18+ "github.com/charmbracelet/x/powernap/pkg/lsp/protocol"
1919 "github.com/raphamorim/notify"
2020)
2121
internal/lsp/watcher/watcher.go+1−2
@@ -12,9 +12,8 @@ import (
1212 "github.com/bmatcuk/doublestar/v4"
1313 "github.com/charmbracelet/crush/internal/config"
1414 "github.com/charmbracelet/crush/internal/csync"
15−
1615 "github.com/charmbracelet/crush/internal/lsp"
17− "github.com/charmbracelet/crush/internal/lsp/protocol"
16+ "github.com/charmbracelet/x/powernap/pkg/lsp/protocol"
1817)
1918
2019// Client manages LSP file watching for a specific client
internal/tui/components/chat/header/header.go+1−1
@@ -8,13 +8,13 @@ import (
88 "github.com/charmbracelet/crush/internal/config"
99 "github.com/charmbracelet/crush/internal/fsext"
1010 "github.com/charmbracelet/crush/internal/lsp"
11− "github.com/charmbracelet/crush/internal/lsp/protocol"
1211 "github.com/charmbracelet/crush/internal/pubsub"
1312 "github.com/charmbracelet/crush/internal/session"
1413 "github.com/charmbracelet/crush/internal/tui/styles"
1514 "github.com/charmbracelet/crush/internal/tui/util"
1615 "github.com/charmbracelet/lipgloss/v2"
1716 "github.com/charmbracelet/x/ansi"
17+ "github.com/charmbracelet/x/powernap/pkg/lsp/protocol"
1818)
1919
2020type Header interface {
internal/tui/components/lsp/lsp.go+5−3
@@ -4,14 +4,13 @@ import (
44 "fmt"
55 "strings"
66
7− "github.com/charmbracelet/lipgloss/v2"
8−
97 "github.com/charmbracelet/crush/internal/app"
108 "github.com/charmbracelet/crush/internal/config"
119 "github.com/charmbracelet/crush/internal/lsp"
12− "github.com/charmbracelet/crush/internal/lsp/protocol"
1310 "github.com/charmbracelet/crush/internal/tui/components/core"
1411 "github.com/charmbracelet/crush/internal/tui/styles"
12+ "github.com/charmbracelet/lipgloss/v2"
13+ "github.com/charmbracelet/x/powernap/pkg/lsp/protocol"
1514)
1615
1716// RenderOptions contains options for rendering LSP lists.
@@ -77,6 +76,9 @@ func RenderLSPList(lspClients map[string]*lsp.Client, opts RenderOptions) []stri
7776 } else {
7877 description = t.S().Subtle.Render("error")
7978 }
79+ case lsp.StateDisabled:
80+ icon = t.ItemOfflineIcon.Foreground(t.FgMuted)
81+ description = t.S().Base.Foreground(t.FgMuted).Render("no root markers found")
8082 }
8183 }
8284
schema.json+21−4
@@ -44,7 +44,7 @@
4444 },
4545 "LSPConfig": {
4646 "properties": {
47− "enabled": {
47+ "disabled": {
4848 "type": "boolean",
4949 "description": "Whether this LSP server is disabled",
5050 "default": false
@@ -70,9 +70,6 @@
7070 "type": "object",
7171 "description": "Environment variables to set to the LSP server command"
7272 },
73− "options": {
74− "description": "LSP server-specific configuration options"
75− },
7673 "filetypes": {
7774 "items": {
7875 "type": "string",
@@ -87,6 +84,26 @@
8784 },
8885 "type": "array",
8986 "description": "File types this LSP server handles"
87+ },
88+ "root_markers": {
89+ "items": {
90+ "type": "string",
91+ "examples": [
92+ "go.mod",
93+ "package.json",
94+ "Cargo.toml"
95+ ]
96+ },
97+ "type": "array",
98+ "description": "Files or directories that indicate the project root"
99+ },
100+ "init_options": {
101+ "type": "object",
102+ "description": "Initialization options passed to the LSP server during initialize request"
103+ },
104+ "options": {
105+ "type": "object",
106+ "description": "LSP server-specific settings passed during initialization"
90107 }
91108 },
92109 "additionalProperties": false,