1// Generated code. Do not edit
  2package lsp
  3
  4import (
  5	"context"
  6	"log/slog"
  7	"time"
  8
  9	"github.com/charmbracelet/crush/internal/lsp/protocol"
 10)
 11
 12// Implementation sends a textDocument/implementation request to the LSP server.
 13// 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.
 14func (c *Client) Implementation(ctx context.Context, params protocol.ImplementationParams) (protocol.Or_Result_textDocument_implementation, error) {
 15	var result protocol.Or_Result_textDocument_implementation
 16	err := c.Call(ctx, "textDocument/implementation", params, &result)
 17	return result, err
 18}
 19
 20// TypeDefinition sends a textDocument/typeDefinition request to the LSP server.
 21// 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.
 22func (c *Client) TypeDefinition(ctx context.Context, params protocol.TypeDefinitionParams) (protocol.Or_Result_textDocument_typeDefinition, error) {
 23	var result protocol.Or_Result_textDocument_typeDefinition
 24	err := c.Call(ctx, "textDocument/typeDefinition", params, &result)
 25	return result, err
 26}
 27
 28// DocumentColor sends a textDocument/documentColor request to the LSP server.
 29// 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.
 30func (c *Client) DocumentColor(ctx context.Context, params protocol.DocumentColorParams) ([]protocol.ColorInformation, error) {
 31	var result []protocol.ColorInformation
 32	err := c.Call(ctx, "textDocument/documentColor", params, &result)
 33	return result, err
 34}
 35
 36// ColorPresentation sends a textDocument/colorPresentation request to the LSP server.
 37// 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.
 38func (c *Client) ColorPresentation(ctx context.Context, params protocol.ColorPresentationParams) ([]protocol.ColorPresentation, error) {
 39	var result []protocol.ColorPresentation
 40	err := c.Call(ctx, "textDocument/colorPresentation", params, &result)
 41	return result, err
 42}
 43
 44// FoldingRange sends a textDocument/foldingRange request to the LSP server.
 45// 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.
 46func (c *Client) FoldingRange(ctx context.Context, params protocol.FoldingRangeParams) ([]protocol.FoldingRange, error) {
 47	var result []protocol.FoldingRange
 48	err := c.Call(ctx, "textDocument/foldingRange", params, &result)
 49	return result, err
 50}
 51
 52// Declaration sends a textDocument/declaration request to the LSP server.
 53// 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.
 54func (c *Client) Declaration(ctx context.Context, params protocol.DeclarationParams) (protocol.Or_Result_textDocument_declaration, error) {
 55	var result protocol.Or_Result_textDocument_declaration
 56	err := c.Call(ctx, "textDocument/declaration", params, &result)
 57	return result, err
 58}
 59
 60// SelectionRange sends a textDocument/selectionRange request to the LSP server.
 61// 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.
 62func (c *Client) SelectionRange(ctx context.Context, params protocol.SelectionRangeParams) ([]protocol.SelectionRange, error) {
 63	var result []protocol.SelectionRange
 64	err := c.Call(ctx, "textDocument/selectionRange", params, &result)
 65	return result, err
 66}
 67
 68// PrepareCallHierarchy sends a textDocument/prepareCallHierarchy request to the LSP server.
 69// 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
 70func (c *Client) PrepareCallHierarchy(ctx context.Context, params protocol.CallHierarchyPrepareParams) ([]protocol.CallHierarchyItem, error) {
 71	var result []protocol.CallHierarchyItem
 72	err := c.Call(ctx, "textDocument/prepareCallHierarchy", params, &result)
 73	return result, err
 74}
 75
 76// IncomingCalls sends a callHierarchy/incomingCalls request to the LSP server.
 77// A request to resolve the incoming calls for a given CallHierarchyItem. Since 3.16.0
 78func (c *Client) IncomingCalls(ctx context.Context, params protocol.CallHierarchyIncomingCallsParams) ([]protocol.CallHierarchyIncomingCall, error) {
 79	var result []protocol.CallHierarchyIncomingCall
 80	err := c.Call(ctx, "callHierarchy/incomingCalls", params, &result)
 81	return result, err
 82}
 83
 84// OutgoingCalls sends a callHierarchy/outgoingCalls request to the LSP server.
 85// A request to resolve the outgoing calls for a given CallHierarchyItem. Since 3.16.0
 86func (c *Client) OutgoingCalls(ctx context.Context, params protocol.CallHierarchyOutgoingCallsParams) ([]protocol.CallHierarchyOutgoingCall, error) {
 87	var result []protocol.CallHierarchyOutgoingCall
 88	err := c.Call(ctx, "callHierarchy/outgoingCalls", params, &result)
 89	return result, err
 90}
 91
 92// SemanticTokensFull sends a textDocument/semanticTokens/full request to the LSP server.
 93// Since 3.16.0
 94func (c *Client) SemanticTokensFull(ctx context.Context, params protocol.SemanticTokensParams) (protocol.SemanticTokens, error) {
 95	var result protocol.SemanticTokens
 96	err := c.Call(ctx, "textDocument/semanticTokens/full", params, &result)
 97	return result, err
 98}
 99
