methods.go

  1// Generated code. Do not edit
  2package lsp
  3
  4import (
  5	"context"
  6	"log/slog"
  7	"time"
  8
  9	"github.com/charmbracelet/crush/internal/config"
 10	"github.com/charmbracelet/crush/internal/lsp/protocol"
 11)
 12
 13// Implementation sends a textDocument/implementation request to the LSP server.
 14// A request to resolve the implementation locations of a symbol at a given text document position. The request's parameter is of type TextDocumentPositionParams the response is of type Definition or a Thenable that resolves to such.
 15func (c *Client) Implementation(ctx context.Context, params protocol.ImplementationParams) (protocol.Or_Result_textDocument_implementation, error) {
 16	var result protocol.Or_Result_textDocument_implementation
 17	err := c.Call(ctx, "textDocument/implementation", params, &result)
 18	return result, err
 19}
 20
 21// TypeDefinition sends a textDocument/typeDefinition request to the LSP server.
 22// A request to resolve the type definition locations of a symbol at a given text document position. The request's parameter is of type TextDocumentPositionParams the response is of type Definition or a Thenable that resolves to such.
 23func (c *Client) TypeDefinition(ctx context.Context, params protocol.TypeDefinitionParams) (protocol.Or_Result_textDocument_typeDefinition, error) {
 24	var result protocol.Or_Result_textDocument_typeDefinition
 25	err := c.Call(ctx, "textDocument/typeDefinition", params, &result)
 26	return result, err
 27}
 28
 29// DocumentColor sends a textDocument/documentColor request to the LSP server.
 30// A request to list all color symbols found in a given text document. The request's parameter is of type DocumentColorParams the response is of type ColorInformation ColorInformation[] or a Thenable that resolves to such.
 31func (c *Client) DocumentColor(ctx context.Context, params protocol.DocumentColorParams) ([]protocol.ColorInformation, error) {
 32	var result []protocol.ColorInformation
 33	err := c.Call(ctx, "textDocument/documentColor", params, &result)
 34	return result, err
 35}
 36
 37// ColorPresentation sends a textDocument/colorPresentation request to the LSP server.
 38// A request to list all presentation for a color. The request's parameter is of type ColorPresentationParams the response is of type ColorInformation ColorInformation[] or a Thenable that resolves to such.
 39func (c *Client) ColorPresentation(ctx context.Context, params protocol.ColorPresentationParams) ([]protocol.ColorPresentation, error) {
 40	var result []protocol.ColorPresentation
 41	err := c.Call(ctx, "textDocument/colorPresentation", params, &result)
 42	return result, err
 43}
 44
 45// FoldingRange sends a textDocument/foldingRange request to the LSP server.
 46// A request to provide folding ranges in a document. The request's parameter is of type FoldingRangeParams, the response is of type FoldingRangeList or a Thenable that resolves to such.
 47func (c *Client) FoldingRange(ctx context.Context, params protocol.FoldingRangeParams) ([]protocol.FoldingRange, error) {
 48	var result []protocol.FoldingRange
 49	err := c.Call(ctx, "textDocument/foldingRange", params, &result)
 50	return result, err
 51}
 52
 53// Declaration sends a textDocument/declaration request to the LSP server.
 54// A request to resolve the type definition locations of a symbol at a given text document position. The request's parameter is of type TextDocumentPositionParams the response is of type Declaration or a typed array of DeclarationLink or a Thenable that resolves to such.
 55func (c *Client) Declaration(ctx context.Context, params protocol.DeclarationParams) (protocol.Or_Result_textDocument_declaration, error) {
 56	var result protocol.Or_Result_textDocument_declaration
 57	err := c.Call(ctx, "textDocument/declaration", params, &result)
 58	return result, err
 59}
 60
 61// SelectionRange sends a textDocument/selectionRange request to the LSP server.
 62// A request to provide selection ranges in a document. The request's parameter is of type SelectionRangeParams, the response is of type SelectionRange SelectionRange[] or a Thenable that resolves to such.
 63func (c *Client) SelectionRange(ctx context.Context, params protocol.SelectionRangeParams) ([]protocol.SelectionRange, error) {
 64	var result []protocol.SelectionRange
 65	err := c.Call(ctx, "textDocument/selectionRange", params, &result)
 66	return result, err
 67}
 68
 69// PrepareCallHierarchy sends a textDocument/prepareCallHierarchy request to the LSP server.
 70// A request to result a CallHierarchyItem in a document at a given position. Can be used as an input to an incoming or outgoing call hierarchy. Since 3.16.0
 71func (c *Client) PrepareCallHierarchy(ctx context.Context, params protocol.CallHierarchyPrepareParams) ([]protocol.CallHierarchyItem, error) {
 72	var result []protocol.CallHierarchyItem
 73	err := c.Call(ctx, "textDocument/prepareCallHierarchy", params, &result)
 74	return result, err
 75}
 76
 77// IncomingCalls sends a callHierarchy/incomingCalls request to the LSP server.
 78// A request to resolve the incoming calls for a given CallHierarchyItem. Since 3.16.0
 79func (c *Client) IncomingCalls(ctx context.Context, params protocol.CallHierarchyIncomingCallsParams) ([]protocol.CallHierarchyIncomingCall, error) {
 80	var result []protocol.CallHierarchyIncomingCall
 81	err := c.Call(ctx, "callHierarchy/incomingCalls", params, &result)
 82	return result, err
 83}
 84
 85// OutgoingCalls sends a callHierarchy/outgoingCalls request to the LSP server.
 86// A request to resolve the outgoing calls for a given CallHierarchyItem. Since 3.16.0
 87func (c *Client) OutgoingCalls(ctx context.Context, params protocol.CallHierarchyOutgoingCallsParams) ([]protocol.CallHierarchyOutgoingCall, error) {
 88	var result []protocol.CallHierarchyOutgoingCall
 89	err := c.Call(ctx, "callHierarchy/outgoingCalls", params, &result)
 90	return result, err
 91}
 92
 93// SemanticTokensFull sends a textDocument/semanticTokens/full request to the LSP server.
 94// Since 3.16.0
 95func (c *Client) SemanticTokensFull(ctx context.Context, params protocol.SemanticTokensParams) (protocol.SemanticTokens, error) {
 96	var result protocol.SemanticTokens
 97	err := c.Call(ctx, "textDocument/semanticTokens/full", params, &result)
 98	return result, err
 99}
