methods.go 34 KB

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