on main help sign in
chore(lint): enable staticcheck and fix its issues
5c319e6Tai Groot
.golangci.yml+1−1
@@ -19,6 +19,7 @@ linters:
19 # - revive
19 # - revive
20 - rowserrcheck
20 - rowserrcheck
21 - sqlclosecheck
21 - sqlclosecheck
22+ - staticcheck
22 - tparallel
23 - tparallel
23 # - unconvert
24 # - unconvert
24 # - unparam
25 # - unparam
@@ -27,7 +28,6 @@ linters:
27 disable:
28 disable:
28 - errcheck
29 - errcheck
29 - ineffassign
30 - ineffassign
30− - staticcheck
31 - unused
31 - unused
32 exclusions:
32 exclusions:
33 generated: lax
33 generated: lax
internal/app/app.go+5−5
@@ -93,7 +93,7 @@ func New(ctx context.Context, conn *sql.DB, cfg *config.Config) (*App, error) {
93}
93}
94
94
95// RunNonInteractive handles the execution flow when a prompt is provided via CLI flag.
95// RunNonInteractive handles the execution flow when a prompt is provided via CLI flag.
96−func (a *App) RunNonInteractive(ctx context.Context, prompt string, quiet bool) error {
96+func (app *App) RunNonInteractive(ctx context.Context, prompt string, quiet bool) error {
97 slog.Info("Running in non-interactive mode")
97 slog.Info("Running in non-interactive mode")
98
98
99 ctx, cancel := context.WithCancel(ctx)
99 ctx, cancel := context.WithCancel(ctx)
@@ -125,21 +125,21 @@ func (a *App) RunNonInteractive(ctx context.Context, prompt string, quiet bool)
125 }
125 }
126 title := titlePrefix + titleSuffix
126 title := titlePrefix + titleSuffix
127
127
128− sess, err := a.Sessions.Create(ctx, title)
128+ sess, err := app.Sessions.Create(ctx, title)
129 if err != nil {
129 if err != nil {
130 return fmt.Errorf("failed to create session for non-interactive mode: %w", err)
130 return fmt.Errorf("failed to create session for non-interactive mode: %w", err)
131 }
131 }
132 slog.Info("Created session for non-interactive run", "session_id", sess.ID)
132 slog.Info("Created session for non-interactive run", "session_id", sess.ID)
133
133
134 // Automatically approve all permission requests for this non-interactive session
134 // Automatically approve all permission requests for this non-interactive session
135− a.Permissions.AutoApproveSession(sess.ID)
135+ app.Permissions.AutoApproveSession(sess.ID)
136
136
137− done, err := a.CoderAgent.Run(ctx, sess.ID, prompt)
137+ done, err := app.CoderAgent.Run(ctx, sess.ID, prompt)
138 if err != nil {
138 if err != nil {
139 return fmt.Errorf("failed to start agent processing stream: %w", err)
139 return fmt.Errorf("failed to start agent processing stream: %w", err)
140 }
140 }
141
141
142− messageEvents := a.Messages.Subscribe(ctx)
142+ messageEvents := app.Messages.Subscribe(ctx)
143 readBts := 0
143 readBts := 0
144
144
145 for {
145 for {
internal/config/load.go+53−53
@@ -87,16 +87,16 @@ func Load(workingDir string, debug bool) (*Config, error) {
87 return cfg, nil
87 return cfg, nil
88}
88}
89
89
90−func (cfg *Config) configureProviders(env env.Env, resolver VariableResolver, knownProviders []provider.Provider) error {
90+func (c *Config) configureProviders(env env.Env, resolver VariableResolver, knownProviders []provider.Provider) error {
91 knownProviderNames := make(map[string]bool)
91 knownProviderNames := make(map[string]bool)
92 for _, p := range knownProviders {
92 for _, p := range knownProviders {
93 knownProviderNames[string(p.ID)] = true
93 knownProviderNames[string(p.ID)] = true
94− config, configExists := cfg.Providers[string(p.ID)]
94+ config, configExists := c.Providers[string(p.ID)]
95 // if the user configured a known provider we need to allow it to override a couple of parameters
95 // if the user configured a known provider we need to allow it to override a couple of parameters
96 if configExists {
96 if configExists {
97 if config.Disable {
97 if config.Disable {
98 slog.Debug("Skipping provider due to disable flag", "provider", p.ID)
98 slog.Debug("Skipping provider due to disable flag", "provider", p.ID)
99− delete(cfg.Providers, string(p.ID))
99+ delete(c.Providers, string(p.ID))
100 continue
100 continue
101 }
101 }
102 if config.BaseURL != "" {
102 if config.BaseURL != "" {
@@ -151,7 +151,7 @@ func (cfg *Config) configureProviders(env env.Env, resolver VariableResolver, kn
151 if !hasVertexCredentials(env) {
151 if !hasVertexCredentials(env) {
152 if configExists {
152 if configExists {
153 slog.Warn("Skipping Vertex AI provider due to missing credentials")
153 slog.Warn("Skipping Vertex AI provider due to missing credentials")
154− delete(cfg.Providers, string(p.ID))
154+ delete(c.Providers, string(p.ID))
155 }
155 }
156 continue
156 continue
157 }
157 }
@@ -161,7 +161,7 @@ func (cfg *Config) configureProviders(env env.Env, resolver VariableResolver, kn
161 if !hasAWSCredentials(env) {
161 if !hasAWSCredentials(env) {
162 if configExists {
162 if configExists {
163 slog.Warn("Skipping Bedrock provider due to missing AWS credentials")
163 slog.Warn("Skipping Bedrock provider due to missing AWS credentials")
164− delete(cfg.Providers, string(p.ID))
164+ delete(c.Providers, string(p.ID))
165 }
165 }
166 continue
166 continue
167 }
167 }
@@ -176,16 +176,16 @@ func (cfg *Config) configureProviders(env env.Env, resolver VariableResolver, kn
176 if v == "" || err != nil {
176 if v == "" || err != nil {
177 if configExists {
177 if configExists {
178 slog.Warn("Skipping provider due to missing API key", "provider", p.ID)
178 slog.Warn("Skipping provider due to missing API key", "provider", p.ID)
179− delete(cfg.Providers, string(p.ID))
179+ delete(c.Providers, string(p.ID))
180 }
180 }
181 continue
181 continue
182 }
182 }
183 }
183 }
184− cfg.Providers[string(p.ID)] = prepared
184+ c.Providers[string(p.ID)] = prepared
185 }
185 }
186
186
187 // validate the custom providers
187 // validate the custom providers
188− for id, providerConfig := range cfg.Providers {
188+ for id, providerConfig := range c.Providers {
189 if knownProviderNames[id] {
189 if knownProviderNames[id] {
190 continue
190 continue
191 }
191 }
@@ -202,7 +202,7 @@ func (cfg *Config) configureProviders(env env.Env, resolver VariableResolver, kn
202
202
203 if providerConfig.Disable {
203 if providerConfig.Disable {
204 slog.Debug("Skipping custom provider due to disable flag", "provider", id)
204 slog.Debug("Skipping custom provider due to disable flag", "provider", id)
205− delete(cfg.Providers, id)
205+ delete(c.Providers, id)
206 continue
206 continue
207 }
207 }
208 if providerConfig.APIKey == "" {
208 if providerConfig.APIKey == "" {
@@ -210,17 +210,17 @@ func (cfg *Config) configureProviders(env env.Env, resolver VariableResolver, kn
210 }
210 }
211 if providerConfig.BaseURL == "" {
211 if providerConfig.BaseURL == "" {
212 slog.Warn("Skipping custom provider due to missing API endpoint", "provider", id)
212 slog.Warn("Skipping custom provider due to missing API endpoint", "provider", id)
213− delete(cfg.Providers, id)
213+ delete(c.Providers, id)
214 continue
214 continue
215 }
215 }
216 if len(providerConfig.Models) == 0 {
216 if len(providerConfig.Models) == 0 {
217 slog.Warn("Skipping custom provider because the provider has no models", "provider", id)
217 slog.Warn("Skipping custom provider because the provider has no models", "provider", id)
218− delete(cfg.Providers, id)
218+ delete(c.Providers, id)
219 continue
219 continue
220 }
220 }
221 if providerConfig.Type != provider.TypeOpenAI {
221 if providerConfig.Type != provider.TypeOpenAI {
222 slog.Warn("Skipping custom provider because the provider type is not supported", "provider", id, "type", providerConfig.Type)
222 slog.Warn("Skipping custom provider because the provider type is not supported", "provider", id, "type", providerConfig.Type)
223− delete(cfg.Providers, id)
223+ delete(c.Providers, id)
224 continue
224 continue
225 }
225 }
226
226
@@ -231,50 +231,50 @@ func (cfg *Config) configureProviders(env env.Env, resolver VariableResolver, kn
231 baseURL, err := resolver.ResolveValue(providerConfig.BaseURL)
231 baseURL, err := resolver.ResolveValue(providerConfig.BaseURL)
232 if baseURL == "" || err != nil {
232 if baseURL == "" || err != nil {
233 slog.Warn("Skipping custom provider due to missing API endpoint", "provider", id, "error", err)
233 slog.Warn("Skipping custom provider due to missing API endpoint", "provider", id, "error", err)
234− delete(cfg.Providers, id)
234+ delete(c.Providers, id)
235 continue
235 continue
236 }
236 }
237
237
238− cfg.Providers[id] = providerConfig
238+ c.Providers[id] = providerConfig
239 }
239 }
240 return nil
240 return nil
241}
241}
242
242
243−func (cfg *Config) setDefaults(workingDir string) {
243+func (c *Config) setDefaults(workingDir string) {
244− cfg.workingDir = workingDir
244+ c.workingDir = workingDir
245− if cfg.Options == nil {
245+ if c.Options == nil {
246− cfg.Options = &Options{}
246+ c.Options = &Options{}
247 }
247 }
248− if cfg.Options.TUI == nil {
248+ if c.Options.TUI == nil {
249− cfg.Options.TUI = &TUIOptions{}
249+ c.Options.TUI = &TUIOptions{}
250 }
250 }
251− if cfg.Options.ContextPaths == nil {
251+ if c.Options.ContextPaths == nil {
252− cfg.Options.ContextPaths = []string{}
252+ c.Options.ContextPaths = []string{}
253 }
253 }
254− if cfg.Options.DataDirectory == "" {
254+ if c.Options.DataDirectory == "" {
255− cfg.Options.DataDirectory = filepath.Join(workingDir, defaultDataDirectory)
255+ c.Options.DataDirectory = filepath.Join(workingDir, defaultDataDirectory)
256 }
256 }
257− if cfg.Providers == nil {
257+ if c.Providers == nil {
258− cfg.Providers = make(map[string]ProviderConfig)
258+ c.Providers = make(map[string]ProviderConfig)
259 }
259 }
260− if cfg.Models == nil {
260+ if c.Models == nil {
261− cfg.Models = make(map[SelectedModelType]SelectedModel)
261+ c.Models = make(map[SelectedModelType]SelectedModel)
262 }
262 }
263− if cfg.MCP == nil {
263+ if c.MCP == nil {
264− cfg.MCP = make(map[string]MCPConfig)
264+ c.MCP = make(map[string]MCPConfig)
265 }
265 }
266− if cfg.LSP == nil {
266+ if c.LSP == nil {
267− cfg.LSP = make(map[string]LSPConfig)
267+ c.LSP = make(map[string]LSPConfig)
268 }
268 }
269
269
270 // Add the default context paths if they are not already present
270 // Add the default context paths if they are not already present
271− cfg.Options.ContextPaths = append(defaultContextPaths, cfg.Options.ContextPaths...)
271+ c.Options.ContextPaths = append(defaultContextPaths, c.Options.ContextPaths...)
272− slices.Sort(cfg.Options.ContextPaths)
272+ slices.Sort(c.Options.ContextPaths)
273− cfg.Options.ContextPaths = slices.Compact(cfg.Options.ContextPaths)
273+ c.Options.ContextPaths = slices.Compact(c.Options.ContextPaths)
274}
274}
275
275
276−func (cfg *Config) defaultModelSelection(knownProviders []provider.Provider) (largeModel SelectedModel, smallModel SelectedModel, err error) {
276+func (c *Config) defaultModelSelection(knownProviders []provider.Provider) (largeModel SelectedModel, smallModel SelectedModel, err error) {
277− if len(knownProviders) == 0 && len(cfg.Providers) == 0 {
277+ if len(knownProviders) == 0 && len(c.Providers) == 0 {
278 err = fmt.Errorf("no providers configured, please configure at least one provider")
278 err = fmt.Errorf("no providers configured, please configure at least one provider")
279 return
279 return
280 }
280 }
@@ -282,11 +282,11 @@ func (cfg *Config) defaultModelSelection(knownProviders []provider.Provider) (la
282 // Use the first provider enabled based on the known providers order
282 // Use the first provider enabled based on the known providers order
283 // if no provider found that is known use the first provider configured
283 // if no provider found that is known use the first provider configured
284 for _, p := range knownProviders {
284 for _, p := range knownProviders {
285− providerConfig, ok := cfg.Providers[string(p.ID)]
285+ providerConfig, ok := c.Providers[string(p.ID)]
286 if !ok || providerConfig.Disable {
286 if !ok || providerConfig.Disable {
287 continue
287 continue
288 }
288 }
289− defaultLargeModel := cfg.GetModel(string(p.ID), p.DefaultLargeModelID)
289+ defaultLargeModel := c.GetModel(string(p.ID), p.DefaultLargeModelID)
290 if defaultLargeModel == nil {
290 if defaultLargeModel == nil {
291 err = fmt.Errorf("default large model %s not found for provider %s", p.DefaultLargeModelID, p.ID)
291 err = fmt.Errorf("default large model %s not found for provider %s", p.DefaultLargeModelID, p.ID)
292 return
292 return
@@ -298,7 +298,7 @@ func (cfg *Config) defaultModelSelection(knownProviders []provider.Provider) (la
298 ReasoningEffort: defaultLargeModel.DefaultReasoningEffort,
298 ReasoningEffort: defaultLargeModel.DefaultReasoningEffort,
299 }
299 }
300
300
301− defaultSmallModel := cfg.GetModel(string(p.ID), p.DefaultSmallModelID)
301+ defaultSmallModel := c.GetModel(string(p.ID), p.DefaultSmallModelID)
302 if defaultSmallModel == nil {
302 if defaultSmallModel == nil {
303 err = fmt.Errorf("default small model %s not found for provider %s", p.DefaultSmallModelID, p.ID)
303 err = fmt.Errorf("default small model %s not found for provider %s", p.DefaultSmallModelID, p.ID)
304 return
304 return
@@ -312,7 +312,7 @@ func (cfg *Config) defaultModelSelection(knownProviders []provider.Provider) (la
312 return
312 return
313 }
313 }
314
314
315− enabledProviders := cfg.EnabledProviders()
315+ enabledProviders := c.EnabledProviders()
316 slices.SortFunc(enabledProviders, func(a, b ProviderConfig) int {
316 slices.SortFunc(enabledProviders, func(a, b ProviderConfig) int {
317 return strings.Compare(a.ID, b.ID)
317 return strings.Compare(a.ID, b.ID)
318 })
318 })
@@ -327,13 +327,13 @@ func (cfg *Config) defaultModelSelection(knownProviders []provider.Provider) (la
327 err = fmt.Errorf("provider %s has no models configured", providerConfig.ID)
327 err = fmt.Errorf("provider %s has no models configured", providerConfig.ID)
328 return
328 return
329 }
329 }
330− defaultLargeModel := cfg.GetModel(providerConfig.ID, providerConfig.Models[0].ID)
330+ defaultLargeModel := c.GetModel(providerConfig.ID, providerConfig.Models[0].ID)
331 largeModel = SelectedModel{
331 largeModel = SelectedModel{
332 Provider: providerConfig.ID,
332 Provider: providerConfig.ID,
333 Model: defaultLargeModel.ID,
333 Model: defaultLargeModel.ID,
334 MaxTokens: defaultLargeModel.DefaultMaxTokens,
334 MaxTokens: defaultLargeModel.DefaultMaxTokens,
335 }
335 }
336− defaultSmallModel := cfg.GetModel(providerConfig.ID, providerConfig.Models[0].ID)
336+ defaultSmallModel := c.GetModel(providerConfig.ID, providerConfig.Models[0].ID)
337 smallModel = SelectedModel{
337 smallModel = SelectedModel{
338 Provider: providerConfig.ID,
338 Provider: providerConfig.ID,
339 Model: defaultSmallModel.ID,
339 Model: defaultSmallModel.ID,
@@ -342,14 +342,14 @@ func (cfg *Config) defaultModelSelection(knownProviders []provider.Provider) (la
342 return
342 return
343}
343}
344
344
345−func (cfg *Config) configureSelectedModels(knownProviders []provider.Provider) error {
345+func (c *Config) configureSelectedModels(knownProviders []provider.Provider) error {
346− defaultLarge, defaultSmall, err := cfg.defaultModelSelection(knownProviders)
346+ defaultLarge, defaultSmall, err := c.defaultModelSelection(knownProviders)
347 if err != nil {
347 if err != nil {
348 return fmt.Errorf("failed to select default models: %w", err)
348 return fmt.Errorf("failed to select default models: %w", err)
349 }
349 }
350 large, small := defaultLarge, defaultSmall
350 large, small := defaultLarge, defaultSmall
351
351
352− largeModelSelected, largeModelConfigured := cfg.Models[SelectedModelTypeLarge]
352+ largeModelSelected, largeModelConfigured := c.Models[SelectedModelTypeLarge]
353 if largeModelConfigured {
353 if largeModelConfigured {
354 if largeModelSelected.Model != "" {
354 if largeModelSelected.Model != "" {
355 large.Model = largeModelSelected.Model
355 large.Model = largeModelSelected.Model
@@ -357,11 +357,11 @@ func (cfg *Config) configureSelectedModels(knownProviders []provider.Provider) e
357 if largeModelSelected.Provider != "" {
357 if largeModelSelected.Provider != "" {
358 large.Provider = largeModelSelected.Provider
358 large.Provider = largeModelSelected.Provider
359 }
359 }
360− model := cfg.GetModel(large.Provider, large.Model)
360+ model := c.GetModel(large.Provider, large.Model)
361 if model == nil {
361 if model == nil {
362 large = defaultLarge
362 large = defaultLarge
363 // override the model type to large
363 // override the model type to large
364− err := cfg.UpdatePreferredModel(SelectedModelTypeLarge, large)
364+ err := c.UpdatePreferredModel(SelectedModelTypeLarge, large)
365 if err != nil {
365 if err != nil {
366 return fmt.Errorf("failed to update preferred large model: %w", err)
366 return fmt.Errorf("failed to update preferred large model: %w", err)
367 }
367 }
@@ -377,7 +377,7 @@ func (cfg *Config) configureSelectedModels(knownProviders []provider.Provider) e
377 large.Think = largeModelSelected.Think
377 large.Think = largeModelSelected.Think
378 }
378 }
379 }
379 }
380− smallModelSelected, smallModelConfigured := cfg.Models[SelectedModelTypeSmall]
380+ smallModelSelected, smallModelConfigured := c.Models[SelectedModelTypeSmall]
381 if smallModelConfigured {
381 if smallModelConfigured {
382 if smallModelSelected.Model != "" {
382 if smallModelSelected.Model != "" {
383 small.Model = smallModelSelected.Model
383 small.Model = smallModelSelected.Model
@@ -386,11 +386,11 @@ func (cfg *Config) configureSelectedModels(knownProviders []provider.Provider) e
386 small.Provider = smallModelSelected.Provider
386 small.Provider = smallModelSelected.Provider
387 }
387 }
388
388
389− model := cfg.GetModel(small.Provider, small.Model)
389+ model := c.GetModel(small.Provider, small.Model)
390 if model == nil {
390 if model == nil {
391 small = defaultSmall
391 small = defaultSmall
392 // override the model type to small
392 // override the model type to small
393− err := cfg.UpdatePreferredModel(SelectedModelTypeSmall, small)
393+ err := c.UpdatePreferredModel(SelectedModelTypeSmall, small)
394 if err != nil {
394 if err != nil {
395 return fmt.Errorf("failed to update preferred small model: %w", err)
395 return fmt.Errorf("failed to update preferred small model: %w", err)
396 }
396 }
@@ -404,8 +404,8 @@ func (cfg *Config) configureSelectedModels(knownProviders []provider.Provider) e
404 small.Think = smallModelSelected.Think
404 small.Think = smallModelSelected.Think
405 }
405 }
406 }
406 }
407− cfg.Models[SelectedModelTypeLarge] = large
407+ c.Models[SelectedModelTypeLarge] = large
408− cfg.Models[SelectedModelTypeSmall] = small
408+ c.Models[SelectedModelTypeSmall] = small
409 return nil
409 return nil
410}
410}
411
411
internal/llm/provider/gemini.go+3−3
@@ -73,7 +73,7 @@ func (g *geminiClient) convertMessages(messages []message.Message) []*genai.Cont
73
73
74 if len(msg.ToolCalls()) > 0 {
74 if len(msg.ToolCalls()) > 0 {
75 for _, call := range msg.ToolCalls() {
75 for _, call := range msg.ToolCalls() {
76− args, _ := parseJsonToMap(call.Input)
76+ args, _ := parseJSONToMap(call.Input)
77 assistantParts = append(assistantParts, &genai.Part{
77 assistantParts = append(assistantParts, &genai.Part{
78 FunctionCall: &genai.FunctionCall{
78 FunctionCall: &genai.FunctionCall{
79 Name: call.Name,
79 Name: call.Name,
@@ -93,7 +93,7 @@ func (g *geminiClient) convertMessages(messages []message.Message) []*genai.Cont
93 case message.Tool:
93 case message.Tool:
94 for _, result := range msg.ToolResults() {
94 for _, result := range msg.ToolResults() {
95 response := map[string]any{"result": result.Content}
95 response := map[string]any{"result": result.Content}
96− parsed, err := parseJsonToMap(result.Content)
96+ parsed, err := parseJSONToMap(result.Content)
97 if err == nil {
97 if err == nil {
98 response = parsed
98 response = parsed
99 }
99 }
@@ -468,7 +468,7 @@ func (g *geminiClient) Model() provider.Model {
468}
468}
469
469
470// Helper functions
470// Helper functions
471−func parseJsonToMap(jsonStr string) (map[string]any, error) {
471+func parseJSONToMap(jsonStr string) (map[string]any, error) {
472 var result map[string]any
472 var result map[string]any
473 err := json.Unmarshal([]byte(jsonStr), &result)
473 err := json.Unmarshal([]byte(jsonStr), &result)
474 return result, err
474 return result, err
internal/llm/provider/openai.go+2−2
@@ -463,6 +463,6 @@ func (o *openaiClient) usage(completion openai.ChatCompletion) TokenUsage {
463 }
463 }
464}
464}
465
465
466−func (a *openaiClient) Model() provider.Model {
466+func (o *openaiClient) Model() provider.Model {
467− return a.providerOptions.model(a.providerOptions.modelType)
467+ return o.providerOptions.model(o.providerOptions.modelType)
468}
468}
internal/llm/tools/diagnostics.go+2−2
@@ -108,7 +108,7 @@ func waitForLspDiagnostics(ctx context.Context, filePath string, lsps map[string
108 diagChan := make(chan struct{}, 1)
108 diagChan := make(chan struct{}, 1)
109
109
110 for _, client := range lsps {
110 for _, client := range lsps {
111− originalDiags := make(map[protocol.DocumentUri][]protocol.Diagnostic)
111+ originalDiags := make(map[protocol.DocumentURI][]protocol.Diagnostic)
112 maps.Copy(originalDiags, client.GetDiagnostics())
112 maps.Copy(originalDiags, client.GetDiagnostics())
113
113
114 handler := func(params json.RawMessage) {
114 handler := func(params json.RawMessage) {
@@ -148,7 +148,7 @@ func waitForLspDiagnostics(ctx context.Context, filePath string, lsps map[string
148 }
148 }
149}
149}
150
150
151−func hasDiagnosticsChanged(current, original map[protocol.DocumentUri][]protocol.Diagnostic) bool {
151+func hasDiagnosticsChanged(current, original map[protocol.DocumentURI][]protocol.Diagnostic) bool {
152 for uri, diags := range current {
152 for uri, diags := range current {
153 origDiags, exists := original[uri]
153 origDiags, exists := original[uri]
154 if !exists || len(diags) != len(origDiags) {
154 if !exists || len(diags) != len(origDiags) {
internal/lsp/client.go+15−15
@@ -42,7 +42,7 @@ type Client struct {
42 notificationMu sync.RWMutex
42 notificationMu sync.RWMutex
43
43
44 // Diagnostic cache
44 // Diagnostic cache
45− diagnostics map[protocol.DocumentUri][]protocol.Diagnostic
45+ diagnostics map[protocol.DocumentURI][]protocol.Diagnostic
46 diagnosticsMu sync.RWMutex
46 diagnosticsMu sync.RWMutex
47
47
48 // Files are currently opened by the LSP
48 // Files are currently opened by the LSP
@@ -81,7 +81,7 @@ func NewClient(ctx context.Context, command string, args ...string) (*Client, er
81 handlers: make(map[int32]chan *Message),
81 handlers: make(map[int32]chan *Message),
82 notificationHandlers: make(map[string]NotificationHandler),
82 notificationHandlers: make(map[string]NotificationHandler),
83 serverRequestHandlers: make(map[string]ServerRequestHandler),
83 serverRequestHandlers: make(map[string]ServerRequestHandler),
84− diagnostics: make(map[protocol.DocumentUri][]protocol.Diagnostic),
84+ diagnostics: make(map[protocol.DocumentURI][]protocol.Diagnostic),
85 openFiles: make(map[string]*OpenFileInfo),
85 openFiles: make(map[string]*OpenFileInfo),
86 }
86 }
87
87
@@ -449,13 +449,13 @@ func (c *Client) pingTypeScriptServer(ctx context.Context) error {
449
449
450 // If we have any open files, try to get document symbols for one
450 // If we have any open files, try to get document symbols for one
451 for uri := range c.openFiles {
451 for uri := range c.openFiles {
452− filePath := protocol.DocumentUri(uri).Path()
452+ filePath := protocol.DocumentURI(uri).Path()
453 if strings.HasSuffix(filePath, ".ts") || strings.HasSuffix(filePath, ".js") ||
453 if strings.HasSuffix(filePath, ".ts") || strings.HasSuffix(filePath, ".js") ||
454 strings.HasSuffix(filePath, ".tsx") || strings.HasSuffix(filePath, ".jsx") {
454 strings.HasSuffix(filePath, ".tsx") || strings.HasSuffix(filePath, ".jsx") {
455 var symbols []protocol.DocumentSymbol
455 var symbols []protocol.DocumentSymbol
456 err := c.Call(ctx, "textDocument/documentSymbol", protocol.DocumentSymbolParams{
456 err := c.Call(ctx, "textDocument/documentSymbol", protocol.DocumentSymbolParams{
457 TextDocument: protocol.TextDocumentIdentifier{
457 TextDocument: protocol.TextDocumentIdentifier{
458− URI: protocol.DocumentUri(uri),
458+ URI: protocol.DocumentURI(uri),
459 },
459 },
460 }, &symbols)
460 }, &symbols)
461 if err == nil {
461 if err == nil {
@@ -583,7 +583,7 @@ func (c *Client) pingWithServerCapabilities(ctx context.Context) error {
583
583
584type OpenFileInfo struct {
584type OpenFileInfo struct {
585 Version int32
585 Version int32
586− URI protocol.DocumentUri
586+ URI protocol.DocumentURI
587}
587}
588
588
589func (c *Client) OpenFile(ctx context.Context, filepath string) error {
589func (c *Client) OpenFile(ctx context.Context, filepath string) error {
@@ -604,7 +604,7 @@ func (c *Client) OpenFile(ctx context.Context, filepath string) error {
604
604
605 params := protocol.DidOpenTextDocumentParams{
605 params := protocol.DidOpenTextDocumentParams{
606 TextDocument: protocol.TextDocumentItem{
606 TextDocument: protocol.TextDocumentItem{
607− URI: protocol.DocumentUri(uri),
607+ URI: protocol.DocumentURI(uri),
608 LanguageID: DetectLanguageID(uri),
608 LanguageID: DetectLanguageID(uri),
609 Version: 1,
609 Version: 1,
610 Text: string(content),
610 Text: string(content),
@@ -618,7 +618,7 @@ func (c *Client) OpenFile(ctx context.Context, filepath string) error {
618 c.openFilesMu.Lock()
618 c.openFilesMu.Lock()
619 c.openFiles[uri] = &OpenFileInfo{
619 c.openFiles[uri] = &OpenFileInfo{
620 Version: 1,
620 Version: 1,
621− URI: protocol.DocumentUri(uri),
621+ URI: protocol.DocumentURI(uri),
622 }
622 }
623 c.openFilesMu.Unlock()
623 c.openFilesMu.Unlock()
624
624
@@ -648,7 +648,7 @@ func (c *Client) NotifyChange(ctx context.Context, filepath string) error {
648 params := protocol.DidChangeTextDocumentParams{
648 params := protocol.DidChangeTextDocumentParams{
649 TextDocument: protocol.VersionedTextDocumentIdentifier{
649 TextDocument: protocol.VersionedTextDocumentIdentifier{
650 TextDocumentIdentifier: protocol.TextDocumentIdentifier{
650 TextDocumentIdentifier: protocol.TextDocumentIdentifier{
651− URI: protocol.DocumentUri(uri),
651+ URI: protocol.DocumentURI(uri),
652 },
652 },
653 Version: version,
653 Version: version,
654 },
654 },
@@ -677,7 +677,7 @@ func (c *Client) CloseFile(ctx context.Context, filepath string) error {
677
677
678 params := protocol.DidCloseTextDocumentParams{
678 params := protocol.DidCloseTextDocumentParams{
679 TextDocument: protocol.TextDocumentIdentifier{
679 TextDocument: protocol.TextDocumentIdentifier{
680− URI: protocol.DocumentUri(uri),
680+ URI: protocol.DocumentURI(uri),
681 },
681 },
682 }
682 }
683
683
@@ -712,7 +712,7 @@ func (c *Client) CloseAllFiles(ctx context.Context) {
712 // First collect all URIs that need to be closed
712 // First collect all URIs that need to be closed
713 for uri := range c.openFiles {
713 for uri := range c.openFiles {
714 // Convert URI back to file path using proper URI handling
714 // Convert URI back to file path using proper URI handling
715− filePath := protocol.DocumentUri(uri).Path()
715+ filePath := protocol.DocumentURI(uri).Path()
716 filesToClose = append(filesToClose, filePath)
716 filesToClose = append(filesToClose, filePath)
717 }
717 }
718 c.openFilesMu.Unlock()
718 c.openFilesMu.Unlock()
@@ -730,7 +730,7 @@ func (c *Client) CloseAllFiles(ctx context.Context) {
730 }
730 }
731}
731}
732
732
733−func (c *Client) GetFileDiagnostics(uri protocol.DocumentUri) []protocol.Diagnostic {
733+func (c *Client) GetFileDiagnostics(uri protocol.DocumentURI) []protocol.Diagnostic {
734 c.diagnosticsMu.RLock()
734 c.diagnosticsMu.RLock()
735 defer c.diagnosticsMu.RUnlock()
735 defer c.diagnosticsMu.RUnlock()
736
736
@@ -738,7 +738,7 @@ func (c *Client) GetFileDiagnostics(uri protocol.DocumentUri) []protocol.Diagnos
738}
738}
739
739
740// GetDiagnostics returns all diagnostics for all files
740// GetDiagnostics returns all diagnostics for all files
741−func (c *Client) GetDiagnostics() map[protocol.DocumentUri][]protocol.Diagnostic {
741+func (c *Client) GetDiagnostics() map[protocol.DocumentURI][]protocol.Diagnostic {
742 return c.diagnostics
742 return c.diagnostics
743}
743}
744
744
@@ -757,7 +757,7 @@ func (c *Client) OpenFileOnDemand(ctx context.Context, filepath string) error {
757// GetDiagnosticsForFile ensures a file is open and returns its diagnostics
757// GetDiagnosticsForFile ensures a file is open and returns its diagnostics
758// This is useful for on-demand diagnostics when using lazy loading
758// This is useful for on-demand diagnostics when using lazy loading
759func (c *Client) GetDiagnosticsForFile(ctx context.Context, filepath string) ([]protocol.Diagnostic, error) {
759func (c *Client) GetDiagnosticsForFile(ctx context.Context, filepath string) ([]protocol.Diagnostic, error) {
760− documentUri := protocol.URIFromPath(filepath)
760+ documentURI := protocol.URIFromPath(filepath)
761
761
762 // Make sure the file is open
762 // Make sure the file is open
763 if !c.IsFileOpen(filepath) {
763 if !c.IsFileOpen(filepath) {
@@ -771,14 +771,14 @@ func (c *Client) GetDiagnosticsForFile(ctx context.Context, filepath string) ([]
771
771
772 // Get diagnostics
772 // Get diagnostics
773 c.diagnosticsMu.RLock()
773 c.diagnosticsMu.RLock()
774− diagnostics := c.diagnostics[documentUri]
774+ diagnostics := c.diagnostics[documentURI]
775 c.diagnosticsMu.RUnlock()
775 c.diagnosticsMu.RUnlock()
776
776
777 return diagnostics, nil
777 return diagnostics, nil
778}
778}
779
779
780// ClearDiagnosticsForURI removes diagnostics for a specific URI from the cache
780// ClearDiagnosticsForURI removes diagnostics for a specific URI from the cache
781−func (c *Client) ClearDiagnosticsForURI(uri protocol.DocumentUri) {
781+func (c *Client) ClearDiagnosticsForURI(uri protocol.DocumentURI) {
782 c.diagnosticsMu.Lock()
782 c.diagnosticsMu.Lock()
783 defer c.diagnosticsMu.Unlock()
783 defer c.diagnosticsMu.Unlock()
784 delete(c.diagnostics, uri)
784 delete(c.diagnostics, uri)
internal/lsp/protocol/interface.go+3−3
@@ -2,7 +2,7 @@ package protocol
2
2
3import "fmt"
3import "fmt"
4
4
5−// TextEditResult is an interface for types that represent workspace symbols
5+// WorkspaceSymbolResult is an interface for types that represent workspace symbols
6type WorkspaceSymbolResult interface {
6type WorkspaceSymbolResult interface {
7 GetName() string
7 GetName() string
8 GetLocation() Location
8 GetLocation() Location
@@ -48,7 +48,7 @@ func (r Or_Result_workspace_symbol) Results() ([]WorkspaceSymbolResult, error) {
48 }
48 }
49}
49}
50
50
51−// TextEditResult is an interface for types that represent document symbols
51+// DocumentSymbolResult is an interface for types that represent document symbols
52type DocumentSymbolResult interface {
52type DocumentSymbolResult interface {
53 GetRange() Range
53 GetRange() Range
54 GetName() string
54 GetName() string
@@ -98,7 +98,7 @@ func (te *TextEdit) GetRange() Range { return te.Range }
98func (te *TextEdit) GetNewText() string { return te.NewText }
98func (te *TextEdit) GetNewText() string { return te.NewText }
99func (te *TextEdit) isTextEdit() {}
99func (te *TextEdit) isTextEdit() {}
100
100
101−// Convert Or_TextDocumentEdit_edits_Elem to TextEdit
101+// AsTextEdit converts Or_TextDocumentEdit_edits_Elem to TextEdit
102func (e Or_TextDocumentEdit_edits_Elem) AsTextEdit() (TextEdit, error) {
102func (e Or_TextDocumentEdit_edits_Elem) AsTextEdit() (TextEdit, error) {
103 if e.Value == nil {
103 if e.Value == nil {
104 return TextEdit{}, fmt.Errorf("nil text edit")
104 return TextEdit{}, fmt.Errorf("nil text edit")
internal/lsp/protocol/pattern_interfaces.go+2−2
@@ -44,8 +44,8 @@ func (g *GlobPattern) AsPattern() (PatternInfo, error) {
44 basePath := ""
44 basePath := ""
45 switch baseURI := v.BaseURI.Value.(type) {
45 switch baseURI := v.BaseURI.Value.(type) {
46 case string:
46 case string:
47− basePath = DocumentUri(baseURI).Path()
47+ basePath = DocumentURI(baseURI).Path()
48− case DocumentUri:
48+ case DocumentURI:
49 basePath = baseURI.Path()
49 basePath = baseURI.Path()
50 default:
50 default:
51 return nil, fmt.Errorf("unknown BaseURI type: %T", v.BaseURI.Value)
51 return nil, fmt.Errorf("unknown BaseURI type: %T", v.BaseURI.Value)
internal/lsp/protocol/tsdocument-changes.go+5−5
@@ -23,18 +23,18 @@ type DocumentChange struct {
23
23
24// Valid reports whether the DocumentChange sum-type value is valid,
24// Valid reports whether the DocumentChange sum-type value is valid,
25// that is, exactly one of create, delete, edit, or rename.
25// that is, exactly one of create, delete, edit, or rename.
26−func (ch DocumentChange) Valid() bool {
26+func (d DocumentChange) Valid() bool {
27 n := 0
27 n := 0
28− if ch.TextDocumentEdit != nil {
28+ if d.TextDocumentEdit != nil {
29 n++
29 n++
30 }
30 }
31− if ch.CreateFile != nil {
31+ if d.CreateFile != nil {
32 n++
32 n++
33 }
33 }
34− if ch.RenameFile != nil {
34+ if d.RenameFile != nil {
35 n++
35 n++
36 }
36 }
37− if ch.DeleteFile != nil {
37+ if d.DeleteFile != nil {
38 n++
38 n++
39 }
39 }
40 return n == 1
40 return n == 1
internal/lsp/protocol/tsprotocol.go+367−322
@@ -133,7 +133,7 @@ type CallHierarchyItem struct {
133 // More detail for this item, e.g. the signature of a function.
133 // More detail for this item, e.g. the signature of a function.
134 Detail string `json:"detail,omitempty"`
134 Detail string `json:"detail,omitempty"`
135 // The resource identifier of this item.
135 // The resource identifier of this item.
136− URI DocumentUri `json:"uri"`
136+ URI DocumentURI `json:"uri"`
137 // The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code.
137 // The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code.
138 Range Range `json:"range"`
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.
139 // The range that should be selected and revealed when this symbol is being picked, e.g. the name of a function.
@@ -225,16 +225,18 @@ type ChangeAnnotation struct {
225// An identifier to refer to a change annotation stored with a workspace edit.
225// An identifier to refer to a change annotation stored with a workspace edit.
226//
226//
227// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#changeAnnotationIdentifier
227// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#changeAnnotationIdentifier
228+type (
228−type ChangeAnnotationIdentifier = string // (alias)
229+ ChangeAnnotationIdentifier = string // (alias)
229−// @since 3.18.0
230+ // @since 3.18.0
230−//
231+ //
231−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#changeAnnotationsSupportOptions
232+ // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#changeAnnotationsSupportOptions
232−type ChangeAnnotationsSupportOptions struct {
233+ ChangeAnnotationsSupportOptions struct {
233− // Whether the client groups edits with equal labels into tree nodes,
234+ // Whether the client groups edits with equal labels into tree nodes,
234− // for instance all edits labelled with "Changes in Strings" would
235+ // for instance all edits labelled with "Changes in Strings" would
235− // be a tree node.
236+ // be a tree node.
236− GroupsOnLabel bool `json:"groupsOnLabel,omitempty"`
237+ GroupsOnLabel bool `json:"groupsOnLabel,omitempty"`
237−}
238+ }
239+)
238
240
239// Defines the capabilities provided by the client.
241// Defines the capabilities provided by the client.
240//
242//
@@ -1249,7 +1251,7 @@ type CreateFile struct {
1249 // A create
1251 // A create
1250 Kind string `json:"kind"`
1252 Kind string `json:"kind"`
1251 // The resource to create.
1253 // The resource to create.
1252− URI DocumentUri `json:"uri"`
1254+ URI DocumentURI `json:"uri"`
1253 // Additional options
1255 // Additional options
1254 Options *CreateFileOptions `json:"options,omitempty"`
1256 Options *CreateFileOptions `json:"options,omitempty"`
1255 ResourceOperation
1257 ResourceOperation
@@ -1279,18 +1281,20 @@ type CreateFilesParams struct {
1279// The declaration of a symbol representation as one or many {@link Location locations}.
1281// The declaration of a symbol representation as one or many {@link Location locations}.
1280//
1282//
1281// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#declaration
1283// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#declaration
1284+type (
1282−type Declaration = Or_Declaration // (alias)
1285+ Declaration = Or_Declaration // (alias)
1283−// @since 3.14.0
1286+ // @since 3.14.0
1284−//
1287+ //
1285−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#declarationClientCapabilities
1288+ // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#declarationClientCapabilities
1286−type DeclarationClientCapabilities struct {
1289+ DeclarationClientCapabilities struct {
1287− // Whether declaration supports dynamic registration. If this is set to `true`
1290+ // Whether declaration supports dynamic registration. If this is set to `true`
1288− // the client supports the new `DeclarationRegistrationOptions` return value
1291+ // the client supports the new `DeclarationRegistrationOptions` return value
1289− // for the corresponding server capability as well.
1292+ // for the corresponding server capability as well.
1290− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
1293+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
1291− // The client supports additional metadata in the form of declaration links.
1294+ // The client supports additional metadata in the form of declaration links.
1292− LinkSupport bool `json:"linkSupport,omitempty"`
1295+ LinkSupport bool `json:"linkSupport,omitempty"`
1293−}
1296+ }
1297+)
1294
1298
1295// Information about where a symbol is declared.
1299// Information about where a symbol is declared.
1296//
1300//
@@ -1301,11 +1305,13 @@ type DeclarationClientCapabilities struct {
1301// by the client.
1305// by the client.
1302//
1306//
1303// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#declarationLink
1307// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#declarationLink
1308+type (
1304−type DeclarationLink = LocationLink // (alias)
1309+ DeclarationLink = LocationLink // (alias)
1305−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#declarationOptions
1310+ // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#declarationOptions
1306−type DeclarationOptions struct {
1311+ DeclarationOptions struct {
1307− WorkDoneProgressOptions
1312+ WorkDoneProgressOptions
1308−}
1313+ }
1314+)
1309
1315
1310// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#declarationParams
1316// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#declarationParams
1311type DeclarationParams struct {
1317type DeclarationParams struct {
@@ -1329,18 +1335,20 @@ type DeclarationRegistrationOptions struct {
1329// by the client.
1335// by the client.
1330//
1336//
1331// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#definition
1337// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#definition
1338+type (
1332−type Definition = Or_Definition // (alias)
1339+ Definition = Or_Definition // (alias)
1333−// Client Capabilities for a {@link DefinitionRequest}.
1340+ // Client Capabilities for a {@link DefinitionRequest}.
1334−//
1341+ //
1335−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#definitionClientCapabilities
1342+ // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#definitionClientCapabilities
1336−type DefinitionClientCapabilities struct {
1343+ DefinitionClientCapabilities struct {
1337− // Whether definition supports dynamic registration.
1344+ // Whether definition supports dynamic registration.
1338− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
1345+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
1339− // The client supports additional metadata in the form of definition links.
1346+ // The client supports additional metadata in the form of definition links.
1340− //
1347+ //
1341− // @since 3.14.0
1348+ // @since 3.14.0
1342− LinkSupport bool `json:"linkSupport,omitempty"`
1349+ LinkSupport bool `json:"linkSupport,omitempty"`
1343−}
1350+ }
1351+)
1344
1352
1345// Information about where a symbol is defined.
1353// Information about where a symbol is defined.
1346//
1354//
@@ -1348,13 +1356,15 @@ type DefinitionClientCapabilities struct {
1348// the defining symbol
1356// the defining symbol
1349//
1357//
1350// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#definitionLink
1358// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#definitionLink
1359+type (
1351−type DefinitionLink = LocationLink // (alias)
1360+ DefinitionLink = LocationLink // (alias)
1352−// Server Capabilities for a {@link DefinitionRequest}.
1361+ // Server Capabilities for a {@link DefinitionRequest}.
1353−//
1362+ //
1354−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#definitionOptions
1363+ // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#definitionOptions
1355−type DefinitionOptions struct {
1364+ DefinitionOptions struct {
1356− WorkDoneProgressOptions
1365+ WorkDoneProgressOptions
1357−}
1366+ }
1367+)
1358
1368
1359// Parameters for a {@link DefinitionRequest}.
1369// Parameters for a {@link DefinitionRequest}.
1360//
1370//
@@ -1380,7 +1390,7 @@ type DeleteFile struct {
1380 // A delete
1390 // A delete
1381 Kind string `json:"kind"`
1391 Kind string `json:"kind"`
1382 // The file to delete.
1392 // The file to delete.
1383− URI DocumentUri `json:"uri"`
1393+ URI DocumentURI `json:"uri"`
1384 // Delete options.
1394 // Delete options.
1385 Options *DeleteFileOptions `json:"options,omitempty"`
1395 Options *DeleteFileOptions `json:"options,omitempty"`
1386 ResourceOperation
1396 ResourceOperation
@@ -1783,11 +1793,13 @@ type DocumentDiagnosticParams struct {
1783// @since 3.17.0
1793// @since 3.17.0
1784//
1794//
1785// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentDiagnosticReport
1795// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentDiagnosticReport
1796+type (
1786−type DocumentDiagnosticReport = Or_DocumentDiagnosticReport // (alias)
1797+ DocumentDiagnosticReport = Or_DocumentDiagnosticReport // (alias)
1787−// The document diagnostic report kinds.
1798+ // The document diagnostic report kinds.
1788−//
1799+ //
1789−// @since 3.17.0
1800+ // @since 3.17.0
1790−type DocumentDiagnosticReportKind string
1801+ DocumentDiagnosticReportKind string
1802+)
1791
1803
1792// A partial result for a document diagnostic report.
1804// A partial result for a document diagnostic report.
1793//
1805//
@@ -1795,7 +1807,7 @@ type DocumentDiagnosticReportKind string
1795//
1807//
1796// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentDiagnosticReportPartialResult
1808// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentDiagnosticReportPartialResult
1797type DocumentDiagnosticReportPartialResult struct {
1809type DocumentDiagnosticReportPartialResult struct {
1798− RelatedDocuments map[DocumentUri]interface{} `json:"relatedDocuments"`
1810+ RelatedDocuments map[DocumentURI]interface{} `json:"relatedDocuments"`
1799}
1811}
1800
1812
1801// A document filter describes a top level text document or
1813// A document filter describes a top level text document or
@@ -1804,14 +1816,16 @@ type DocumentDiagnosticReportPartialResult struct {
1804// @since 3.17.0 - proposed support for NotebookCellTextDocumentFilter.
1816// @since 3.17.0 - proposed support for NotebookCellTextDocumentFilter.
1805//
1817//
1806// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentFilter
1818// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentFilter
1819+type (
1807−type DocumentFilter = Or_DocumentFilter // (alias)
1820+ DocumentFilter = Or_DocumentFilter // (alias)
1808−// Client capabilities of a {@link DocumentFormattingRequest}.
1821+ // Client capabilities of a {@link DocumentFormattingRequest}.
1809−//
1822+ //
1810−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentFormattingClientCapabilities
1823+ // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentFormattingClientCapabilities
1811−type DocumentFormattingClientCapabilities struct {
1824+ DocumentFormattingClientCapabilities struct {
1812− // Whether formatting supports dynamic registration.
1825+ // Whether formatting supports dynamic registration.
1813− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
1826+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
1814−}
1827+ }
1828+)
1815
1829
1816// Provider options for a {@link DocumentFormattingRequest}.
1830// Provider options for a {@link DocumentFormattingRequest}.
1817//
1831//
@@ -2061,39 +2075,41 @@ type DocumentRangesFormattingParams struct {
2061// The use of a string as a document filter is deprecated @since 3.16.0.
2075// The use of a string as a document filter is deprecated @since 3.16.0.
2062//
2076//
2063// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentSelector
2077// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentSelector
2078+type (
2064−type DocumentSelector = []DocumentFilter // (alias)
2079+ DocumentSelector = []DocumentFilter // (alias)
2065−// Represents programming constructs like variables, classes, interfaces etc.
2080+ // Represents programming constructs like variables, classes, interfaces etc.
2066−// that appear in a document. Document symbols can be hierarchical and they
2081+ // that appear in a document. Document symbols can be hierarchical and they
2067−// have two ranges: one that encloses its definition and one that points to
2082+ // have two ranges: one that encloses its definition and one that points to
2068−// its most interesting range, e.g. the range of an identifier.
2083+ // its most interesting range, e.g. the range of an identifier.
2069−//
2084+ //
2070−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentSymbol
2085+ // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentSymbol
2071−type DocumentSymbol struct {
2086+ DocumentSymbol struct {
2072− // The name of this symbol. Will be displayed in the user interface and therefore must not be
2087+ // The name of this symbol. Will be displayed in the user interface and therefore must not be
2073− // an empty string or a string only consisting of white spaces.
2088+ // an empty string or a string only consisting of white spaces.
2074− Name string `json:"name"`
2089+ Name string `json:"name"`
2075− // More detail for this symbol, e.g the signature of a function.
2090+ // More detail for this symbol, e.g the signature of a function.
2076− Detail string `json:"detail,omitempty"`
2091+ Detail string `json:"detail,omitempty"`
2077− // The kind of this symbol.
2092+ // The kind of this symbol.
2078− Kind SymbolKind `json:"kind"`
2093+ Kind SymbolKind `json:"kind"`
2079− // Tags for this document symbol.
2094+ // Tags for this document symbol.
2080− //
2095+ //
2081− // @since 3.16.0
2096+ // @since 3.16.0
2082− Tags []SymbolTag `json:"tags,omitempty"`
2097+ Tags []SymbolTag `json:"tags,omitempty"`
2083− // Indicates if this symbol is deprecated.
2098+ // Indicates if this symbol is deprecated.
2084− //
2099+ //
2085− // @deprecated Use tags instead
2100+ // @deprecated Use tags instead
2086− Deprecated bool `json:"deprecated,omitempty"`
2101+ Deprecated bool `json:"deprecated,omitempty"`
2087− // The range enclosing this symbol not including leading/trailing whitespace but everything else
2102+ // The range enclosing this symbol not including leading/trailing whitespace but everything else
2088− // like comments. This information is typically used to determine if the clients cursor is
2103+ // like comments. This information is typically used to determine if the clients cursor is
2089− // inside the symbol to reveal in the symbol in the UI.
2104+ // inside the symbol to reveal in the symbol in the UI.
2090− Range Range `json:"range"`
2105+ Range Range `json:"range"`
2091− // The range that should be selected and revealed when this symbol is being picked, e.g the name of a function.
2106+ // The range that should be selected and revealed when this symbol is being picked, e.g the name of a function.
2092− // Must be contained by the `range`.
2107+ // Must be contained by the `range`.
2093− SelectionRange Range `json:"selectionRange"`
2108+ SelectionRange Range `json:"selectionRange"`
2094− // Children of this symbol, e.g. properties of a class.
2109+ // Children of this symbol, e.g. properties of a class.
2095− Children []DocumentSymbol `json:"children,omitempty"`
2110+ Children []DocumentSymbol `json:"children,omitempty"`
2096−}
2111+ }
2112+)
2097
2113
2098// Client Capabilities for a {@link DocumentSymbolRequest}.
2114// Client Capabilities for a {@link DocumentSymbolRequest}.
2099//
2115//
@@ -2237,7 +2253,7 @@ type FileDelete struct {
2237// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileEvent
2253// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileEvent
2238type FileEvent struct {
2254type FileEvent struct {
2239 // The file's uri.
2255 // The file's uri.
2240− URI DocumentUri `json:"uri"`
2256+ URI DocumentURI `json:"uri"`
2241 // The change type.
2257 // The change type.
2242 Type FileChangeType `json:"type"`
2258 Type FileChangeType `json:"type"`
2243}
2259}
@@ -2556,17 +2572,19 @@ type GeneralClientCapabilities struct {
2556// @since 3.17.0
2572// @since 3.17.0
2557//
2573//
2558// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#globPattern
2574// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#globPattern
2575+type (
2559−type GlobPattern = Or_GlobPattern // (alias)
2576+ GlobPattern = Or_GlobPattern // (alias)
2560−// The result of a hover request.
2577+ // The result of a hover request.
2561−//
2578+ //
2562−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#hover
2579+ // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#hover
2563−type Hover struct {
2580+ Hover struct {
2564− // The hover's content
2581+ // The hover's content
2565− Contents MarkupContent `json:"contents"`
2582+ Contents MarkupContent `json:"contents"`
2566− // An optional range inside the text document that is used to
2583+ // An optional range inside the text document that is used to
2567− // visualize the hover, e.g. by changing the background color.
2584+ // visualize the hover, e.g. by changing the background color.
2568− Range Range `json:"range,omitempty"`
2585+ Range Range `json:"range,omitempty"`
2569−}
2586+ }
2587+)
2570
2588
2571// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#hoverClientCapabilities
2589// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#hoverClientCapabilities
2572type HoverClientCapabilities struct {
2590type HoverClientCapabilities struct {
@@ -2664,8 +2682,7 @@ type InitializeResult struct {
2664}
2682}
2665
2683
2666// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#initializedParams
2684// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#initializedParams
2667−type InitializedParams struct {
2685+type InitializedParams struct{}
2668−}
2669
2686
2670// Inlay hint information.
2687// Inlay hint information.
2671//
2688//
@@ -2918,16 +2935,18 @@ type InlineCompletionTriggerKind uint32
2918// @since 3.17.0
2935// @since 3.17.0
2919//
2936//
2920// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValue
2937// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValue
2938+type (
2921−type InlineValue = Or_InlineValue // (alias)
2939+ InlineValue = Or_InlineValue // (alias)
2922−// Client capabilities specific to inline values.
2940+ // Client capabilities specific to inline values.
2923−//
2941+ //
2924−// @since 3.17.0
2942+ // @since 3.17.0
2925−//
2943+ //
2926−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValueClientCapabilities
2944+ // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValueClientCapabilities
2927−type InlineValueClientCapabilities struct {
2945+ InlineValueClientCapabilities struct {
2928− // Whether implementation supports dynamic registration for inline value providers.
2946+ // Whether implementation supports dynamic registration for inline value providers.
2929− DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
2947+ DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
2930−}
2948+ }
2949+)
2931
2950
2932// @since 3.17.0
2951// @since 3.17.0
2933//
2952//
@@ -3058,25 +3077,31 @@ type InsertTextFormat uint32
3058// item insertion.
3077// item insertion.
3059//
3078//
3060// @since 3.16.0
3079// @since 3.16.0
3080+type (
3061−type InsertTextMode uint32
3081+ InsertTextMode uint32
3062−type LSPAny = interface{}
3082+ LSPAny = interface{}
3083+)
3063
3084
3064// LSP arrays.
3085// LSP arrays.
3065// @since 3.17.0
3086// @since 3.17.0
3066//
3087//
3067// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#lSPArray
3088// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#lSPArray
3089+type (
3068−type LSPArray = []interface{} // (alias)
3090+ LSPArray = []interface{} // (alias)
3069−type LSPErrorCodes int32
3091+ LSPErrorCodes int32
3092+)
3070
3093
3071// LSP object definition.
3094// LSP object definition.
3072// @since 3.17.0
3095// @since 3.17.0
3073//
3096//
3074// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#lSPObject
3097// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#lSPObject
3098+type (
3075−type LSPObject = map[string]LSPAny // (alias)
3099+ LSPObject = map[string]LSPAny // (alias)
3076−// Predefined Language kinds
3100+ // Predefined Language kinds
3077−// @since 3.18.0
3101+ // @since 3.18.0
3078−// @proposed
3102+ // @proposed
3079−type LanguageKind string
3103+ LanguageKind string
3104+)
3080
3105
3081// Client capabilities for the linked editing range request.
3106// Client capabilities for the linked editing range request.
3082//
3107//
@@ -3124,19 +3149,17 @@ type LinkedEditingRanges struct {
3124}
3149}
3125
3150
3126// created for Literal (Lit_ClientSemanticTokensRequestOptions_range_Item1)
3151// created for Literal (Lit_ClientSemanticTokensRequestOptions_range_Item1)
3127−type Lit_ClientSemanticTokensRequestOptions_range_Item1 struct {
3152+type Lit_ClientSemanticTokensRequestOptions_range_Item1 struct{}
3128−}
3129
3153
3130// created for Literal (Lit_SemanticTokensOptions_range_Item1)
3154// created for Literal (Lit_SemanticTokensOptions_range_Item1)
3131−type Lit_SemanticTokensOptions_range_Item1 struct {
3155+type Lit_SemanticTokensOptions_range_Item1 struct{}
3132−}
3133
3156
3134// Represents a location inside a resource, such as a line
3157// Represents a location inside a resource, such as a line
3135// inside a text file.
3158// inside a text file.
3136//
3159//
3137// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#location
3160// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#location
3138type Location struct {
3161type Location struct {
3139− URI DocumentUri `json:"uri"`
3162+ URI DocumentURI `json:"uri"`
3140 Range Range `json:"range"`
3163 Range Range `json:"range"`
3141}
3164}
3142
3165
@@ -3151,7 +3174,7 @@ type LocationLink struct {
3151 // the definition position.
3174 // the definition position.
3152 OriginSelectionRange *Range `json:"originSelectionRange,omitempty"`
3175 OriginSelectionRange *Range `json:"originSelectionRange,omitempty"`
3153 // The target resource identifier of this link.
3176 // The target resource identifier of this link.
3154− TargetURI DocumentUri `json:"targetUri"`
3177+ TargetURI DocumentURI `json:"targetUri"`
3155 // The full target range of this link. If the target for example is a symbol then target range is the
3178 // The full target range of this link. If the target for example is a symbol then target range is the
3156 // range enclosing this symbol not including leading/trailing whitespace but everything else
3179 // range enclosing this symbol not including leading/trailing whitespace but everything else
3157 // like comments. This information is typically used to highlight the range in the editor.
3180 // like comments. This information is typically used to highlight the range in the editor.
@@ -3167,7 +3190,7 @@ type LocationLink struct {
3167//
3190//
3168// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#locationUriOnly
3191// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#locationUriOnly
3169type LocationUriOnly struct {
3192type LocationUriOnly struct {
3170− URI DocumentUri `json:"uri"`
3193+ URI DocumentURI `json:"uri"`
3171}
3194}
3172
3195
3173// The log message parameters.
3196// The log message parameters.
@@ -3217,15 +3240,17 @@ type MarkdownClientCapabilities struct {
3217// @deprecated use MarkupContent instead.
3240// @deprecated use MarkupContent instead.
3218//
3241//
3219// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#markedString
3242// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#markedString
3243+type (
3220−type MarkedString = Or_MarkedString // (alias)
3244+ MarkedString = Or_MarkedString // (alias)
3221−// @since 3.18.0
3245+ // @since 3.18.0
3222−// @deprecated use MarkupContent instead.
3246+ // @deprecated use MarkupContent instead.
3223−//
3247+ //
3224−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#markedStringWithLanguage
3248+ // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#markedStringWithLanguage
3225−type MarkedStringWithLanguage struct {
3249+ MarkedStringWithLanguage struct {
3226− Language string `json:"language"`
3250+ Language string `json:"language"`
3227− Value string `json:"value"`
3251+ Value string `json:"value"`
3228−}
3252+ }
3253+)
3229
3254
3230// A `MarkupContent` literal represents a string value which content is interpreted base on its
3255// A `MarkupContent` literal represents a string value which content is interpreted base on its
3231// kind flag. Currently the protocol supports `plaintext` and `markdown` as markup kinds.
3256// kind flag. Currently the protocol supports `plaintext` and `markdown` as markup kinds.
@@ -3342,7 +3367,7 @@ type NotebookCell struct {
3342 Kind NotebookCellKind `json:"kind"`
3367 Kind NotebookCellKind `json:"kind"`
3343 // The URI of the cell's text document
3368 // The URI of the cell's text document
3344 // content.
3369 // content.
3345− Document DocumentUri `json:"document"`
3370+ Document DocumentURI `json:"document"`
3346 // Additional metadata stored with the cell.
3371 // Additional metadata stored with the cell.
3347 //
3372 //
3348 // Note: should always be an object literal (e.g. LSPObject)
3373 // Note: should always be an object literal (e.g. LSPObject)
@@ -3493,20 +3518,22 @@ type NotebookDocumentClientCapabilities struct {
3493// @since 3.17.0
3518// @since 3.17.0
3494//
3519//
3495// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentFilter
3520// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentFilter
3521+type (
3496−type NotebookDocumentFilter = Or_NotebookDocumentFilter // (alias)
3522+ NotebookDocumentFilter = Or_NotebookDocumentFilter // (alias)
3497−// A notebook document filter where `notebookType` is required field.
3523+ // A notebook document filter where `notebookType` is required field.
3498−//
3524+ //
3499−// @since 3.18.0
3525+ // @since 3.18.0
3500−//
3526+ //
3501−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentFilterNotebookType
3527+ // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentFilterNotebookType
3502−type NotebookDocumentFilterNotebookType struct {
3528+ NotebookDocumentFilterNotebookType struct {
3503− // The type of the enclosing notebook.
3529+ // The type of the enclosing notebook.
3504− NotebookType string `json:"notebookType"`
3530+ NotebookType string `json:"notebookType"`
3505− // A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
3531+ // A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
3506− Scheme string `json:"scheme,omitempty"`
3532+ Scheme string `json:"scheme,omitempty"`
3507− // A glob pattern.
3533+ // A glob pattern.
3508− Pattern *GlobPattern `json:"pattern,omitempty"`
3534+ Pattern *GlobPattern `json:"pattern,omitempty"`
3509−}
3535+ }
3536+)
3510
3537
3511// A notebook document filter where `pattern` is required field.
3538// A notebook document filter where `pattern` is required field.
3512//
3539//
@@ -4101,51 +4128,53 @@ type PartialResultParams struct {
4101// @since 3.17.0
4128// @since 3.17.0
4102//
4129//
4103// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#pattern
4130// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#pattern
4131+type (
4104−type Pattern = string // (alias)
4132+ Pattern = string // (alias)
4105−// Position in a text document expressed as zero-based line and character
4133+ // Position in a text document expressed as zero-based line and character
4106−// offset. Prior to 3.17 the offsets were always based on a UTF-16 string
4134+ // offset. Prior to 3.17 the offsets were always based on a UTF-16 string
4107−// representation. So a string of the form `a𐐀b` the character offset of the
4135+ // representation. So a string of the form `a𐐀b` the character offset of the
4108−// character `a` is 0, the character offset of `𐐀` is 1 and the character
4136+ // character `a` is 0, the character offset of `𐐀` is 1 and the character
4109−// offset of b is 3 since `𐐀` is represented using two code units in UTF-16.
4137+ // offset of b is 3 since `𐐀` is represented using two code units in UTF-16.
4110−// Since 3.17 clients and servers can agree on a different string encoding
4138+ // Since 3.17 clients and servers can agree on a different string encoding
4111−// representation (e.g. UTF-8). The client announces it's supported encoding
4139+ // representation (e.g. UTF-8). The client announces it's supported encoding
4112−// via the client capability [`general.positionEncodings`](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#clientCapabilities).
4140+ // via the client capability [`general.positionEncodings`](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#clientCapabilities).
4113−// The value is an array of position encodings the client supports, with
4141+ // The value is an array of position encodings the client supports, with
4114−// decreasing preference (e.g. the encoding at index `0` is the most preferred
4142+ // decreasing preference (e.g. the encoding at index `0` is the most preferred
4115−// one). To stay backwards compatible the only mandatory encoding is UTF-16
4143+ // one). To stay backwards compatible the only mandatory encoding is UTF-16
4116−// represented via the string `utf-16`. The server can pick one of the
4144+ // represented via the string `utf-16`. The server can pick one of the
4117−// encodings offered by the client and signals that encoding back to the
4145+ // encodings offered by the client and signals that encoding back to the
4118−// client via the initialize result's property
4146+ // client via the initialize result's property
4119−// [`capabilities.positionEncoding`](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#serverCapabilities). If the string value
4147+ // [`capabilities.positionEncoding`](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#serverCapabilities). If the string value
4120−// `utf-16` is missing from the client's capability `general.positionEncodings`
4148+ // `utf-16` is missing from the client's capability `general.positionEncodings`
4121−// servers can safely assume that the client supports UTF-16. If the server
4149+ // servers can safely assume that the client supports UTF-16. If the server
4122−// omits the position encoding in its initialize result the encoding defaults
4150+ // omits the position encoding in its initialize result the encoding defaults
4123−// to the string value `utf-16`. Implementation considerations: since the
4151+ // to the string value `utf-16`. Implementation considerations: since the
4124−// conversion from one encoding into another requires the content of the
4152+ // conversion from one encoding into another requires the content of the
4125−// file / line the conversion is best done where the file is read which is
4153+ // file / line the conversion is best done where the file is read which is
4126−// usually on the server side.
4154+ // usually on the server side.
4127−//
4155+ //
4128−// Positions are line end character agnostic. So you can not specify a position
4156+ // Positions are line end character agnostic. So you can not specify a position
4129−// that denotes `\r|\n` or `\n|` where `|` represents the character offset.
4157+ // that denotes `\r|\n` or `\n|` where `|` represents the character offset.
4130−//
4158+ //
4131−// @since 3.17.0 - support for negotiated position encoding.
4159+ // @since 3.17.0 - support for negotiated position encoding.
4132−//
4160+ //
4133−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#position
4161+ // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#position
4134−type Position struct {
4162+ Position struct {
4135− // Line position in a document (zero-based).
4163+ // Line position in a document (zero-based).
4136− //
4164+ //
4137− // If a line number is greater than the number of lines in a document, it defaults back to the number of lines in the document.
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.
4138− // If a line number is negative, it defaults to 0.
4166+ // If a line number is negative, it defaults to 0.
4139− Line uint32 `json:"line"`
4167+ Line uint32 `json:"line"`
4140− // Character offset on a line in a document (zero-based).
4168+ // Character offset on a line in a document (zero-based).
4141− //
4169+ //
4142− // The meaning of this offset is determined by the negotiated
4170+ // The meaning of this offset is determined by the negotiated
4143− // `PositionEncodingKind`.
4171+ // `PositionEncodingKind`.
4144− //
4172+ //
4145− // If the character value is greater than the line length it defaults back to the
4173+ // If the character value is greater than the line length it defaults back to the
4146− // line length.
4174+ // line length.
4147− Character uint32 `json:"character"`
4175+ Character uint32 `json:"character"`
4148−}
4176+ }
4177+)
4149
4178
4150// A set of predefined position encoding kinds.
4179// A set of predefined position encoding kinds.
4151//
4180//
@@ -4174,8 +4203,10 @@ type PrepareRenamePlaceholder struct {
4174}
4203}
4175
4204
4176// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#prepareRenameResult
4205// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#prepareRenameResult
4206+type (
4177−type PrepareRenameResult = Or_PrepareRenameResult // (alias)
4207+ PrepareRenameResult = Or_PrepareRenameResult // (alias)
4178−type PrepareSupportDefaultBehavior uint32
4208+ PrepareSupportDefaultBehavior uint32
4209+)
4179
4210
4180// A previous result id in a workspace pull request.
4211// A previous result id in a workspace pull request.
4181//
4212//
@@ -4185,7 +4216,7 @@ type PrepareSupportDefaultBehavior uint32
4185type PreviousResultID struct {
4216type PreviousResultID struct {
4186 // The URI for which the client knowns a
4217 // The URI for which the client knowns a
4187 // result id.
4218 // result id.
4188− URI DocumentUri `json:"uri"`
4219+ URI DocumentURI `json:"uri"`
4189 // The value of the previous result id.
4220 // The value of the previous result id.
4190 Value string `json:"value"`
4221 Value string `json:"value"`
4191}
4222}
@@ -4198,7 +4229,7 @@ type PreviousResultID struct {
4198type PreviousResultId struct {
4229type PreviousResultId struct {
4199 // The URI for which the client knowns a
4230 // The URI for which the client knowns a
4200 // result id.
4231 // result id.
4201− URI DocumentUri `json:"uri"`
4232+ URI DocumentURI `json:"uri"`
4202 // The value of the previous result id.
4233 // The value of the previous result id.
4203 Value string `json:"value"`
4234 Value string `json:"value"`
4204}
4235}
@@ -4212,25 +4243,27 @@ type ProgressParams struct {
4212}
4243}
4213
4244
4214// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#progressToken
4245// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#progressToken
4246+type (
4215−type ProgressToken = Or_ProgressToken // (alias)
4247+ ProgressToken = Or_ProgressToken // (alias)
4216−// The publish diagnostic client capabilities.
4248+ // The publish diagnostic client capabilities.
4217−//
4249+ //
4218−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#publishDiagnosticsClientCapabilities
4250+ // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#publishDiagnosticsClientCapabilities
4219−type PublishDiagnosticsClientCapabilities struct {
4251+ PublishDiagnosticsClientCapabilities struct {
4220− // Whether the client interprets the version property of the
4252+ // Whether the client interprets the version property of the
4221− // `textDocument/publishDiagnostics` notification's parameter.
4253+ // `textDocument/publishDiagnostics` notification's parameter.
4222− //
4254+ //
4223− // @since 3.15.0
4255+ // @since 3.15.0
4224− VersionSupport bool `json:"versionSupport,omitempty"`
4256+ VersionSupport bool `json:"versionSupport,omitempty"`
4225− DiagnosticsCapabilities
4257+ DiagnosticsCapabilities
4226−}
4258+ }
4259+)
4227
4260
4228// The publish diagnostic notification's parameters.
4261// The publish diagnostic notification's parameters.
4229//
4262//
4230// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#publishDiagnosticsParams
4263// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#publishDiagnosticsParams
4231type PublishDiagnosticsParams struct {
4264type PublishDiagnosticsParams struct {
4232 // The URI for which diagnostic information is reported.
4265 // The URI for which diagnostic information is reported.
4233− URI DocumentUri `json:"uri"`
4266+ URI DocumentURI `json:"uri"`
4234 // Optional the version number of the document the diagnostics are published for.
4267 // Optional the version number of the document the diagnostics are published for.
4235 //
4268 //
4236 // @since 3.15.0
4269 // @since 3.15.0
@@ -4322,18 +4355,20 @@ type RegistrationParams struct {
4322}
4355}
4323
4356
4324// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#regularExpressionEngineKind
4357// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#regularExpressionEngineKind
4358+type (
4325−type RegularExpressionEngineKind = string // (alias)
4359+ RegularExpressionEngineKind = string // (alias)
4326−// Client capabilities specific to regular expressions.
4360+ // Client capabilities specific to regular expressions.
4327−//
4361+ //
4328−// @since 3.16.0
4362+ // @since 3.16.0
4329−//
4363+ //
4330−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#regularExpressionsClientCapabilities
4364+ // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#regularExpressionsClientCapabilities
4331−type RegularExpressionsClientCapabilities struct {
4365+ RegularExpressionsClientCapabilities struct {
4332− // The engine's name.
4366+ // The engine's name.
4333− Engine RegularExpressionEngineKind `json:"engine"`
4367+ Engine RegularExpressionEngineKind `json:"engine"`
4334− // The engine's version.
4368+ // The engine's version.
4335− Version string `json:"version,omitempty"`
4369+ Version string `json:"version,omitempty"`
4336−}
4370+ }
4371+)
4337
4372
4338// A full diagnostic report with a set of related documents.
4373// A full diagnostic report with a set of related documents.
4339//
4374//
@@ -4348,7 +4383,7 @@ type RelatedFullDocumentDiagnosticReport struct {
4348 // a.cpp and result in errors in a header file b.hpp.
4383 // a.cpp and result in errors in a header file b.hpp.
4349 //
4384 //
4350 // @since 3.17.0
4385 // @since 3.17.0
4351− RelatedDocuments map[DocumentUri]interface{} `json:"relatedDocuments,omitempty"`
4386+ RelatedDocuments map[DocumentURI]interface{} `json:"relatedDocuments,omitempty"`
4352 FullDocumentDiagnosticReport
4387 FullDocumentDiagnosticReport
4353}
4388}
4354
4389
@@ -4365,7 +4400,7 @@ type RelatedUnchangedDocumentDiagnosticReport struct {
4365 // a.cpp and result in errors in a header file b.hpp.
4400 // a.cpp and result in errors in a header file b.hpp.
4366 //
4401 //
4367 // @since 3.17.0
4402 // @since 3.17.0
4368− RelatedDocuments map[DocumentUri]interface{} `json:"relatedDocuments,omitempty"`
4403+ RelatedDocuments map[DocumentURI]interface{} `json:"relatedDocuments,omitempty"`
4369 UnchangedDocumentDiagnosticReport
4404 UnchangedDocumentDiagnosticReport
4370}
4405}
4371
4406
@@ -4417,9 +4452,9 @@ type RenameFile struct {
4417 // A rename
4452 // A rename
4418 Kind string `json:"kind"`
4453 Kind string `json:"kind"`
4419 // The old (existing) location.
4454 // The old (existing) location.
4420− OldURI DocumentUri `json:"oldUri"`
4455+ OldURI DocumentURI `json:"oldUri"`
4421 // The new location.
4456 // The new location.
4422− NewURI DocumentUri `json:"newUri"`
4457+ NewURI DocumentURI `json:"newUri"`
4423 // Rename options.
4458 // Rename options.
4424 Options *RenameFileOptions `json:"options,omitempty"`
4459 Options *RenameFileOptions `json:"options,omitempty"`
4425 ResourceOperation
4460 ResourceOperation
@@ -5337,20 +5372,22 @@ type TextDocumentClientCapabilities struct {
5337// it is considered to be the full content of the document.
5372// it is considered to be the full content of the document.
5338//
5373//
5339// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentContentChangeEvent
5374// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentContentChangeEvent
5375+type (
5340−type TextDocumentContentChangeEvent = Or_TextDocumentContentChangeEvent // (alias)
5376+ TextDocumentContentChangeEvent = Or_TextDocumentContentChangeEvent // (alias)
5341−// @since 3.18.0
5377+ // @since 3.18.0
5342−//
5343−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentContentChangePartial
5344−type TextDocumentContentChangePartial struct {
5345− // The range of the document that changed.
5346− Range *Range `json:"range,omitempty"`
5347− // The optional length of the range that got replaced.
5348 //
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+ //
5349− // @deprecated use range instead.
5385+ // @deprecated use range instead.
5350− RangeLength uint32 `json:"rangeLength,omitempty"`
5386+ RangeLength uint32 `json:"rangeLength,omitempty"`
5351− // The new text for the provided range.
5387+ // The new text for the provided range.
5352− Text string `json:"text"`
5388+ Text string `json:"text"`
5353−}
5389+ }
5390+)
5354
5391
5355// @since 3.18.0
5392// @since 3.18.0
5356//
5393//
@@ -5390,7 +5427,7 @@ type TextDocumentContentOptions struct {
5390// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentContentParams
5427// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentContentParams
5391type TextDocumentContentParams struct {
5428type TextDocumentContentParams struct {
5392 // The uri of the text document.
5429 // The uri of the text document.
5393− URI DocumentUri `json:"uri"`
5430+ URI DocumentURI `json:"uri"`
5394}
5431}
5395
5432
5396// Parameters for the `workspace/textDocumentContent/refresh` request.
5433// Parameters for the `workspace/textDocumentContent/refresh` request.
@@ -5401,7 +5438,7 @@ type TextDocumentContentParams struct {
5401// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentContentRefreshParams
5438// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentContentRefreshParams
5402type TextDocumentContentRefreshParams struct {
5439type TextDocumentContentRefreshParams struct {
5403 // The uri of the text document to refresh.
5440 // The uri of the text document to refresh.
5404− URI DocumentUri `json:"uri"`
5441+ URI DocumentURI `json:"uri"`
5405}
5442}
5406
5443
5407// Text document content provider registration options.
5444// Text document content provider registration options.
@@ -5453,22 +5490,24 @@ type TextDocumentEdit struct {
5453// @since 3.17.0
5490// @since 3.17.0
5454//
5491//
5455// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentFilter
5492// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentFilter
5493+type (
5456−type TextDocumentFilter = Or_TextDocumentFilter // (alias)
5494+ TextDocumentFilter = Or_TextDocumentFilter // (alias)
5457−// A document filter where `language` is required field.
5495+ // A document filter where `language` is required field.
5458−//
5459−// @since 3.18.0
5460−//
5461−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentFilterLanguage
5462−type TextDocumentFilterLanguage struct {
5463− // A language id, like `typescript`.
5464− Language string `json:"language"`
5465− // A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
5466− Scheme string `json:"scheme,omitempty"`
5467− // A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples.
5468 //
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+ //
5469− // @since 3.18.0 - support for relative patterns.
5507+ // @since 3.18.0 - support for relative patterns.
5470− Pattern *GlobPattern `json:"pattern,omitempty"`
5508+ Pattern *GlobPattern `json:"pattern,omitempty"`
5471−}
5509+ }
5510+)
5472
5511
5473// A document filter where `pattern` is required field.
5512// A document filter where `pattern` is required field.
5474//
5513//
@@ -5507,7 +5546,7 @@ type TextDocumentFilterScheme struct {
5507// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentIdentifier
5546// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentIdentifier
5508type TextDocumentIdentifier struct {
5547type TextDocumentIdentifier struct {
5509 // The text document's uri.
5548 // The text document's uri.
5510− URI DocumentUri `json:"uri"`
5549+ URI DocumentURI `json:"uri"`
5511}
5550}
5512
5551
5513// An item to transfer a text document from the client to the
5552// An item to transfer a text document from the client to the
@@ -5516,7 +5555,7 @@ type TextDocumentIdentifier struct {
5516// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentItem
5555// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentItem
5517type TextDocumentItem struct {
5556type TextDocumentItem struct {
5518 // The text document's uri.
5557 // The text document's uri.
5519− URI DocumentUri `json:"uri"`
5558+ URI DocumentURI `json:"uri"`
5520 // The text document's language identifier.
5559 // The text document's language identifier.
5521 LanguageID LanguageKind `json:"languageId"`
5560 LanguageID LanguageKind `json:"languageId"`
5522 // The version number of this document (it will increase after each
5561 // The version number of this document (it will increase after each
@@ -5605,8 +5644,10 @@ type TextEdit struct {
5605 // empty string.
5644 // empty string.
5606 NewText string `json:"newText"`
5645 NewText string `json:"newText"`
5607}
5646}
5647+type (
5608−type TokenFormat string
5648+ TokenFormat string
5609−type TraceValue string
5649+ TraceValue string
5650+)
5610
5651
5611// created for Tuple
5652// created for Tuple
5612type Tuple_ParameterInformation_label_Item1 struct {
5653type Tuple_ParameterInformation_label_Item1 struct {
@@ -5670,7 +5711,7 @@ type TypeHierarchyItem struct {
5670 // More detail for this item, e.g. the signature of a function.
5711 // More detail for this item, e.g. the signature of a function.
5671 Detail string `json:"detail,omitempty"`
5712 Detail string `json:"detail,omitempty"`
5672 // The resource identifier of this item.
5713 // The resource identifier of this item.
5673− URI DocumentUri `json:"uri"`
5714+ URI DocumentURI `json:"uri"`
5674 // The range enclosing this symbol not including leading/trailing whitespace
5715 // The range enclosing this symbol not including leading/trailing whitespace
5675 // but everything else, e.g. comments and code.
5716 // but everything else, e.g. comments and code.
5676 Range Range `json:"range"`
5717 Range Range `json:"range"`
@@ -5795,14 +5836,16 @@ type VersionedTextDocumentIdentifier struct {
5795 Version int32 `json:"version"`
5836 Version int32 `json:"version"`
5796 TextDocumentIdentifier
5837 TextDocumentIdentifier
5797}
5838}
5839+type (
5798−type WatchKind = uint32 // The parameters sent in a will save text document notification.
5840+ WatchKind = uint32 // The parameters sent in a will save text document notification.
5799−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#willSaveTextDocumentParams
5841+ // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#willSaveTextDocumentParams
5800−type WillSaveTextDocumentParams struct {
5842+ WillSaveTextDocumentParams struct {
5801− // The document that will be saved.
5843+ // The document that will be saved.
5802− TextDocument TextDocumentIdentifier `json:"textDocument"`
5844+ TextDocument TextDocumentIdentifier `json:"textDocument"`
5803− // The 'TextDocumentSaveReason'.
5845+ // The 'TextDocumentSaveReason'.
5804− Reason TextDocumentSaveReason `json:"reason"`
5846+ Reason TextDocumentSaveReason `json:"reason"`
5805−}
5847+ }
5848+)
5806
5849
5807// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#windowClientCapabilities
5850// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#windowClientCapabilities
5808type WindowClientCapabilities struct {
5851type WindowClientCapabilities struct {
@@ -6012,43 +6055,45 @@ type WorkspaceDiagnosticReportPartialResult struct {
6012// @since 3.17.0
6055// @since 3.17.0
6013//
6056//
6014// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceDocumentDiagnosticReport
6057// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceDocumentDiagnosticReport
6058+type (
6015−type WorkspaceDocumentDiagnosticReport = Or_WorkspaceDocumentDiagnosticReport // (alias)
6059+ WorkspaceDocumentDiagnosticReport = Or_WorkspaceDocumentDiagnosticReport // (alias)
6016−// A workspace edit represents changes to many resources managed in the workspace. The edit
6060+ // A workspace edit represents changes to many resources managed in the workspace. The edit
6017−// should either provide `changes` or `documentChanges`. If documentChanges are present
6061+ // should either provide `changes` or `documentChanges`. If documentChanges are present
6018−// they are preferred over `changes` if the client can handle versioned document edits.
6062+ // they are preferred over `changes` if the client can handle versioned document edits.
6019−//
6063+ //
6020−// Since version 3.13.0 a workspace edit can contain resource operations as well. If resource
6064+ // Since version 3.13.0 a workspace edit can contain resource operations as well. If resource
6021−// operations are present clients need to execute the operations in the order in which they
6065+ // operations are present clients need to execute the operations in the order in which they
6022−// are provided. So a workspace edit for example can consist of the following two changes:
6066+ // are provided. So a workspace edit for example can consist of the following two changes:
6023−// (1) a create file a.txt and (2) a text document edit which insert text into file a.txt.
6067+ // (1) a create file a.txt and (2) a text document edit which insert text into file a.txt.
6024−//
6068+ //
6025−// An invalid sequence (e.g. (1) delete file a.txt and (2) insert text into file a.txt) will
6069+ // An invalid sequence (e.g. (1) delete file a.txt and (2) insert text into file a.txt) will
6026−// cause failure of the operation. How the client recovers from the failure is described by
6070+ // cause failure of the operation. How the client recovers from the failure is described by
6027−// the client capability: `workspace.workspaceEdit.failureHandling`
6071+ // the client capability: `workspace.workspaceEdit.failureHandling`
6028−//
6072+ //
6029−// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceEdit
6073+ // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceEdit
6030−type WorkspaceEdit struct {
6074+ WorkspaceEdit struct {
6031− // Holds changes to existing resources.
6075+ // Holds changes to existing resources.
6032− Changes map[DocumentUri][]TextEdit `json:"changes,omitempty"`
6076+ Changes map[DocumentURI][]TextEdit `json:"changes,omitempty"`
6033− // Depending on the client capability `workspace.workspaceEdit.resourceOperations` document changes
6077+ // Depending on the client capability `workspace.workspaceEdit.resourceOperations` document changes
6034− // are either an array of `TextDocumentEdit`s to express changes to n different text documents
6078+ // are either an array of `TextDocumentEdit`s to express changes to n different text documents
6035− // where each text document edit addresses a specific version of a text document. Or it can contain
6079+ // where each text document edit addresses a specific version of a text document. Or it can contain
6036− // above `TextDocumentEdit`s mixed with create, rename and delete file / folder operations.
6080+ // above `TextDocumentEdit`s mixed with create, rename and delete file / folder operations.
6037− //
6081+ //
6038− // Whether a client supports versioned document edits is expressed via
6082+ // Whether a client supports versioned document edits is expressed via
6039− // `workspace.workspaceEdit.documentChanges` client capability.
6083+ // `workspace.workspaceEdit.documentChanges` client capability.
6040− //
6084+ //
6041− // If a client neither supports `documentChanges` nor `workspace.workspaceEdit.resourceOperations` then
6085+ // If a client neither supports `documentChanges` nor `workspace.workspaceEdit.resourceOperations` then
6042− // only plain `TextEdit`s using the `changes` property are supported.
6086+ // only plain `TextEdit`s using the `changes` property are supported.
6043− DocumentChanges []DocumentChange `json:"documentChanges,omitempty"`
6087+ DocumentChanges []DocumentChange `json:"documentChanges,omitempty"`
6044− // A map of change annotations that can be referenced in `AnnotatedTextEdit`s or create, rename and
6088+ // A map of change annotations that can be referenced in `AnnotatedTextEdit`s or create, rename and
6045− // delete file / folder operations.
6089+ // delete file / folder operations.
6046− //
6090+ //
6047− // Whether clients honor this property depends on the client capability `workspace.changeAnnotationSupport`.
6091+ // Whether clients honor this property depends on the client capability `workspace.changeAnnotationSupport`.
6048− //
6092+ //
6049− // @since 3.16.0
6093+ // @since 3.16.0
6050− ChangeAnnotations map[ChangeAnnotationIdentifier]ChangeAnnotation `json:"changeAnnotations,omitempty"`
6094+ ChangeAnnotations map[ChangeAnnotationIdentifier]ChangeAnnotation `json:"changeAnnotations,omitempty"`
6051−}
6095+ }
6096+)
6052
6097
6053// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceEditClientCapabilities
6098// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceEditClientCapabilities
6054type WorkspaceEditClientCapabilities struct {
6099type WorkspaceEditClientCapabilities struct {
@@ -6154,7 +6199,7 @@ type WorkspaceFoldersServerCapabilities struct {
6154// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceFullDocumentDiagnosticReport
6199// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceFullDocumentDiagnosticReport
6155type WorkspaceFullDocumentDiagnosticReport struct {
6200type WorkspaceFullDocumentDiagnosticReport struct {
6156 // The URI for which diagnostic information is reported.
6201 // The URI for which diagnostic information is reported.
6157− URI DocumentUri `json:"uri"`
6202+ URI DocumentURI `json:"uri"`
6158 // The version number for which the diagnostics are reported.
6203 // The version number for which the diagnostics are reported.
6159 // If the document is not marked as open `null` can be provided.
6204 // If the document is not marked as open `null` can be provided.
6160 Version int32 `json:"version"`
6205 Version int32 `json:"version"`
@@ -6266,7 +6311,7 @@ type WorkspaceSymbolRegistrationOptions struct {
6266// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceUnchangedDocumentDiagnosticReport
6311// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceUnchangedDocumentDiagnosticReport
6267type WorkspaceUnchangedDocumentDiagnosticReport struct {
6312type WorkspaceUnchangedDocumentDiagnosticReport struct {
6268 // The URI for which diagnostic information is reported.
6313 // The URI for which diagnostic information is reported.
6269− URI DocumentUri `json:"uri"`
6314+ URI DocumentURI `json:"uri"`
6270 // The version number for which the diagnostics are reported.
6315 // The version number for which the diagnostics are reported.
6271 // If the document is not marked as open `null` can be provided.
6316 // If the document is not marked as open `null` can be provided.
6272 Version int32 `json:"version"`
6317 Version int32 `json:"version"`
@@ -6306,7 +6351,7 @@ type XInitializeParams struct {
6306 // `rootUri` wins.
6351 // `rootUri` wins.
6307 //
6352 //
6308 // @deprecated in favour of workspaceFolders.
6353 // @deprecated in favour of workspaceFolders.
6309− RootURI DocumentUri `json:"rootUri"`
6354+ RootURI DocumentURI `json:"rootUri"`
6310 // The capabilities provided by the client (editor or tool)
6355 // The capabilities provided by the client (editor or tool)
6311 Capabilities ClientCapabilities `json:"capabilities"`
6356 Capabilities ClientCapabilities `json:"capabilities"`
6312 // User provided initialization options.
6357 // User provided initialization options.
@@ -6349,7 +6394,7 @@ type _InitializeParams struct {
6349 // `rootUri` wins.
6394 // `rootUri` wins.
6350 //
6395 //
6351 // @deprecated in favour of workspaceFolders.
6396 // @deprecated in favour of workspaceFolders.
6352− RootURI DocumentUri `json:"rootUri"`
6397+ RootURI DocumentURI `json:"rootUri"`
6353 // The capabilities provided by the client (editor or tool)
6398 // The capabilities provided by the client (editor or tool)
6354 Capabilities ClientCapabilities `json:"capabilities"`
6399 Capabilities ClientCapabilities `json:"capabilities"`
6355 // User provided initialization options.
6400 // User provided initialization options.
internal/lsp/protocol/uri.go+15−15
@@ -17,7 +17,7 @@ import (
17 "unicode"
17 "unicode"
18)
18)
19
19
20−// A DocumentUri is the URI of a client editor document.
20+// A DocumentURI is the URI of a client editor document.
21//
21//
22// According to the LSP specification:
22// According to the LSP specification:
23//
23//
@@ -38,8 +38,8 @@ import (
38// file:///C%3A/project/readme.md
38// file:///C%3A/project/readme.md
39//
39//
40// This is done during JSON unmarshalling;
40// This is done during JSON unmarshalling;
41−// see [DocumentUri.UnmarshalText] for details.
41+// see [DocumentURI.UnmarshalText] for details.
42−type DocumentUri string
42+type DocumentURI string
43
43
44// A URI is an arbitrary URL (e.g. https), not necessarily a file.
44// A URI is an arbitrary URL (e.g. https), not necessarily a file.
45type URI = string
45type URI = string
@@ -60,8 +60,8 @@ type URI = string
60//
60//
61// Non-empty DocumentUris are valid "file"-scheme URIs.
61// Non-empty DocumentUris are valid "file"-scheme URIs.
62// The empty DocumentUri is valid.
62// The empty DocumentUri is valid.
63−func (uri *DocumentUri) UnmarshalText(data []byte) (err error) {
63+func (uri *DocumentURI) UnmarshalText(data []byte) (err error) {
64− *uri, err = ParseDocumentUri(string(data))
64+ *uri, err = ParseDocumentURI(string(data))
65 return
65 return
66}
66}
67
67
@@ -70,7 +70,7 @@ func (uri *DocumentUri) UnmarshalText(data []byte) (err error) {
70// DocumentUri("").Path() returns the empty string.
70// DocumentUri("").Path() returns the empty string.
71//
71//
72// Path panics if called on a URI that is not a valid filename.
72// Path panics if called on a URI that is not a valid filename.
73−func (uri DocumentUri) Path() string {
73+func (uri DocumentURI) Path() string {
74 filename, err := filename(uri)
74 filename, err := filename(uri)
75 if err != nil {
75 if err != nil {
76 // e.g. ParseRequestURI failed.
76 // e.g. ParseRequestURI failed.
@@ -85,7 +85,7 @@ func (uri DocumentUri) Path() string {
85}
85}
86
86
87// Dir returns the URI for the directory containing the receiver.
87// Dir returns the URI for the directory containing the receiver.
88−func (uri DocumentUri) Dir() DocumentUri {
88+func (uri DocumentURI) Dir() DocumentURI {
89 // This function could be more efficiently implemented by avoiding any call
89 // This function could be more efficiently implemented by avoiding any call
90 // to Path(), but at least consolidates URI manipulation.
90 // to Path(), but at least consolidates URI manipulation.
91 return URIFromPath(uri.DirPath())
91 return URIFromPath(uri.DirPath())
@@ -93,11 +93,11 @@ func (uri DocumentUri) Dir() DocumentUri {
93
93
94// DirPath returns the file path to the directory containing this URI, which
94// DirPath returns the file path to the directory containing this URI, which
95// must be a file URI.
95// must be a file URI.
96−func (uri DocumentUri) DirPath() string {
96+func (uri DocumentURI) DirPath() string {
97 return filepath.Dir(uri.Path())
97 return filepath.Dir(uri.Path())
98}
98}
99
99
100−func filename(uri DocumentUri) (string, error) {
100+func filename(uri DocumentURI) (string, error) {
101 if uri == "" {
101 if uri == "" {
102 return "", nil
102 return "", nil
103 }
103 }
@@ -137,9 +137,9 @@ slow:
137 return u.Path, nil
137 return u.Path, nil
138}
138}
139
139
140−// ParseDocumentUri interprets a string as a DocumentUri, applying VS
140+// ParseDocumentURI interprets a string as a DocumentUri, applying VS
141−// Code workarounds; see [DocumentUri.UnmarshalText] for details.
141+// Code workarounds; see [DocumentURI.UnmarshalText] for details.
142−func ParseDocumentUri(s string) (DocumentUri, error) {
142+func ParseDocumentURI(s string) (DocumentURI, error) {
143 if s == "" {
143 if s == "" {
144 return "", nil
144 return "", nil
145 }
145 }
@@ -169,12 +169,12 @@ func ParseDocumentUri(s string) (DocumentUri, error) {
169 path = path[:1] + strings.ToUpper(string(path[1])) + path[2:]
169 path = path[:1] + strings.ToUpper(string(path[1])) + path[2:]
170 }
170 }
171 u := url.URL{Scheme: fileScheme, Path: path}
171 u := url.URL{Scheme: fileScheme, Path: path}
172− return DocumentUri(u.String()), nil
172+ return DocumentURI(u.String()), nil
173}
173}
174
174
175// URIFromPath returns DocumentUri for the supplied file path.
175// URIFromPath returns DocumentUri for the supplied file path.
176// Given "", it returns "".
176// Given "", it returns "".
177−func URIFromPath(path string) DocumentUri {
177+func URIFromPath(path string) DocumentURI {
178 if path == "" {
178 if path == "" {
179 return ""
179 return ""
180 }
180 }
@@ -192,7 +192,7 @@ func URIFromPath(path string) DocumentUri {
192 Scheme: fileScheme,
192 Scheme: fileScheme,
193 Path: path,
193 Path: path,
194 }
194 }
195− return DocumentUri(u.String())
195+ return DocumentURI(u.String())
196}
196}
197
197
198const fileScheme = "file"
198const fileScheme = "file"
internal/lsp/transport.go+1−1
@@ -12,7 +12,7 @@ import (
12 "github.com/charmbracelet/crush/internal/config"
12 "github.com/charmbracelet/crush/internal/config"
13)
13)
14
14
15−// Write writes an LSP message to the given writer
15+// WriteMessage writes an LSP message to the given writer
16func WriteMessage(w io.Writer, msg *Message) error {
16func WriteMessage(w io.Writer, msg *Message) error {
17 data, err := json.Marshal(msg)
17 data, err := json.Marshal(msg)
18 if err != nil {
18 if err != nil {
internal/lsp/util/edit.go+1−1
@@ -10,7 +10,7 @@ import (
10 "github.com/charmbracelet/crush/internal/lsp/protocol"
10 "github.com/charmbracelet/crush/internal/lsp/protocol"
11)
11)
12
12
13−func applyTextEdits(uri protocol.DocumentUri, edits []protocol.TextEdit) error {
13+func applyTextEdits(uri protocol.DocumentURI, edits []protocol.TextEdit) error {
14 path := uri.Path()
14 path := uri.Path()
15
15
16 // Read the file content
16 // Read the file content
internal/lsp/watcher/watcher.go+7−7
@@ -77,7 +77,7 @@ func (w *WorkspaceWatcher) AddRegistrations(ctx context.Context, id string, watc
77 switch u := v.BaseURI.Value.(type) {
77 switch u := v.BaseURI.Value.(type) {
78 case string:
78 case string:
79 slog.Debug("BaseURI", "baseURI", u)
79 slog.Debug("BaseURI", "baseURI", u)
80− case protocol.DocumentUri:
80+ case protocol.DocumentURI:
81 slog.Debug("BaseURI", "baseURI", u)
81 slog.Debug("BaseURI", "baseURI", u)
82 default:
82 default:
83 slog.Debug("BaseURI", "baseURI", u)
83 slog.Debug("BaseURI", "baseURI", u)
@@ -514,8 +514,8 @@ func matchesGlob(pattern, path string) bool {
514// matchesSimpleGlob handles glob patterns with ** wildcards
514// matchesSimpleGlob handles glob patterns with ** wildcards
515func matchesSimpleGlob(pattern, path string) bool {
515func matchesSimpleGlob(pattern, path string) bool {
516 // Handle special case for **/*.ext pattern (common in LSP)
516 // Handle special case for **/*.ext pattern (common in LSP)
517− if strings.HasPrefix(pattern, "**/") {
517+ if after, ok := strings.CutPrefix(pattern, "**/"); ok {
518− rest := strings.TrimPrefix(pattern, "**/")
518+ rest := after
519
519
520 // If the rest is a simple file extension pattern like *.go
520 // If the rest is a simple file extension pattern like *.go
521 if strings.HasPrefix(rest, "*.") {
521 if strings.HasPrefix(rest, "*.") {
@@ -607,7 +607,7 @@ func (w *WorkspaceWatcher) matchesPattern(path string, pattern protocol.GlobPatt
607 }
607 }
608
608
609 // For relative patterns
609 // For relative patterns
610− basePath = protocol.DocumentUri(basePath).Path()
610+ basePath = protocol.DocumentURI(basePath).Path()
611 basePath = filepath.ToSlash(basePath)
611 basePath = filepath.ToSlash(basePath)
612
612
613 // Make path relative to basePath for matching
613 // Make path relative to basePath for matching
@@ -650,9 +650,9 @@ func (w *WorkspaceWatcher) debounceHandleFileEvent(ctx context.Context, uri stri
650// handleFileEvent sends file change notifications
650// handleFileEvent sends file change notifications
651func (w *WorkspaceWatcher) handleFileEvent(ctx context.Context, uri string, changeType protocol.FileChangeType) {
651func (w *WorkspaceWatcher) handleFileEvent(ctx context.Context, uri string, changeType protocol.FileChangeType) {
652 // If the file is open and it's a change event, use didChange notification
652 // If the file is open and it's a change event, use didChange notification
653− filePath := protocol.DocumentUri(uri).Path()
653+ filePath := protocol.DocumentURI(uri).Path()
654 if changeType == protocol.FileChangeType(protocol.Deleted) {
654 if changeType == protocol.FileChangeType(protocol.Deleted) {
655− w.client.ClearDiagnosticsForURI(protocol.DocumentUri(uri))
655+ w.client.ClearDiagnosticsForURI(protocol.DocumentURI(uri))
656 } else if changeType == protocol.FileChangeType(protocol.Changed) && w.client.IsFileOpen(filePath) {
656 } else if changeType == protocol.FileChangeType(protocol.Changed) && w.client.IsFileOpen(filePath) {
657 err := w.client.NotifyChange(ctx, filePath)
657 err := w.client.NotifyChange(ctx, filePath)
658 if err != nil {
658 if err != nil {
@@ -680,7 +680,7 @@ func (w *WorkspaceWatcher) notifyFileEvent(ctx context.Context, uri string, chan
680 params := protocol.DidChangeWatchedFilesParams{
680 params := protocol.DidChangeWatchedFilesParams{
681 Changes: []protocol.FileEvent{
681 Changes: []protocol.FileEvent{
682 {
682 {
683− URI: protocol.DocumentUri(uri),
683+ URI: protocol.DocumentURI(uri),
684 Type: changeType,
684 Type: changeType,
685 },
685 },
686 },
686 },
internal/tui/components/core/status/status.go−2
@@ -6,7 +6,6 @@ import (
6
6
7 "github.com/charmbracelet/bubbles/v2/help"
7 "github.com/charmbracelet/bubbles/v2/help"
8 tea "github.com/charmbracelet/bubbletea/v2"
8 tea "github.com/charmbracelet/bubbletea/v2"
9− "github.com/charmbracelet/crush/internal/session"
10 "github.com/charmbracelet/crush/internal/tui/styles"
9 "github.com/charmbracelet/crush/internal/tui/styles"
11 "github.com/charmbracelet/crush/internal/tui/util"
10 "github.com/charmbracelet/crush/internal/tui/util"
12 "github.com/charmbracelet/lipgloss/v2"
11 "github.com/charmbracelet/lipgloss/v2"
@@ -23,7 +22,6 @@ type statusCmp struct {
23 info util.InfoMsg
22 info util.InfoMsg
24 width int
23 width int
25 messageTTL time.Duration
24 messageTTL time.Duration
26− session session.Session
27 help help.Model
25 help help.Model
28 keyMap help.KeyMap
26 keyMap help.KeyMap
29}
27}
internal/tui/components/logo/logo.go−36
@@ -233,42 +233,6 @@ func letterR(stretch bool) string {
233 )
233 )
234}
234}
235
235
236−// letterS renders the letter S in a stylized way. It takes an integer that
237−// determines how many cells to stretch the letter. If the stretch is less than
238−// 1, it defaults to no stretching.
239−func letterS(stretch bool) string {
240− // Here's what we're making:
241− //
242− // ▄▀▀▀▀
243− // ▀▀▀▄
244− // ▀▀▀▀
245−
246− left := heredoc.Doc(`
247− ▄
248−
249− ▀
250− `)
251− center := heredoc.Doc(`
252− ▀
253− ▀
254− ▀
255− `)
256− right := heredoc.Doc(`
257− ▀
258− ▄
259− `)
260− return joinLetterform(
261− left,
262− stretchLetterformPart(center, letterformProps{
263− stretch: stretch,
264− width: 3,
265− minStretch: 7,
266− maxStretch: 12,
267− }),
268− right,
269− )
270−}
271−
272// letterSStylized renders the letter S in a stylized way, more so than
236// letterSStylized renders the letter S in a stylized way, more so than
273// [letterS]. It takes an integer that determines how many cells to stretch the
237// [letterS]. It takes an integer that determines how many cells to stretch the
274// letter. If the stretch is less than 1, it defaults to no stretching.
238// letter. If the stretch is less than 1, it defaults to no stretching.
internal/tui/exp/diffview/diffview.go+1−2
@@ -9,7 +9,6 @@ import (
9 "github.com/alecthomas/chroma/v2"
9 "github.com/alecthomas/chroma/v2"
10 "github.com/alecthomas/chroma/v2/lexers"
10 "github.com/alecthomas/chroma/v2/lexers"
11 "github.com/aymanbagabas/go-udiff"
11 "github.com/aymanbagabas/go-udiff"
12− "github.com/aymanbagabas/go-udiff/myers"
13 "github.com/charmbracelet/lipgloss/v2"
12 "github.com/charmbracelet/lipgloss/v2"
14 "github.com/charmbracelet/x/ansi"
13 "github.com/charmbracelet/x/ansi"
15)
14)
@@ -210,7 +209,7 @@ func (dv *DiffView) computeDiff() error {
210 return dv.err
209 return dv.err
211 }
210 }
212 dv.isComputed = true
211 dv.isComputed = true
213− dv.edits = myers.ComputeEdits( //nolint:staticcheck
212+ dv.edits = udiff.Strings(
214 dv.before.content,
213 dv.before.content,
215 dv.after.content,
214 dv.after.content,
216 )
215 )
internal/tui/exp/diffview/testdata/TestDiffView/Unified/Narrow/DarkMode.golden+2−2
@@ -1,7 +1,7 @@
1 …  …  @@ -1,3 +1,3 @@  
1 …  …  @@ -1,3 +1,3 @@  
2 1    - a 
2 1    - a 
3− 2    - b 
4− 3    - c 
5    1 + d 
3    1 + d 
4+ 2    - b 
6    2 + e 
5    2 + e 
6+ 3    - c 
7    3 + f 
7    3 + f 
internal/tui/exp/diffview/testdata/TestDiffView/Unified/Narrow/LightMode.golden+2−2
@@ -1,7 +1,7 @@
1 …  …  @@ -1,3 +1,3 @@  
1 …  …  @@ -1,3 +1,3 @@  
2 1    - a 
2 1    - a 
3− 2    - b 
4− 3    - c 
5    1 + d 
3    1 + d 
4+ 2    - b 
6    2 + e 
5    2 + e 
6+ 3    - c 
7    3 + f 
7    3 + f 
internal/tui/exp/diffview/udiff_test.go+1−2
@@ -6,7 +6,6 @@ import (
6 "testing"
6 "testing"
7
7
8 "github.com/aymanbagabas/go-udiff"
8 "github.com/aymanbagabas/go-udiff"
9− "github.com/aymanbagabas/go-udiff/myers"
10 "github.com/charmbracelet/x/exp/golden"
9 "github.com/charmbracelet/x/exp/golden"
11)
10)
12
11
@@ -39,7 +38,7 @@ func TestUdiff(t *testing.T) {
39
38
40 t.Run("ToUnifiedDiff", func(t *testing.T) {
39 t.Run("ToUnifiedDiff", func(t *testing.T) {
41 toUnifiedDiff := func(t *testing.T, before, after string, contextLines int) udiff.UnifiedDiff {
40 toUnifiedDiff := func(t *testing.T, before, after string, contextLines int) udiff.UnifiedDiff {
42− edits := myers.ComputeEdits(before, after) //nolint:staticcheck
41+ edits := udiff.Strings(before, after)
43 unifiedDiff, err := udiff.ToUnifiedDiff("main.go", "main.go", before, edits, contextLines)
42 unifiedDiff, err := udiff.ToUnifiedDiff("main.go", "main.go", before, edits, contextLines)
44 if err != nil {
43 if err != nil {
45 t.Fatalf("ToUnifiedDiff failed: %v", err)
44 t.Fatalf("ToUnifiedDiff failed: %v", err)
internal/tui/exp/list/list.go−2
@@ -21,8 +21,6 @@ type list struct {
21
21
22 items []Item
22 items []Item
23
23
24− renderedView string
25−
26 // Filter options
24 // Filter options
27 filterable bool
25 filterable bool
28 filterPlaceholder string
26 filterPlaceholder string
internal/tui/page/chat/chat.go+14−13
@@ -591,11 +591,11 @@ func (p *chatPage) Bindings() []key.Binding {
591 return bindings
591 return bindings
592}
592}
593
593
594−func (a *chatPage) Help() help.KeyMap {
594+func (p *chatPage) Help() help.KeyMap {
595 var shortList []key.Binding
595 var shortList []key.Binding
596 var fullList [][]key.Binding
596 var fullList [][]key.Binding
597 switch {
597 switch {
598− case a.isOnboarding && !a.splash.IsShowingAPIKey():
598+ case p.isOnboarding && !p.splash.IsShowingAPIKey():
599 shortList = append(shortList,
599 shortList = append(shortList,
600 // Choose model
600 // Choose model
601 key.NewBinding(
601 key.NewBinding(
@@ -617,7 +617,7 @@ func (a *chatPage) Help() help.KeyMap {
617 for _, v := range shortList {
617 for _, v := range shortList {
618 fullList = append(fullList, []key.Binding{v})
618 fullList = append(fullList, []key.Binding{v})
619 }
619 }
620− case a.isOnboarding && a.splash.IsShowingAPIKey():
620+ case p.isOnboarding && p.splash.IsShowingAPIKey():
621 shortList = append(shortList,
621 shortList = append(shortList,
622 // Go back
622 // Go back
623 key.NewBinding(
623 key.NewBinding(
@@ -634,7 +634,7 @@ func (a *chatPage) Help() help.KeyMap {
634 for _, v := range shortList {
634 for _, v := range shortList {
635 fullList = append(fullList, []key.Binding{v})
635 fullList = append(fullList, []key.Binding{v})
636 }
636 }
637− case a.isProjectInit:
637+ case p.isProjectInit:
638 shortList = append(shortList,
638 shortList = append(shortList,
639 key.NewBinding(
639 key.NewBinding(
640 key.WithKeys("ctrl+c"),
640 key.WithKeys("ctrl+c"),
@@ -646,7 +646,7 @@ func (a *chatPage) Help() help.KeyMap {
646 fullList = append(fullList, []key.Binding{v})
646 fullList = append(fullList, []key.Binding{v})
647 }
647 }
648 default:
648 default:
649− if a.editor.IsCompletionsOpen() {
649+ if p.editor.IsCompletionsOpen() {
650 shortList = append(shortList,
650 shortList = append(shortList,
651 key.NewBinding(
651 key.NewBinding(
652 key.WithKeys("tab", "enter"),
652 key.WithKeys("tab", "enter"),
@@ -666,12 +666,12 @@ func (a *chatPage) Help() help.KeyMap {
666 }
666 }
667 return core.NewSimpleHelp(shortList, fullList)
667 return core.NewSimpleHelp(shortList, fullList)
668 }
668 }
669− if a.app.CoderAgent != nil && a.app.CoderAgent.IsBusy() {
669+ if p.app.CoderAgent != nil && p.app.CoderAgent.IsBusy() {
670 cancelBinding := key.NewBinding(
670 cancelBinding := key.NewBinding(
671 key.WithKeys("esc"),
671 key.WithKeys("esc"),
672 key.WithHelp("esc", "cancel"),
672 key.WithHelp("esc", "cancel"),
673 )
673 )
674− if a.isCanceling {
674+ if p.isCanceling {
675 cancelBinding = key.NewBinding(
675 cancelBinding = key.NewBinding(
676 key.WithKeys("esc"),
676 key.WithKeys("esc"),
677 key.WithHelp("esc", "press again to cancel"),
677 key.WithHelp("esc", "press again to cancel"),
@@ -686,12 +686,12 @@ func (a *chatPage) Help() help.KeyMap {
686 }
686 }
687 globalBindings := []key.Binding{}
687 globalBindings := []key.Binding{}
688 // we are in a session
688 // we are in a session
689− if a.session.ID != "" {
689+ if p.session.ID != "" {
690 tabKey := key.NewBinding(
690 tabKey := key.NewBinding(
691 key.WithKeys("tab"),
691 key.WithKeys("tab"),
692 key.WithHelp("tab", "focus chat"),
692 key.WithHelp("tab", "focus chat"),
693 )
693 )
694− if a.focusedPane == PanelTypeChat {
694+ if p.focusedPane == PanelTypeChat {
695 tabKey = key.NewBinding(
695 tabKey = key.NewBinding(
696 key.WithKeys("tab"),
696 key.WithKeys("tab"),
697 key.WithHelp("tab", "focus editor"),
697 key.WithHelp("tab", "focus editor"),
@@ -715,7 +715,7 @@ func (a *chatPage) Help() help.KeyMap {
715 key.WithHelp("ctrl+s", "sessions"),
715 key.WithHelp("ctrl+s", "sessions"),
716 ),
716 ),
717 )
717 )
718− if a.session.ID != "" {
718+ if p.session.ID != "" {
719 globalBindings = append(globalBindings,
719 globalBindings = append(globalBindings,
720 key.NewBinding(
720 key.NewBinding(
721 key.WithKeys("ctrl+n"),
721 key.WithKeys("ctrl+n"),
@@ -728,7 +728,8 @@ func (a *chatPage) Help() help.KeyMap {
728 )
728 )
729 fullList = append(fullList, globalBindings)
729 fullList = append(fullList, globalBindings)
730
730
731− if a.focusedPane == PanelTypeChat {
731+ switch p.focusedPane {
732+ case PanelTypeChat:
732 shortList = append(shortList,
733 shortList = append(shortList,
733 key.NewBinding(
734 key.NewBinding(
734 key.WithKeys("up", "down"),
735 key.WithKeys("up", "down"),
@@ -773,7 +774,7 @@ func (a *chatPage) Help() help.KeyMap {
773 ),
774 ),
774 },
775 },
775 )
776 )
776− } else if a.focusedPane == PanelTypeEditor {
777+ case PanelTypeEditor:
777 newLineBinding := key.NewBinding(
778 newLineBinding := key.NewBinding(
778 key.WithKeys("shift+enter", "ctrl+j"),
779 key.WithKeys("shift+enter", "ctrl+j"),
779 // "ctrl+j" is a common keybinding for newline in many editors. If
780 // "ctrl+j" is a common keybinding for newline in many editors. If
@@ -781,7 +782,7 @@ func (a *chatPage) Help() help.KeyMap {
781 // to reflect that.
782 // to reflect that.
782 key.WithHelp("ctrl+j", "newline"),
783 key.WithHelp("ctrl+j", "newline"),
783 )
784 )
784− if a.keyboardEnhancements.SupportsKeyDisambiguation() {
785+ if p.keyboardEnhancements.SupportsKeyDisambiguation() {
785 newLineBinding.SetHelp("shift+enter", newLineBinding.Help().Desc)
786 newLineBinding.SetHelp("shift+enter", newLineBinding.Help().Desc)
786 }
787 }
787 shortList = append(shortList, newLineBinding)
788 shortList = append(shortList, newLineBinding)
internal/version/version.go+1
@@ -3,6 +3,7 @@ package version
3import "runtime/debug"
3import "runtime/debug"
4
4
5// Build-time parameters set via -ldflags
5// Build-time parameters set via -ldflags
6+
6var Version = "unknown"
7var Version = "unknown"
7
8
8// A user may install crush using `go install github.com/charmbracelet/crush@latest`.
9// A user may install crush using `go install github.com/charmbracelet/crush@latest`.