100
101// SemanticTokensFullDelta sends a textDocument/semanticTokens/full/delta request to the LSP server.
102// Since 3.16.0
103func (c *Client) SemanticTokensFullDelta(ctx context.Context, params protocol.SemanticTokensDeltaParams) (protocol.Or_Result_textDocument_semanticTokens_full_delta, error) {
104	var result protocol.Or_Result_textDocument_semanticTokens_full_delta
105	err := c.Call(ctx, "textDocument/semanticTokens/full/delta", params, &result)
106	return result, err
107}
108
109// SemanticTokensRange sends a textDocument/semanticTokens/range request to the LSP server.
110// Since 3.16.0
111func (c *Client) SemanticTokensRange(ctx context.Context, params protocol.SemanticTokensRangeParams) (protocol.SemanticTokens, error) {
112	var result protocol.SemanticTokens
113	err := c.Call(ctx, "textDocument/semanticTokens/range", params, &result)
114	return result, err
115}
116
117// LinkedEditingRange sends a textDocument/linkedEditingRange request to the LSP server.
118// A request to provide ranges that can be edited together. Since 3.16.0
119func (c *Client) LinkedEditingRange(ctx context.Context, params protocol.LinkedEditingRangeParams) (protocol.LinkedEditingRanges, error) {
120	var result protocol.LinkedEditingRanges
121	err := c.Call(ctx, "textDocument/linkedEditingRange", params, &result)
122	return result, err
123}
124
125// WillCreateFiles sends a workspace/willCreateFiles request to the LSP server.
126// The will create files request is sent from the client to the server before files are actually created as long as the creation is triggered from within the client. The request can return a WorkspaceEdit which will be applied to workspace before the files are created. Hence the WorkspaceEdit can not manipulate the content of the file to be created. Since 3.16.0
127func (c *Client) WillCreateFiles(ctx context.Context, params protocol.CreateFilesParams) (protocol.WorkspaceEdit, error) {
128	var result protocol.WorkspaceEdit
129	err := c.Call(ctx, "workspace/willCreateFiles", params, &result)
130	return result, err
131}
132
133// WillRenameFiles sends a workspace/willRenameFiles request to the LSP server.
134// The will rename files request is sent from the client to the server before files are actually renamed as long as the rename is triggered from within the client. Since 3.16.0
135func (c *Client) WillRenameFiles(ctx context.Context, params protocol.RenameFilesParams) (protocol.WorkspaceEdit, error) {
136	var result protocol.WorkspaceEdit
137	err := c.Call(ctx, "workspace/willRenameFiles", params, &result)
138	return result, err
139}
140
141// WillDeleteFiles sends a workspace/willDeleteFiles request to the LSP server.
142// The did delete files notification is sent from the client to the server when files were deleted from within the client. Since 3.16.0
143func (c *Client) WillDeleteFiles(ctx context.Context, params protocol.DeleteFilesParams) (protocol.WorkspaceEdit, error) {
144	var result protocol.WorkspaceEdit
145	err := c.Call(ctx, "workspace/willDeleteFiles", params, &result)
146	return result, err
147}
148
149// Moniker sends a textDocument/moniker request to the LSP server.
150// A request to get the moniker of a symbol at a given text document position. The request parameter is of type TextDocumentPositionParams. The response is of type Moniker Moniker[] or null.
151func (c *Client) Moniker(ctx context.Context, params protocol.MonikerParams) ([]protocol.Moniker, error) {
152	var result []protocol.Moniker
153	err := c.Call(ctx, "textDocument/moniker", params, &result)
154	return result, err
155}
156
157// PrepareTypeHierarchy sends a textDocument/prepareTypeHierarchy request to the LSP server.
158// A request to result a TypeHierarchyItem in a document at a given position. Can be used as an input to a subtypes or supertypes type hierarchy. Since 3.17.0
159func (c *Client) PrepareTypeHierarchy(ctx context.Context, params protocol.TypeHierarchyPrepareParams) ([]protocol.TypeHierarchyItem, error) {
160	var result []protocol.TypeHierarchyItem
161	err := c.Call(ctx, "textDocument/prepareTypeHierarchy", params, &result)
162	return result, err
163}
164
165// Supertypes sends a typeHierarchy/supertypes request to the LSP server.
166// A request to resolve the supertypes for a given TypeHierarchyItem. Since 3.17.0
167func (c *Client) Supertypes(ctx context.Context, params protocol.TypeHierarchySupertypesParams) ([]protocol.TypeHierarchyItem, error) {
168	var result []protocol.TypeHierarchyItem
169	err := c.Call(ctx, "typeHierarchy/supertypes", params, &result)
170	return result, err
171}
172
173// Subtypes sends a typeHierarchy/subtypes request to the LSP server.
174// A request to resolve the subtypes for a given TypeHierarchyItem. Since 3.17.0
175func (c *Client) Subtypes(ctx context.Context, params protocol.TypeHierarchySubtypesParams) ([]protocol.TypeHierarchyItem, error) {
176	var result []protocol.TypeHierarchyItem
177	err := c.Call(ctx, "typeHierarchy/subtypes", params, &result)
178	return result, err
179}
180
181// InlineValue sends a textDocument/inlineValue request to the LSP server.
182// A request to provide inline values in a document. The request's parameter is of type InlineValueParams, the response is of type InlineValue InlineValue[] or a Thenable that resolves to such. Since 3.17.0
183func (c *Client) InlineValue(ctx context.Context, params protocol.InlineValueParams) ([]protocol.InlineValue, error) {
184	var result []protocol.InlineValue
185	err := c.Call(ctx, "textDocument/inlineValue", params, &result)
186	return result, err
187}
188
189// InlayHint sends a textDocument/inlayHint request to the LSP server.
190// A request to provide inlay hints in a document. The request's parameter is of type InlayHintsParams, the response is of type InlayHint InlayHint[] or a Thenable that resolves to such. Since 3.17.0
191func (c *Client) InlayHint(ctx context.Context, params protocol.InlayHintParams) ([]protocol.InlayHint, error) {
192	var result []protocol.InlayHint
193	err := c.Call(ctx, "textDocument/inlayHint", params, &result)
194	return result, err
195}
196
197// Resolve sends a inlayHint/resolve request to the LSP server.
198// A request to resolve additional properties for an inlay hint. The request's parameter is of type InlayHint, the response is of type InlayHint or a Thenable that resolves to such. Since 3.17.0
199func (c *Client) Resolve(ctx context.Context, params protocol.InlayHint) (protocol.InlayHint, error) {
200	var result protocol.InlayHint
201	err := c.Call(ctx, "inlayHint/resolve", params, &result)
202	return result, err
203}
204
205// Diagnostic sends a textDocument/diagnostic request to the LSP server.
206// The document diagnostic request definition. Since 3.17.0
207func (c *Client) Diagnostic(ctx context.Context, params protocol.DocumentDiagnosticParams) (protocol.DocumentDiagnosticReport, error) {
208	var result protocol.DocumentDiagnosticReport
209	err := c.Call(ctx, "textDocument/diagnostic", params, &result)
210	return result, err
211}
212
213// DiagnosticWorkspace sends a workspace/diagnostic request to the LSP server.
214// The workspace diagnostic request definition. Since 3.17.0
215func (c *Client) DiagnosticWorkspace(ctx context.Context, params protocol.WorkspaceDiagnosticParams) (protocol.WorkspaceDiagnosticReport, error) {
216	var result protocol.WorkspaceDiagnosticReport
217	err := c.Call(ctx, "workspace/diagnostic", params, &result)
218	return result, err
219}
220
221// InlineCompletion sends a textDocument/inlineCompletion request to the LSP server.
222// A request to provide inline completions in a document. The request's parameter is of type InlineCompletionParams, the response is of type InlineCompletion InlineCompletion[] or a Thenable that resolves to such. Since 3.18.0 PROPOSED
223func (c *Client) InlineCompletion(ctx context.Context, params protocol.InlineCompletionParams) (protocol.Or_Result_textDocument_inlineCompletion, error) {
224	var result protocol.Or_Result_textDocument_inlineCompletion
225	err := c.Call(ctx, "textDocument/inlineCompletion", params, &result)
226	return result, err
227}
228
229// TextDocumentContent sends a workspace/textDocumentContent request to the LSP server.
230// The workspace/textDocumentContent request is sent from the client to the server to request the content of a text document. Since 3.18.0 PROPOSED
231func (c *Client) TextDocumentContent(ctx context.Context, params protocol.TextDocumentContentParams) (string, error) {
232	var result string
233	err := c.Call(ctx, "workspace/textDocumentContent", params, &result)
234	return result, err
235}
236
237// Initialize sends a initialize request to the LSP server.
238// The initialize request is sent from the client to the server. It is sent once as the request after starting up the server. The requests parameter is of type InitializeParams the response if of type InitializeResult of a Thenable that resolves to such.
239func (c *Client) Initialize(ctx context.Context, params protocol.ParamInitialize) (protocol.InitializeResult, error) {
240	var result protocol.InitializeResult
241	err := c.Call(ctx, "initialize", params, &result)
242	return result, err
243}
244
245// Shutdown sends a shutdown request to the LSP server and cleans up resources.
246// A shutdown request is sent from the client to the server. It is sent once when the client decides to shutdown the server. The only notification that is sent after a shutdown request is the exit event.
247func (c *Client) Shutdown(ctx context.Context) error {
248	var shutdownErr error
249	c.shutdownOnce.Do(func() {
250		cfg := config.Get()
251
252		// Step 1: Send shutdown request (expects a response)
253		if cfg.Options.DebugLSP {
254			slog.Debug("Sending LSP shutdown request", "name", c.name)
255		}
256
257		shutdownCtx, cancel := context.WithTimeout(ctx, 2*time.Second)
258		defer cancel()
259
260		if err := c.Call(shutdownCtx, "shutdown", nil, nil); err != nil {
261			// Log but don't fail - server might already be shutting down
262			slog.Warn("LSP shutdown request failed", "name", c.name, "error", err)
263			shutdownErr = err
264		}
265
266		// Step 2: Send exit notification (no response expected)
267		if cfg.Options.DebugLSP {
268			slog.Debug("Sending LSP exit notification", "name", c.name)
269		}
270
271		if err := c.Notify(ctx, "exit", nil); err != nil {
272			slog.Warn("LSP exit notification failed", "name", c.name, "error", err)
273		}
274
275		// Step 3: Signal our goroutines to stop
276		close(c.shutdownChan)
277
278		// Step 4: Clean up resources
279		c.cleanupResources()
280
281		// Step 5: Wait for goroutines with timeout
282		done := make(chan struct{})
283		go func() {
284			<-c.stderrDone
285			<-c.messageHandlerDone
286			close(done)
287		}()
288
289		select {
290		case <-done:
291			if cfg.Options.DebugLSP {
292				slog.Debug("LSP goroutines stopped cleanly", "name", c.name)
293			}
294		case <-time.After(2 * time.Second):
295			slog.Warn("Timeout waiting for LSP goroutines", "name", c.name)
296		}
297	})
298	return shutdownErr
299}
300
301// cleanupResources closes all handlers and cleans up internal state
302func (c *Client) cleanupResources() {
303	// Close all pending request handlers
304	c.handlersMu.Lock()
305	for id, ch := range c.handlers {
306		close(ch)
307		delete(c.handlers, id)
308	}
309	c.handlersMu.Unlock()
310
311	// Clear pending requests tracking
312	c.pendingRequestsMu.Lock()
313	for id := range c.pendingRequests {
314		delete(c.pendingRequests, id)
315	}
316	c.pendingRequestsMu.Unlock()
317
318	// Clear open files
319	c.openFilesMu.Lock()
320	for uri := range c.openFiles {
321		delete(c.openFiles, uri)
322	}
323	c.openFilesMu.Unlock()
324
325	// Clear diagnostics
326	c.diagnosticsMu.Lock()
327	for uri := range c.diagnostics {
328		delete(c.diagnostics, uri)
329	}
330	c.diagnosticsMu.Unlock()
331}
332
333// WillSaveWaitUntil sends a textDocument/willSaveWaitUntil request to the LSP server.
334// A document will save request is sent from the client to the server before the document is actually saved. The request can return an array of TextEdits which will be applied to the text document before it is saved. Please note that clients might drop results if computing the text edits took too long or if a server constantly fails on this request. This is done to keep the save fast and reliable.
335func (c *Client) WillSaveWaitUntil(ctx context.Context, params protocol.WillSaveTextDocumentParams) ([]protocol.TextEdit, error) {
336	var result []protocol.TextEdit
337	err := c.Call(ctx, "textDocument/willSaveWaitUntil", params, &result)
338	return result, err
339}
340
341// Completion sends a textDocument/completion request to the LSP server.
342// Request to request completion at a given text document position. The request's parameter is of type TextDocumentPosition the response is of type CompletionItem CompletionItem[] or CompletionList or a Thenable that resolves to such. The request can delay the computation of the CompletionItem.detail detail and CompletionItem.documentation documentation properties to the completionItem/resolve request. However, properties that are needed for the initial sorting and filtering, like sortText, filterText, insertText, and textEdit, must not be changed during resolve.
343func (c *Client) Completion(ctx context.Context, params protocol.CompletionParams) (protocol.Or_Result_textDocument_completion, error) {
344	var result protocol.Or_Result_textDocument_completion
345	err := c.Call(ctx, "textDocument/completion", params, &result)
346	return result, err
347}
348
349// ResolveCompletionItem sends a completionItem/resolve request to the LSP server.
350// Request to resolve additional information for a given completion item.The request's parameter is of type CompletionItem the response is of type CompletionItem or a Thenable that resolves to such.
351func (c *Client) ResolveCompletionItem(ctx context.Context, params protocol.CompletionItem) (protocol.CompletionItem, error) {
352	var result protocol.CompletionItem
353	err := c.Call(ctx, "completionItem/resolve", params, &result)
354	return result, err
355}
356
357// Hover sends a textDocument/hover request to the LSP server.
358// Request to request hover information at a given text document position. The request's parameter is of type TextDocumentPosition the response is of type Hover or a Thenable that resolves to such.
359func (c *Client) Hover(ctx context.Context, params protocol.HoverParams) (protocol.Hover, error) {
360	var result protocol.Hover
361	err := c.Call(ctx, "textDocument/hover", params, &result)
362	return result, err
363}
364
365// SignatureHelp sends a textDocument/signatureHelp request to the LSP server.
366func (c *Client) SignatureHelp(ctx context.Context, params protocol.SignatureHelpParams) (protocol.SignatureHelp, error) {
367	var result protocol.SignatureHelp
368	err := c.Call(ctx, "textDocument/signatureHelp", params, &result)
369	return result, err
370}
371
372// Definition sends a textDocument/definition request to the LSP server.
373// A request to resolve the definition location of a symbol at a given text document position. The request's parameter is of type TextDocumentPosition the response is of either type Definition or a typed array of DefinitionLink or a Thenable that resolves to such.
374func (c *Client) Definition(ctx context.Context, params protocol.DefinitionParams) (protocol.Or_Result_textDocument_definition, error) {
375	var result protocol.Or_Result_textDocument_definition
376	err := c.Call(ctx, "textDocument/definition", params, &result)
377	return result, err
378}
379
380// References sends a textDocument/references request to the LSP server.
381// A request to resolve project-wide references for the symbol denoted by the given text document position. The request's parameter is of type ReferenceParams the response is of type Location Location[] or a Thenable that resolves to such.
382func (c *Client) References(ctx context.Context, params protocol.ReferenceParams) ([]protocol.Location, error) {
383	var result []protocol.Location
384	err := c.Call(ctx, "textDocument/references", params, &result)
385	return result, err
386}
387
388// DocumentHighlight sends a textDocument/documentHighlight request to the LSP server.
389// Request to resolve a DocumentHighlight for a given text document position. The request's parameter is of type TextDocumentPosition the request response is an array of type DocumentHighlight or a Thenable that resolves to such.
390func (c *Client) DocumentHighlight(ctx context.Context, params protocol.DocumentHighlightParams) ([]protocol.DocumentHighlight, error) {
391	var result []protocol.DocumentHighlight
392	err := c.Call(ctx, "textDocument/documentHighlight", params, &result)
393	return result, err
394}
395
396// DocumentSymbol sends a textDocument/documentSymbol request to the LSP server.
397// A request to list all symbols found in a given text document. The request's parameter is of type TextDocumentIdentifier the response is of type SymbolInformation SymbolInformation[] or a Thenable that resolves to such.
398func (c *Client) DocumentSymbol(ctx context.Context, params protocol.DocumentSymbolParams) (protocol.Or_Result_textDocument_documentSymbol, error) {
399	var result protocol.Or_Result_textDocument_documentSymbol
400	err := c.Call(ctx, "textDocument/documentSymbol", params, &result)
401	return result, err
402}
403
404// CodeAction sends a textDocument/codeAction request to the LSP server.
405// A request to provide commands for the given text document and range.
406func (c *Client) CodeAction(ctx context.Context, params protocol.CodeActionParams) ([]protocol.Or_Result_textDocument_codeAction_Item0_Elem, error) {
407	var result []protocol.Or_Result_textDocument_codeAction_Item0_Elem
408	err := c.Call(ctx, "textDocument/codeAction", params, &result)
409	return result, err
410}
411
412// ResolveCodeAction sends a codeAction/resolve request to the LSP server.
413// Request to resolve additional information for a given code action.The request's parameter is of type CodeAction the response is of type CodeAction or a Thenable that resolves to such.
414func (c *Client) ResolveCodeAction(ctx context.Context, params protocol.CodeAction) (protocol.CodeAction, error) {
415	var result protocol.CodeAction
416	err := c.Call(ctx, "codeAction/resolve", params, &result)
417	return result, err
418}
419
420// Symbol sends a workspace/symbol request to the LSP server.
421// A request to list project-wide symbols matching the query string given by the WorkspaceSymbolParams. The response is of type SymbolInformation SymbolInformation[] or a Thenable that resolves to such. Since 3.17.0 - support for WorkspaceSymbol in the returned data. Clients need to advertise support for WorkspaceSymbols via the client capability workspace.symbol.resolveSupport.
422func (c *Client) Symbol(ctx context.Context, params protocol.WorkspaceSymbolParams) (protocol.Or_Result_workspace_symbol, error) {
423	var result protocol.Or_Result_workspace_symbol
424	err := c.Call(ctx, "workspace/symbol", params, &result)
425	return result, err
426}
427
428// ResolveWorkspaceSymbol sends a workspaceSymbol/resolve request to the LSP server.
429// A request to resolve the range inside the workspace symbol's location. Since 3.17.0
430func (c *Client) ResolveWorkspaceSymbol(ctx context.Context, params protocol.WorkspaceSymbol) (protocol.WorkspaceSymbol, error) {
431	var result protocol.WorkspaceSymbol
432	err := c.Call(ctx, "workspaceSymbol/resolve", params, &result)
433	return result, err
434}
435
436// CodeLens sends a textDocument/codeLens request to the LSP server.
437// A request to provide code lens for the given text document.
438func (c *Client) CodeLens(ctx context.Context, params protocol.CodeLensParams) ([]protocol.CodeLens, error) {
439	var result []protocol.CodeLens
440	err := c.Call(ctx, "textDocument/codeLens", params, &result)
441	return result, err
442}
443
444// ResolveCodeLens sends a codeLens/resolve request to the LSP server.
445// A request to resolve a command for a given code lens.
446func (c *Client) ResolveCodeLens(ctx context.Context, params protocol.CodeLens) (protocol.CodeLens, error) {
447	var result protocol.CodeLens
448	err := c.Call(ctx, "codeLens/resolve", params, &result)
449	return result, err
450}
451
452// DocumentLink sends a textDocument/documentLink request to the LSP server.
453// A request to provide document links
454func (c *Client) DocumentLink(ctx context.Context, params protocol.DocumentLinkParams) ([]protocol.DocumentLink, error) {
455	var result []protocol.DocumentLink
456	err := c.Call(ctx, "textDocument/documentLink", params, &result)
457	return result, err
458}
459
460// ResolveDocumentLink sends a documentLink/resolve request to the LSP server.
461// Request to resolve additional information for a given document link. The request's parameter is of type DocumentLink the response is of type DocumentLink or a Thenable that resolves to such.
462func (c *Client) ResolveDocumentLink(ctx context.Context, params protocol.DocumentLink) (protocol.DocumentLink, error) {
463	var result protocol.DocumentLink
464	err := c.Call(ctx, "documentLink/resolve", params, &result)
465	return result, err
466}
467
468// Formatting sends a textDocument/formatting request to the LSP server.
469// A request to format a whole document.
470func (c *Client) Formatting(ctx context.Context, params protocol.DocumentFormattingParams) ([]protocol.TextEdit, error) {
471	var result []protocol.TextEdit
472	err := c.Call(ctx, "textDocument/formatting", params, &result)
473	return result, err
474}
475
476// RangeFormatting sends a textDocument/rangeFormatting request to the LSP server.
477// A request to format a range in a document.
478func (c *Client) RangeFormatting(ctx context.Context, params protocol.DocumentRangeFormattingParams) ([]protocol.TextEdit, error) {
479	var result []protocol.TextEdit
480	err := c.Call(ctx, "textDocument/rangeFormatting", params, &result)
481	return result, err
482}
483
484// RangesFormatting sends a textDocument/rangesFormatting request to the LSP server.
485// A request to format ranges in a document. Since 3.18.0 PROPOSED
486func (c *Client) RangesFormatting(ctx context.Context, params protocol.DocumentRangesFormattingParams) ([]protocol.TextEdit, error) {
487	var result []protocol.TextEdit
488	err := c.Call(ctx, "textDocument/rangesFormatting", params, &result)
489	return result, err
490}
491
492// OnTypeFormatting sends a textDocument/onTypeFormatting request to the LSP server.
493// A request to format a document on type.
494func (c *Client) OnTypeFormatting(ctx context.Context, params protocol.DocumentOnTypeFormattingParams) ([]protocol.TextEdit, error) {
495	var result []protocol.TextEdit
496	err := c.Call(ctx, "textDocument/onTypeFormatting", params, &result)
497	return result, err
498}
499
500// Rename sends a textDocument/rename request to the LSP server.
501// A request to rename a symbol.
502func (c *Client) Rename(ctx context.Context, params protocol.RenameParams) (protocol.WorkspaceEdit, error) {
503	var result protocol.WorkspaceEdit
504	err := c.Call(ctx, "textDocument/rename", params, &result)
505	return result, err
506}
507
508// PrepareRename sends a textDocument/prepareRename request to the LSP server.
509// A request to test and perform the setup necessary for a rename. Since 3.16 - support for default behavior
510func (c *Client) PrepareRename(ctx context.Context, params protocol.PrepareRenameParams) (protocol.PrepareRenameResult, error) {
511	var result protocol.PrepareRenameResult
512	err := c.Call(ctx, "textDocument/prepareRename", params, &result)
513	return result, err
514}
515
516// ExecuteCommand sends a workspace/executeCommand request to the LSP server.
517// A request send from the client to the server to execute a command. The request might return a workspace edit which the client will apply to the workspace.
518func (c *Client) ExecuteCommand(ctx context.Context, params protocol.ExecuteCommandParams) (any, error) {
519	var result any
520	err := c.Call(ctx, "workspace/executeCommand", params, &result)
521	return result, err
522}
523
524// DidChangeWorkspaceFolders sends a workspace/didChangeWorkspaceFolders notification to the LSP server.
525// The workspace/didChangeWorkspaceFolders notification is sent from the client to the server when the workspace folder configuration changes.
526func (c *Client) DidChangeWorkspaceFolders(ctx context.Context, params protocol.DidChangeWorkspaceFoldersParams) error {
527	return c.Notify(ctx, "workspace/didChangeWorkspaceFolders", params)
528}
529
530// WorkDoneProgressCancel sends a window/workDoneProgress/cancel notification to the LSP server.
531// The window/workDoneProgress/cancel notification is sent from  the client to the server to cancel a progress initiated on the server side.
532func (c *Client) WorkDoneProgressCancel(ctx context.Context, params protocol.WorkDoneProgressCancelParams) error {
533	return c.Notify(ctx, "window/workDoneProgress/cancel", params)
534}
535
536// DidCreateFiles sends a workspace/didCreateFiles notification to the LSP server.
537// The did create files notification is sent from the client to the server when files were created from within the client. Since 3.16.0
538func (c *Client) DidCreateFiles(ctx context.Context, params protocol.CreateFilesParams) error {
539	return c.Notify(ctx, "workspace/didCreateFiles", params)
540}
541
542// DidRenameFiles sends a workspace/didRenameFiles notification to the LSP server.
543// The did rename files notification is sent from the client to the server when files were renamed from within the client. Since 3.16.0
544func (c *Client) DidRenameFiles(ctx context.Context, params protocol.RenameFilesParams) error {
545	return c.Notify(ctx, "workspace/didRenameFiles", params)
546}
547
548// DidDeleteFiles sends a workspace/didDeleteFiles notification to the LSP server.
549// The will delete files request is sent from the client to the server before files are actually deleted as long as the deletion is triggered from within the client. Since 3.16.0
550func (c *Client) DidDeleteFiles(ctx context.Context, params protocol.DeleteFilesParams) error {
551	return c.Notify(ctx, "workspace/didDeleteFiles", params)
552}
553
554// DidOpenNotebookDocument sends a notebookDocument/didOpen notification to the LSP server.
555// A notification sent when a notebook opens. Since 3.17.0
556func (c *Client) DidOpenNotebookDocument(ctx context.Context, params protocol.DidOpenNotebookDocumentParams) error {
557	return c.Notify(ctx, "notebookDocument/didOpen", params)
558}
559
560// DidChangeNotebookDocument sends a notebookDocument/didChange notification to the LSP server.
561func (c *Client) DidChangeNotebookDocument(ctx context.Context, params protocol.DidChangeNotebookDocumentParams) error {
562	return c.Notify(ctx, "notebookDocument/didChange", params)
563}
564
565// DidSaveNotebookDocument sends a notebookDocument/didSave notification to the LSP server.
566// A notification sent when a notebook document is saved. Since 3.17.0
567func (c *Client) DidSaveNotebookDocument(ctx context.Context, params protocol.DidSaveNotebookDocumentParams) error {
568	return c.Notify(ctx, "notebookDocument/didSave", params)
569}
570
571// DidCloseNotebookDocument sends a notebookDocument/didClose notification to the LSP server.
572// A notification sent when a notebook closes. Since 3.17.0
573func (c *Client) DidCloseNotebookDocument(ctx context.Context, params protocol.DidCloseNotebookDocumentParams) error {
574	return c.Notify(ctx, "notebookDocument/didClose", params)
575}
576
577// Initialized sends a initialized notification to the LSP server.
578// The initialized notification is sent from the client to the server after the client is fully initialized and the server is allowed to send requests from the server to the client.
579func (c *Client) Initialized(ctx context.Context, params protocol.InitializedParams) error {
580	return c.Notify(ctx, "initialized", params)
581}
582
583// Exit sends a exit notification to the LSP server.
584// The exit event is sent from the client to the server to ask the server to exit its process.
585func (c *Client) Exit(ctx context.Context) error {
586	return c.Notify(ctx, "exit", nil)
587}
588
589// DidChangeConfiguration sends a workspace/didChangeConfiguration notification to the LSP server.
590// The configuration change notification is sent from the client to the server when the client's configuration has changed. The notification contains the changed configuration as defined by the language client.
591func (c *Client) DidChangeConfiguration(ctx context.Context, params protocol.DidChangeConfigurationParams) error {
592	return c.Notify(ctx, "workspace/didChangeConfiguration", params)
593}
594
595// DidOpen sends a textDocument/didOpen notification to the LSP server.
596// The document open notification is sent from the client to the server to signal newly opened text documents. The document's truth is now managed by the client and the server must not try to read the document's truth using the document's uri. Open in this sense means it is managed by the client. It doesn't necessarily mean that its content is presented in an editor. An open notification must not be sent more than once without a corresponding close notification send before. This means open and close notification must be balanced and the max open count is one.
597func (c *Client) DidOpen(ctx context.Context, params protocol.DidOpenTextDocumentParams) error {
598	return c.Notify(ctx, "textDocument/didOpen", params)
599}
600
601// DidChange sends a textDocument/didChange notification to the LSP server.
602// The document change notification is sent from the client to the server to signal changes to a text document.
603func (c *Client) DidChange(ctx context.Context, params protocol.DidChangeTextDocumentParams) error {
604	return c.Notify(ctx, "textDocument/didChange", params)
605}
606
607// DidClose sends a textDocument/didClose notification to the LSP server.
608// The document close notification is sent from the client to the server when the document got closed in the client. The document's truth now exists where the document's uri points to (e.g. if the document's uri is a file uri the truth now exists on disk). As with the open notification the close notification is about managing the document's content. Receiving a close notification doesn't mean that the document was open in an editor before. A close notification requires a previous open notification to be sent.
609func (c *Client) DidClose(ctx context.Context, params protocol.DidCloseTextDocumentParams) error {
610	return c.Notify(ctx, "textDocument/didClose", params)
611}
612
613// DidSave sends a textDocument/didSave notification to the LSP server.
614// The document save notification is sent from the client to the server when the document got saved in the client.
615func (c *Client) DidSave(ctx context.Context, params protocol.DidSaveTextDocumentParams) error {
616	return c.Notify(ctx, "textDocument/didSave", params)
617}
618
619// WillSave sends a textDocument/willSave notification to the LSP server.
620// A document will save notification is sent from the client to the server before the document is actually saved.
621func (c *Client) WillSave(ctx context.Context, params protocol.WillSaveTextDocumentParams) error {
622	return c.Notify(ctx, "textDocument/willSave", params)
623}
624
625// DidChangeWatchedFiles sends a workspace/didChangeWatchedFiles notification to the LSP server.
626// The watched files notification is sent from the client to the server when the client detects changes to file watched by the language client.
627func (c *Client) DidChangeWatchedFiles(ctx context.Context, params protocol.DidChangeWatchedFilesParams) error {
628	return c.Notify(ctx, "workspace/didChangeWatchedFiles", params)
629}
630
631// SetTrace sends a $/setTrace notification to the LSP server.
632func (c *Client) SetTrace(ctx context.Context, params protocol.SetTraceParams) error {
633	return c.Notify(ctx, "$/setTrace", params)
634}
635
636// Progress sends a $/progress notification to the LSP server.
637func (c *Client) Progress(ctx context.Context, params protocol.ProgressParams) error {
638	return c.Notify(ctx, "$/progress", params)
639}