100// SemanticTokensFullDelta sends a textDocument/semanticTokens/full/delta request to the LSP server.
101// Since 3.16.0
102func (c *Client) SemanticTokensFullDelta(ctx context.Context, params protocol.SemanticTokensDeltaParams) (protocol.Or_Result_textDocument_semanticTokens_full_delta, error) {
103	var result protocol.Or_Result_textDocument_semanticTokens_full_delta
104	err := c.Call(ctx, "textDocument/semanticTokens/full/delta", params, &result)
105	return result, err
106}
107
108// SemanticTokensRange sends a textDocument/semanticTokens/range request to the LSP server.
109// Since 3.16.0
110func (c *Client) SemanticTokensRange(ctx context.Context, params protocol.SemanticTokensRangeParams) (protocol.SemanticTokens, error) {
111	var result protocol.SemanticTokens
112	err := c.Call(ctx, "textDocument/semanticTokens/range", params, &result)
113	return result, err
114}
115
116// LinkedEditingRange sends a textDocument/linkedEditingRange request to the LSP server.
117// A request to provide ranges that can be edited together. Since 3.16.0
118func (c *Client) LinkedEditingRange(ctx context.Context, params protocol.LinkedEditingRangeParams) (protocol.LinkedEditingRanges, error) {
119	var result protocol.LinkedEditingRanges
120	err := c.Call(ctx, "textDocument/linkedEditingRange", params, &result)
121	return result, err
122}
123
124// WillCreateFiles sends a workspace/willCreateFiles request to the LSP server.
125// 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
126func (c *Client) WillCreateFiles(ctx context.Context, params protocol.CreateFilesParams) (protocol.WorkspaceEdit, error) {
127	var result protocol.WorkspaceEdit
128	err := c.Call(ctx, "workspace/willCreateFiles", params, &result)
129	return result, err
130}
131
132// WillRenameFiles sends a workspace/willRenameFiles request to the LSP server.
133// 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
134func (c *Client) WillRenameFiles(ctx context.Context, params protocol.RenameFilesParams) (protocol.WorkspaceEdit, error) {
135	var result protocol.WorkspaceEdit
136	err := c.Call(ctx, "workspace/willRenameFiles", params, &result)
137	return result, err
138}
139
140// WillDeleteFiles sends a workspace/willDeleteFiles request to the LSP server.
141// 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
142func (c *Client) WillDeleteFiles(ctx context.Context, params protocol.DeleteFilesParams) (protocol.WorkspaceEdit, error) {
143	var result protocol.WorkspaceEdit
144	err := c.Call(ctx, "workspace/willDeleteFiles", params, &result)
145	return result, err
146}
147
148// Moniker sends a textDocument/moniker request to the LSP server.
149// 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.
150func (c *Client) Moniker(ctx context.Context, params protocol.MonikerParams) ([]protocol.Moniker, error) {
151	var result []protocol.Moniker
152	err := c.Call(ctx, "textDocument/moniker", params, &result)
153	return result, err
154}
155
156// PrepareTypeHierarchy sends a textDocument/prepareTypeHierarchy request to the LSP server.
157// 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
158func (c *Client) PrepareTypeHierarchy(ctx context.Context, params protocol.TypeHierarchyPrepareParams) ([]protocol.TypeHierarchyItem, error) {
159	var result []protocol.TypeHierarchyItem
160	err := c.Call(ctx, "textDocument/prepareTypeHierarchy", params, &result)
161	return result, err
162}
163
164// Supertypes sends a typeHierarchy/supertypes request to the LSP server.
165// A request to resolve the supertypes for a given TypeHierarchyItem. Since 3.17.0
166func (c *Client) Supertypes(ctx context.Context, params protocol.TypeHierarchySupertypesParams) ([]protocol.TypeHierarchyItem, error) {
167	var result []protocol.TypeHierarchyItem
168	err := c.Call(ctx, "typeHierarchy/supertypes", params, &result)
169	return result, err
170}
171
172// Subtypes sends a typeHierarchy/subtypes request to the LSP server.
173// A request to resolve the subtypes for a given TypeHierarchyItem. Since 3.17.0
174func (c *Client) Subtypes(ctx context.Context, params protocol.TypeHierarchySubtypesParams) ([]protocol.TypeHierarchyItem, error) {
175	var result []protocol.TypeHierarchyItem
176	err := c.Call(ctx, "typeHierarchy/subtypes", params, &result)
177	return result, err
178}
179
180// InlineValue sends a textDocument/inlineValue request to the LSP server.
181// 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
182func (c *Client) InlineValue(ctx context.Context, params protocol.InlineValueParams) ([]protocol.InlineValue, error) {
183	var result []protocol.InlineValue
184	err := c.Call(ctx, "textDocument/inlineValue", params, &result)
185	return result, err
186}
187
188// InlayHint sends a textDocument/inlayHint request to the LSP server.
189// 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
190func (c *Client) InlayHint(ctx context.Context, params protocol.InlayHintParams) ([]protocol.InlayHint, error) {
191	var result []protocol.InlayHint
192	err := c.Call(ctx, "textDocument/inlayHint", params, &result)
193	return result, err
194}
195
196// Resolve sends a inlayHint/resolve request to the LSP server.
197// 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
198func (c *Client) Resolve(ctx context.Context, params protocol.InlayHint) (protocol.InlayHint, error) {
199	var result protocol.InlayHint
200	err := c.Call(ctx, "inlayHint/resolve", params, &result)
201	return result, err
202}
203
204// Diagnostic sends a textDocument/diagnostic request to the LSP server.
205// The document diagnostic request definition. Since 3.17.0
206func (c *Client) Diagnostic(ctx context.Context, params protocol.DocumentDiagnosticParams) (protocol.DocumentDiagnosticReport, error) {
207	var result protocol.DocumentDiagnosticReport
208	err := c.Call(ctx, "textDocument/diagnostic", params, &result)
209	return result, err
210}
211
212// DiagnosticWorkspace sends a workspace/diagnostic request to the LSP server.
213// The workspace diagnostic request definition. Since 3.17.0
214func (c *Client) DiagnosticWorkspace(ctx context.Context, params protocol.WorkspaceDiagnosticParams) (protocol.WorkspaceDiagnosticReport, error) {
215	var result protocol.WorkspaceDiagnosticReport
216	err := c.Call(ctx, "workspace/diagnostic", params, &result)
217	return result, err
218}
219
220// InlineCompletion sends a textDocument/inlineCompletion request to the LSP server.
221// 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
222func (c *Client) InlineCompletion(ctx context.Context, params protocol.InlineCompletionParams) (protocol.Or_Result_textDocument_inlineCompletion, error) {
223	var result protocol.Or_Result_textDocument_inlineCompletion
224	err := c.Call(ctx, "textDocument/inlineCompletion", params, &result)
225	return result, err
226}
227
228// TextDocumentContent sends a workspace/textDocumentContent request to the LSP server.
229// 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
230func (c *Client) TextDocumentContent(ctx context.Context, params protocol.TextDocumentContentParams) (string, error) {
231	var result string
232	err := c.Call(ctx, "workspace/textDocumentContent", params, &result)
233	return result, err
234}
235
236// Initialize sends a initialize request to the LSP server.
237// 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.
238func (c *Client) Initialize(ctx context.Context, params protocol.ParamInitialize) (protocol.InitializeResult, error) {
239	var result protocol.InitializeResult
240	err := c.Call(ctx, "initialize", params, &result)
241	return result, err
242}
243
244// Shutdown sends a shutdown request to the LSP server and cleans up resources.
245// 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.
246func (c *Client) Shutdown(ctx context.Context) error {
247	var shutdownErr error
248	c.shutdownOnce.Do(func() {
249		// Signal shutdown to goroutines
250		close(c.shutdownChan)
251
252		// Send shutdown request to server
253		shutdownErr = c.Call(ctx, "shutdown", nil, nil)
254
255		// Clean up handlers map to prevent memory leaks
256		c.handlersMu.Lock()
257		for id, ch := range c.handlers {
258			close(ch)
259			delete(c.handlers, id)
260		}
261		c.handlersMu.Unlock()
262
263		// Clean up open files map
264		c.openFilesMu.Lock()
265		for uri := range c.openFiles {
266			delete(c.openFiles, uri)
267		}
268		c.openFilesMu.Unlock()
269
270		// Clean up diagnostics map
271		c.diagnosticsMu.Lock()
272		for uri := range c.diagnostics {
273			delete(c.diagnostics, uri)
274		}
275		c.diagnosticsMu.Unlock()
276
277		// Wait for goroutines to finish with timeout
278		done := make(chan struct{})
279		go func() {
280			<-c.stderrDone
281			<-c.messageHandlerDone
282			close(done)
283		}()
284
285		select {
286		case <-done:
287			// Goroutines finished cleanly
288		case <-time.After(2 * time.Second):
289			// Timeout waiting for goroutines
290			slog.Warn("Timeout waiting for LSP goroutines to finish", "name", c.name)
291		}
292	})
293	return shutdownErr
294}
295
296// WillSaveWaitUntil sends a textDocument/willSaveWaitUntil request to the LSP server.
297// 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.
298func (c *Client) WillSaveWaitUntil(ctx context.Context, params protocol.WillSaveTextDocumentParams) ([]protocol.TextEdit, error) {
299	var result []protocol.TextEdit
300	err := c.Call(ctx, "textDocument/willSaveWaitUntil", params, &result)
301	return result, err
302}
303
304// Completion sends a textDocument/completion request to the LSP server.
305// 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.
306func (c *Client) Completion(ctx context.Context, params protocol.CompletionParams) (protocol.Or_Result_textDocument_completion, error) {
307	var result protocol.Or_Result_textDocument_completion
308	err := c.Call(ctx, "textDocument/completion", params, &result)
309	return result, err
310}
311
312// ResolveCompletionItem sends a completionItem/resolve request to the LSP server.
313// 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.
314func (c *Client) ResolveCompletionItem(ctx context.Context, params protocol.CompletionItem) (protocol.CompletionItem, error) {
315	var result protocol.CompletionItem
316	err := c.Call(ctx, "completionItem/resolve", params, &result)
317	return result, err
318}
319
320// Hover sends a textDocument/hover request to the LSP server.
321// 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.
322func (c *Client) Hover(ctx context.Context, params protocol.HoverParams) (protocol.Hover, error) {
323	var result protocol.Hover
324	err := c.Call(ctx, "textDocument/hover", params, &result)
325	return result, err
326}
327
328// SignatureHelp sends a textDocument/signatureHelp request to the LSP server.
329func (c *Client) SignatureHelp(ctx context.Context, params protocol.SignatureHelpParams) (protocol.SignatureHelp, error) {
330	var result protocol.SignatureHelp
331	err := c.Call(ctx, "textDocument/signatureHelp", params, &result)
332	return result, err
333}
334
335// Definition sends a textDocument/definition request to the LSP server.
336// 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.
337func (c *Client) Definition(ctx context.Context, params protocol.DefinitionParams) (protocol.Or_Result_textDocument_definition, error) {
338	var result protocol.Or_Result_textDocument_definition
339	err := c.Call(ctx, "textDocument/definition", params, &result)
340	return result, err
341}
342
343// References sends a textDocument/references request to the LSP server.
344// 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.
345func (c *Client) References(ctx context.Context, params protocol.ReferenceParams) ([]protocol.Location, error) {
346	var result []protocol.Location
347	err := c.Call(ctx, "textDocument/references", params, &result)
348	return result, err
349}
350
351// DocumentHighlight sends a textDocument/documentHighlight request to the LSP server.
352// 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.
353func (c *Client) DocumentHighlight(ctx context.Context, params protocol.DocumentHighlightParams) ([]protocol.DocumentHighlight, error) {
354	var result []protocol.DocumentHighlight
355	err := c.Call(ctx, "textDocument/documentHighlight", params, &result)
356	return result, err
357}
358
359// DocumentSymbol sends a textDocument/documentSymbol request to the LSP server.
360// 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.
361func (c *Client) DocumentSymbol(ctx context.Context, params protocol.DocumentSymbolParams) (protocol.Or_Result_textDocument_documentSymbol, error) {
362	var result protocol.Or_Result_textDocument_documentSymbol
363	err := c.Call(ctx, "textDocument/documentSymbol", params, &result)
364	return result, err
365}
366
367// CodeAction sends a textDocument/codeAction request to the LSP server.
368// A request to provide commands for the given text document and range.
369func (c *Client) CodeAction(ctx context.Context, params protocol.CodeActionParams) ([]protocol.Or_Result_textDocument_codeAction_Item0_Elem, error) {
370	var result []protocol.Or_Result_textDocument_codeAction_Item0_Elem
371	err := c.Call(ctx, "textDocument/codeAction", params, &result)
372	return result, err
373}
374
375// ResolveCodeAction sends a codeAction/resolve request to the LSP server.
376// 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.
377func (c *Client) ResolveCodeAction(ctx context.Context, params protocol.CodeAction) (protocol.CodeAction, error) {
378	var result protocol.CodeAction
379	err := c.Call(ctx, "codeAction/resolve", params, &result)
380	return result, err
381}
382
383// Symbol sends a workspace/symbol request to the LSP server.
384// 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.
385func (c *Client) Symbol(ctx context.Context, params protocol.WorkspaceSymbolParams) (protocol.Or_Result_workspace_symbol, error) {
386	var result protocol.Or_Result_workspace_symbol
387	err := c.Call(ctx, "workspace/symbol", params, &result)
388	return result, err
389}
390
391// ResolveWorkspaceSymbol sends a workspaceSymbol/resolve request to the LSP server.
392// A request to resolve the range inside the workspace symbol's location. Since 3.17.0
393func (c *Client) ResolveWorkspaceSymbol(ctx context.Context, params protocol.WorkspaceSymbol) (protocol.WorkspaceSymbol, error) {
394	var result protocol.WorkspaceSymbol
395	err := c.Call(ctx, "workspaceSymbol/resolve", params, &result)
396	return result, err
397}
398
399// CodeLens sends a textDocument/codeLens request to the LSP server.
400// A request to provide code lens for the given text document.
401func (c *Client) CodeLens(ctx context.Context, params protocol.CodeLensParams) ([]protocol.CodeLens, error) {
402	var result []protocol.CodeLens
403	err := c.Call(ctx, "textDocument/codeLens", params, &result)
404	return result, err
405}
406
407// ResolveCodeLens sends a codeLens/resolve request to the LSP server.
408// A request to resolve a command for a given code lens.
409func (c *Client) ResolveCodeLens(ctx context.Context, params protocol.CodeLens) (protocol.CodeLens, error) {
410	var result protocol.CodeLens
411	err := c.Call(ctx, "codeLens/resolve", params, &result)
412	return result, err
413}
414
415// DocumentLink sends a textDocument/documentLink request to the LSP server.
416// A request to provide document links
417func (c *Client) DocumentLink(ctx context.Context, params protocol.DocumentLinkParams) ([]protocol.DocumentLink, error) {
418	var result []protocol.DocumentLink
419	err := c.Call(ctx, "textDocument/documentLink", params, &result)
420	return result, err
421}
422
423// ResolveDocumentLink sends a documentLink/resolve request to the LSP server.
424// 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.
425func (c *Client) ResolveDocumentLink(ctx context.Context, params protocol.DocumentLink) (protocol.DocumentLink, error) {
426	var result protocol.DocumentLink
427	err := c.Call(ctx, "documentLink/resolve", params, &result)
428	return result, err
429}
430
431// Formatting sends a textDocument/formatting request to the LSP server.
432// A request to format a whole document.
433func (c *Client) Formatting(ctx context.Context, params protocol.DocumentFormattingParams) ([]protocol.TextEdit, error) {
434	var result []protocol.TextEdit
435	err := c.Call(ctx, "textDocument/formatting", params, &result)
436	return result, err
437}
438
439// RangeFormatting sends a textDocument/rangeFormatting request to the LSP server.
440// A request to format a range in a document.
441func (c *Client) RangeFormatting(ctx context.Context, params protocol.DocumentRangeFormattingParams) ([]protocol.TextEdit, error) {
442	var result []protocol.TextEdit
443	err := c.Call(ctx, "textDocument/rangeFormatting", params, &result)
444	return result, err
445}
446
447// RangesFormatting sends a textDocument/rangesFormatting request to the LSP server.
448// A request to format ranges in a document. Since 3.18.0 PROPOSED
449func (c *Client) RangesFormatting(ctx context.Context, params protocol.DocumentRangesFormattingParams) ([]protocol.TextEdit, error) {
450	var result []protocol.TextEdit
451	err := c.Call(ctx, "textDocument/rangesFormatting", params, &result)
452	return result, err
453}
454
455// OnTypeFormatting sends a textDocument/onTypeFormatting request to the LSP server.
456// A request to format a document on type.
457func (c *Client) OnTypeFormatting(ctx context.Context, params protocol.DocumentOnTypeFormattingParams) ([]protocol.TextEdit, error) {
458	var result []protocol.TextEdit
459	err := c.Call(ctx, "textDocument/onTypeFormatting", params, &result)
460	return result, err
461}
462
463// Rename sends a textDocument/rename request to the LSP server.
464// A request to rename a symbol.
465func (c *Client) Rename(ctx context.Context, params protocol.RenameParams) (protocol.WorkspaceEdit, error) {
466	var result protocol.WorkspaceEdit
467	err := c.Call(ctx, "textDocument/rename", params, &result)
468	return result, err
469}
470
471// PrepareRename sends a textDocument/prepareRename request to the LSP server.
472// A request to test and perform the setup necessary for a rename. Since 3.16 - support for default behavior
473func (c *Client) PrepareRename(ctx context.Context, params protocol.PrepareRenameParams) (protocol.PrepareRenameResult, error) {
474	var result protocol.PrepareRenameResult
475	err := c.Call(ctx, "textDocument/prepareRename", params, &result)
476	return result, err
477}
478
479// ExecuteCommand sends a workspace/executeCommand request to the LSP server.
480// 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.
481func (c *Client) ExecuteCommand(ctx context.Context, params protocol.ExecuteCommandParams) (any, error) {
482	var result any
483	err := c.Call(ctx, "workspace/executeCommand", params, &result)
484	return result, err
485}
486
487// DidChangeWorkspaceFolders sends a workspace/didChangeWorkspaceFolders notification to the LSP server.
488// The workspace/didChangeWorkspaceFolders notification is sent from the client to the server when the workspace folder configuration changes.
489func (c *Client) DidChangeWorkspaceFolders(ctx context.Context, params protocol.DidChangeWorkspaceFoldersParams) error {
490	return c.Notify(ctx, "workspace/didChangeWorkspaceFolders", params)
491}
492
493// WorkDoneProgressCancel sends a window/workDoneProgress/cancel notification to the LSP server.
494// The window/workDoneProgress/cancel notification is sent from  the client to the server to cancel a progress initiated on the server side.
495func (c *Client) WorkDoneProgressCancel(ctx context.Context, params protocol.WorkDoneProgressCancelParams) error {
496	return c.Notify(ctx, "window/workDoneProgress/cancel", params)
497}
498
499// DidCreateFiles sends a workspace/didCreateFiles notification to the LSP server.
500// 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
501func (c *Client) DidCreateFiles(ctx context.Context, params protocol.CreateFilesParams) error {
502	return c.Notify(ctx, "workspace/didCreateFiles", params)
503}
504
505// DidRenameFiles sends a workspace/didRenameFiles notification to the LSP server.
506// 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
507func (c *Client) DidRenameFiles(ctx context.Context, params protocol.RenameFilesParams) error {
508	return c.Notify(ctx, "workspace/didRenameFiles", params)
509}
510
511// DidDeleteFiles sends a workspace/didDeleteFiles notification to the LSP server.
512// 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
513func (c *Client) DidDeleteFiles(ctx context.Context, params protocol.DeleteFilesParams) error {
514	return c.Notify(ctx, "workspace/didDeleteFiles", params)
515}
516
517// DidOpenNotebookDocument sends a notebookDocument/didOpen notification to the LSP server.
518// A notification sent when a notebook opens. Since 3.17.0
519func (c *Client) DidOpenNotebookDocument(ctx context.Context, params protocol.DidOpenNotebookDocumentParams) error {
520	return c.Notify(ctx, "notebookDocument/didOpen", params)
521}
522
523// DidChangeNotebookDocument sends a notebookDocument/didChange notification to the LSP server.
524func (c *Client) DidChangeNotebookDocument(ctx context.Context, params protocol.DidChangeNotebookDocumentParams) error {
525	return c.Notify(ctx, "notebookDocument/didChange", params)
526}
527
528// DidSaveNotebookDocument sends a notebookDocument/didSave notification to the LSP server.
529// A notification sent when a notebook document is saved. Since 3.17.0
530func (c *Client) DidSaveNotebookDocument(ctx context.Context, params protocol.DidSaveNotebookDocumentParams) error {
531	return c.Notify(ctx, "notebookDocument/didSave", params)
532}
533
534// DidCloseNotebookDocument sends a notebookDocument/didClose notification to the LSP server.
535// A notification sent when a notebook closes. Since 3.17.0
536func (c *Client) DidCloseNotebookDocument(ctx context.Context, params protocol.DidCloseNotebookDocumentParams) error {
537	return c.Notify(ctx, "notebookDocument/didClose", params)
538}
539
540// Initialized sends a initialized notification to the LSP server.
541// 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.
542func (c *Client) Initialized(ctx context.Context, params protocol.InitializedParams) error {
543	return c.Notify(ctx, "initialized", params)
544}
545
546// Exit sends a exit notification to the LSP server.
547// The exit event is sent from the client to the server to ask the server to exit its process.
548func (c *Client) Exit(ctx context.Context) error {
549	return c.Notify(ctx, "exit", nil)
550}
551
552// DidChangeConfiguration sends a workspace/didChangeConfiguration notification to the LSP server.
553// 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.
554func (c *Client) DidChangeConfiguration(ctx context.Context, params protocol.DidChangeConfigurationParams) error {
555	return c.Notify(ctx, "workspace/didChangeConfiguration", params)
556}
557
558// DidOpen sends a textDocument/didOpen notification to the LSP server.
559// 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.
560func (c *Client) DidOpen(ctx context.Context, params protocol.DidOpenTextDocumentParams) error {
561	return c.Notify(ctx, "textDocument/didOpen", params)
562}
563
564// DidChange sends a textDocument/didChange notification to the LSP server.
565// The document change notification is sent from the client to the server to signal changes to a text document.
566func (c *Client) DidChange(ctx context.Context, params protocol.DidChangeTextDocumentParams) error {
567	return c.Notify(ctx, "textDocument/didChange", params)
568}
569
570// DidClose sends a textDocument/didClose notification to the LSP server.
571// 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.
572func (c *Client) DidClose(ctx context.Context, params protocol.DidCloseTextDocumentParams) error {
573	return c.Notify(ctx, "textDocument/didClose", params)
574}
575
576// DidSave sends a textDocument/didSave notification to the LSP server.
577// The document save notification is sent from the client to the server when the document got saved in the client.
578func (c *Client) DidSave(ctx context.Context, params protocol.DidSaveTextDocumentParams) error {
579	return c.Notify(ctx, "textDocument/didSave", params)
580}
581
582// WillSave sends a textDocument/willSave notification to the LSP server.
583// A document will save notification is sent from the client to the server before the document is actually saved.
584func (c *Client) WillSave(ctx context.Context, params protocol.WillSaveTextDocumentParams) error {
585	return c.Notify(ctx, "textDocument/willSave", params)
586}
587
588// DidChangeWatchedFiles sends a workspace/didChangeWatchedFiles notification to the LSP server.
589// The watched files notification is sent from the client to the server when the client detects changes to file watched by the language client.
590func (c *Client) DidChangeWatchedFiles(ctx context.Context, params protocol.DidChangeWatchedFilesParams) error {
591	return c.Notify(ctx, "workspace/didChangeWatchedFiles", params)
592}
593
594// SetTrace sends a $/setTrace notification to the LSP server.
595func (c *Client) SetTrace(ctx context.Context, params protocol.SetTraceParams) error {
596	return c.Notify(ctx, "$/setTrace", params)
597}
598
599// Progress sends a $/progress notification to the LSP server.
600func (c *Client) Progress(ctx context.Context, params protocol.ProgressParams) error {
601	return c.Notify(ctx, "$/progress", params)
602}