| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
package protocol |
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
import ( |
| 14 |
"context" |
| 15 |
"encoding/json" |
| 16 |
"fmt" |
| 17 |
|
| 18 |
"golang.org/x/tools/internal/jsonrpc2" |
| 19 |
) |
| 20 |
|
| 21 |
type Server interface { |
| 22 |
|
| 23 |
Progress(context.Context, *ProgressParams) error |
| 24 |
|
| 25 |
SetTrace(context.Context, *SetTraceParams) error |
| 26 |
|
| 27 |
IncomingCalls(context.Context, *CallHierarchyIncomingCallsParams) ([]CallHierarchyIncomingCall, error) |
| 28 |
|
| 29 |
OutgoingCalls(context.Context, *CallHierarchyOutgoingCallsParams) ([]CallHierarchyOutgoingCall, error) |
| 30 |
|
| 31 |
ResolveCodeAction(context.Context, *CodeAction) (*CodeAction, error) |
| 32 |
|
| 33 |
ResolveCodeLens(context.Context, *CodeLens) (*CodeLens, error) |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
ResolveCommand(context.Context, *ExecuteCommandParams) (*ExecuteCommandParams, error) |
| 53 |
|
| 54 |
ResolveCompletionItem(context.Context, *CompletionItem) (*CompletionItem, error) |
| 55 |
|
| 56 |
ResolveDocumentLink(context.Context, *DocumentLink) (*DocumentLink, error) |
| 57 |
|
| 58 |
Exit(context.Context) error |
| 59 |
|
| 60 |
Initialize(context.Context, *ParamInitialize) (*InitializeResult, error) |
| 61 |
|
| 62 |
Initialized(context.Context, *InitializedParams) error |
| 63 |
|
| 64 |
Resolve(context.Context, *InlayHint) (*InlayHint, error) |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
InteractiveListEnum(context.Context, *InteractiveListEnumParams) ([]FormEnumEntry, error) |
| 75 |
|
| 76 |
DidChangeNotebookDocument(context.Context, *DidChangeNotebookDocumentParams) error |
| 77 |
|
| 78 |
DidCloseNotebookDocument(context.Context, *DidCloseNotebookDocumentParams) error |
| 79 |
|
| 80 |
DidOpenNotebookDocument(context.Context, *DidOpenNotebookDocumentParams) error |
| 81 |
|
| 82 |
DidSaveNotebookDocument(context.Context, *DidSaveNotebookDocumentParams) error |
| 83 |
|
| 84 |
Shutdown(context.Context) error |
| 85 |
|
| 86 |
CodeAction(context.Context, *CodeActionParams) ([]CodeAction, error) |
| 87 |
|
| 88 |
CodeLens(context.Context, *CodeLensParams) ([]CodeLens, error) |
| 89 |
|
| 90 |
ColorPresentation(context.Context, *ColorPresentationParams) ([]ColorPresentation, error) |
| 91 |
|
| 92 |
Completion(context.Context, *CompletionParams) (*CompletionList, error) |
| 93 |
|
| 94 |
Declaration(context.Context, *DeclarationParams) (*Or_textDocument_declaration, error) |
| 95 |
|
| 96 |
Definition(context.Context, *DefinitionParams) ([]Location, error) |
| 97 |
|
| 98 |
Diagnostic(context.Context, *DocumentDiagnosticParams) (*DocumentDiagnosticReport, error) |
| 99 |
|
| 100 |
DidChange(context.Context, *DidChangeTextDocumentParams) error |
| 101 |
|
| 102 |
DidClose(context.Context, *DidCloseTextDocumentParams) error |
| 103 |
|
| 104 |
DidOpen(context.Context, *DidOpenTextDocumentParams) error |
| 105 |
|
| 106 |
DidSave(context.Context, *DidSaveTextDocumentParams) error |
| 107 |
|
| 108 |
DocumentColor(context.Context, *DocumentColorParams) ([]ColorInformation, error) |
| 109 |
|
| 110 |
DocumentHighlight(context.Context, *DocumentHighlightParams) ([]DocumentHighlight, error) |
| 111 |
|
| 112 |
DocumentLink(context.Context, *DocumentLinkParams) ([]DocumentLink, error) |
| 113 |
|
| 114 |
DocumentSymbol(context.Context, *DocumentSymbolParams) ([]any, error) |
| 115 |
|
| 116 |
FoldingRange(context.Context, *FoldingRangeParams) ([]FoldingRange, error) |
| 117 |
|
| 118 |
Formatting(context.Context, *DocumentFormattingParams) ([]TextEdit, error) |
| 119 |
|
| 120 |
Hover(context.Context, *HoverParams) (*Hover, error) |
| 121 |
|
| 122 |
Implementation(context.Context, *ImplementationParams) ([]Location, error) |
| 123 |
|
| 124 |
InlayHint(context.Context, *InlayHintParams) ([]InlayHint, error) |
| 125 |
|
| 126 |
InlineCompletion(context.Context, *InlineCompletionParams) (*Or_Result_textDocument_inlineCompletion, error) |
| 127 |
|
| 128 |
InlineValue(context.Context, *InlineValueParams) ([]InlineValue, error) |
| 129 |
|
| 130 |
LinkedEditingRange(context.Context, *LinkedEditingRangeParams) (*LinkedEditingRanges, error) |
| 131 |
|
| 132 |
Moniker(context.Context, *MonikerParams) ([]Moniker, error) |
| 133 |
|
| 134 |
OnTypeFormatting(context.Context, *DocumentOnTypeFormattingParams) ([]TextEdit, error) |
| 135 |
|
| 136 |
PrepareCallHierarchy(context.Context, *CallHierarchyPrepareParams) ([]CallHierarchyItem, error) |
| 137 |
|
| 138 |
PrepareRename(context.Context, *PrepareRenameParams) (*PrepareRenameResult, error) |
| 139 |
|
| 140 |
PrepareTypeHierarchy(context.Context, *TypeHierarchyPrepareParams) ([]TypeHierarchyItem, error) |
| 141 |
|
| 142 |
RangeFormatting(context.Context, *DocumentRangeFormattingParams) ([]TextEdit, error) |
| 143 |
|
| 144 |
RangesFormatting(context.Context, *DocumentRangesFormattingParams) ([]TextEdit, error) |
| 145 |
|
| 146 |
References(context.Context, *ReferenceParams) ([]Location, error) |
| 147 |
|
| 148 |
Rename(context.Context, *RenameParams) (*WorkspaceEdit, error) |
| 149 |
|
| 150 |
SelectionRange(context.Context, *SelectionRangeParams) ([]SelectionRange, error) |
| 151 |
|
| 152 |
SemanticTokensFull(context.Context, *SemanticTokensParams) (*SemanticTokens, error) |
| 153 |
|
| 154 |
SemanticTokensFullDelta(context.Context, *SemanticTokensDeltaParams) (any, error) |
| 155 |
|
| 156 |
SemanticTokensRange(context.Context, *SemanticTokensRangeParams) (*SemanticTokens, error) |
| 157 |
|
| 158 |
SignatureHelp(context.Context, *SignatureHelpParams) (*SignatureHelp, error) |
| 159 |
|
| 160 |
TypeDefinition(context.Context, *TypeDefinitionParams) ([]Location, error) |
| 161 |
|
| 162 |
WillSave(context.Context, *WillSaveTextDocumentParams) error |
| 163 |
|
| 164 |
WillSaveWaitUntil(context.Context, *WillSaveTextDocumentParams) ([]TextEdit, error) |
| 165 |
|
| 166 |
Subtypes(context.Context, *TypeHierarchySubtypesParams) ([]TypeHierarchyItem, error) |
| 167 |
|
| 168 |
Supertypes(context.Context, *TypeHierarchySupertypesParams) ([]TypeHierarchyItem, error) |
| 169 |
|
| 170 |
WorkDoneProgressCancel(context.Context, *WorkDoneProgressCancelParams) error |
| 171 |
|
| 172 |
DiagnosticWorkspace(context.Context, *WorkspaceDiagnosticParams) (*WorkspaceDiagnosticReport, error) |
| 173 |
|
| 174 |
DidChangeConfiguration(context.Context, *DidChangeConfigurationParams) error |
| 175 |
|
| 176 |
DidChangeWatchedFiles(context.Context, *DidChangeWatchedFilesParams) error |
| 177 |
|
| 178 |
DidChangeWorkspaceFolders(context.Context, *DidChangeWorkspaceFoldersParams) error |
| 179 |
|
| 180 |
DidCreateFiles(context.Context, *CreateFilesParams) error |
| 181 |
|
| 182 |
DidDeleteFiles(context.Context, *DeleteFilesParams) error |
| 183 |
|
| 184 |
DidRenameFiles(context.Context, *RenameFilesParams) error |
| 185 |
|
| 186 |
ExecuteCommand(context.Context, *ExecuteCommandParams) (any, error) |
| 187 |
|
| 188 |
Symbol(context.Context, *WorkspaceSymbolParams) ([]SymbolInformation, error) |
| 189 |
|
| 190 |
TextDocumentContent(context.Context, *TextDocumentContentParams) (*TextDocumentContentResult, error) |
| 191 |
|
| 192 |
WillCreateFiles(context.Context, *CreateFilesParams) (*WorkspaceEdit, error) |
| 193 |
|
| 194 |
WillDeleteFiles(context.Context, *DeleteFilesParams) (*WorkspaceEdit, error) |
| 195 |
|
| 196 |
WillRenameFiles(context.Context, *RenameFilesParams) (*WorkspaceEdit, error) |
| 197 |
|
| 198 |
ResolveWorkspaceSymbol(context.Context, *WorkspaceSymbol) (*WorkspaceSymbol, error) |
| 199 |
} |
| 200 |
|
| 201 |
func serverDispatch(ctx context.Context, server Server, reply jsonrpc2.Replier, r jsonrpc2.Request) (bool, error) { |
| 202 |
resp, valid, err := ServerDispatchCall(ctx, server, r.Method(), r.Params()) |
| 203 |
if !valid { |
| 204 |
return false, nil |
| 205 |
} |
| 206 |
|
| 207 |
if err != nil { |
| 208 |
return valid, reply(ctx, nil, err) |
| 209 |
} else { |
| 210 |
return valid, reply(ctx, resp, nil) |
| 211 |
} |
| 212 |
} |
| 213 |
|
| 214 |
func ServerDispatchCall(ctx context.Context, server Server, method string, raw json.RawMessage) (resp any, _ bool, err error) { |
| 215 |
switch method { |
| 216 |
case "$/progress": |
| 217 |
var params ProgressParams |
| 218 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 219 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 220 |
} |
| 221 |
err := server.Progress(ctx, ¶ms) |
| 222 |
return nil, true, err |
| 223 |
|
| 224 |
case "$/setTrace": |
| 225 |
var params SetTraceParams |
| 226 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 227 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 228 |
} |
| 229 |
err := server.SetTrace(ctx, ¶ms) |
| 230 |
return nil, true, err |
| 231 |
|
| 232 |
case "callHierarchy/incomingCalls": |
| 233 |
var params CallHierarchyIncomingCallsParams |
| 234 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 235 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 236 |
} |
| 237 |
resp, err := server.IncomingCalls(ctx, ¶ms) |
| 238 |
if err != nil { |
| 239 |
return nil, true, err |
| 240 |
} |
| 241 |
return resp, true, nil |
| 242 |
|
| 243 |
case "callHierarchy/outgoingCalls": |
| 244 |
var params CallHierarchyOutgoingCallsParams |
| 245 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 246 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 247 |
} |
| 248 |
resp, err := server.OutgoingCalls(ctx, ¶ms) |
| 249 |
if err != nil { |
| 250 |
return nil, true, err |
| 251 |
} |
| 252 |
return resp, true, nil |
| 253 |
|
| 254 |
case "codeAction/resolve": |
| 255 |
var params CodeAction |
| 256 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 257 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 258 |
} |
| 259 |
resp, err := server.ResolveCodeAction(ctx, ¶ms) |
| 260 |
if err != nil { |
| 261 |
return nil, true, err |
| 262 |
} |
| 263 |
return resp, true, nil |
| 264 |
|
| 265 |
case "codeLens/resolve": |
| 266 |
var params CodeLens |
| 267 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 268 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 269 |
} |
| 270 |
resp, err := server.ResolveCodeLens(ctx, ¶ms) |
| 271 |
if err != nil { |
| 272 |
return nil, true, err |
| 273 |
} |
| 274 |
return resp, true, nil |
| 275 |
|
| 276 |
case "command/resolve": |
| 277 |
var params ExecuteCommandParams |
| 278 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 279 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 280 |
} |
| 281 |
resp, err := server.ResolveCommand(ctx, ¶ms) |
| 282 |
if err != nil { |
| 283 |
return nil, true, err |
| 284 |
} |
| 285 |
return resp, true, nil |
| 286 |
|
| 287 |
case "completionItem/resolve": |
| 288 |
var params CompletionItem |
| 289 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 290 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 291 |
} |
| 292 |
resp, err := server.ResolveCompletionItem(ctx, ¶ms) |
| 293 |
if err != nil { |
| 294 |
return nil, true, err |
| 295 |
} |
| 296 |
return resp, true, nil |
| 297 |
|
| 298 |
case "documentLink/resolve": |
| 299 |
var params DocumentLink |
| 300 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 301 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 302 |
} |
| 303 |
resp, err := server.ResolveDocumentLink(ctx, ¶ms) |
| 304 |
if err != nil { |
| 305 |
return nil, true, err |
| 306 |
} |
| 307 |
return resp, true, nil |
| 308 |
|
| 309 |
case "exit": |
| 310 |
err := server.Exit(ctx) |
| 311 |
return nil, true, err |
| 312 |
|
| 313 |
case "initialize": |
| 314 |
var params ParamInitialize |
| 315 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 316 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 317 |
} |
| 318 |
resp, err := server.Initialize(ctx, ¶ms) |
| 319 |
if err != nil { |
| 320 |
return nil, true, err |
| 321 |
} |
| 322 |
return resp, true, nil |
| 323 |
|
| 324 |
case "initialized": |
| 325 |
var params InitializedParams |
| 326 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 327 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 328 |
} |
| 329 |
err := server.Initialized(ctx, ¶ms) |
| 330 |
return nil, true, err |
| 331 |
|
| 332 |
case "inlayHint/resolve": |
| 333 |
var params InlayHint |
| 334 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 335 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 336 |
} |
| 337 |
resp, err := server.Resolve(ctx, ¶ms) |
| 338 |
if err != nil { |
| 339 |
return nil, true, err |
| 340 |
} |
| 341 |
return resp, true, nil |
| 342 |
|
| 343 |
case "interactive/listEnum": |
| 344 |
var params InteractiveListEnumParams |
| 345 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 346 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 347 |
} |
| 348 |
resp, err := server.InteractiveListEnum(ctx, ¶ms) |
| 349 |
if err != nil { |
| 350 |
return nil, true, err |
| 351 |
} |
| 352 |
return resp, true, nil |
| 353 |
|
| 354 |
case "notebookDocument/didChange": |
| 355 |
var params DidChangeNotebookDocumentParams |
| 356 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 357 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 358 |
} |
| 359 |
err := server.DidChangeNotebookDocument(ctx, ¶ms) |
| 360 |
return nil, true, err |
| 361 |
|
| 362 |
case "notebookDocument/didClose": |
| 363 |
var params DidCloseNotebookDocumentParams |
| 364 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 365 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 366 |
} |
| 367 |
err := server.DidCloseNotebookDocument(ctx, ¶ms) |
| 368 |
return nil, true, err |
| 369 |
|
| 370 |
case "notebookDocument/didOpen": |
| 371 |
var params DidOpenNotebookDocumentParams |
| 372 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 373 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 374 |
} |
| 375 |
err := server.DidOpenNotebookDocument(ctx, ¶ms) |
| 376 |
return nil, true, err |
| 377 |
|
| 378 |
case "notebookDocument/didSave": |
| 379 |
var params DidSaveNotebookDocumentParams |
| 380 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 381 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 382 |
} |
| 383 |
err := server.DidSaveNotebookDocument(ctx, ¶ms) |
| 384 |
return nil, true, err |
| 385 |
|
| 386 |
case "shutdown": |
| 387 |
err := server.Shutdown(ctx) |
| 388 |
return nil, true, err |
| 389 |
|
| 390 |
case "textDocument/codeAction": |
| 391 |
var params CodeActionParams |
| 392 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 393 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 394 |
} |
| 395 |
resp, err := server.CodeAction(ctx, ¶ms) |
| 396 |
if err != nil { |
| 397 |
return nil, true, err |
| 398 |
} |
| 399 |
return resp, true, nil |
| 400 |
|
| 401 |
case "textDocument/codeLens": |
| 402 |
var params CodeLensParams |
| 403 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 404 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 405 |
} |
| 406 |
resp, err := server.CodeLens(ctx, ¶ms) |
| 407 |
if err != nil { |
| 408 |
return nil, true, err |
| 409 |
} |
| 410 |
return resp, true, nil |
| 411 |
|
| 412 |
case "textDocument/colorPresentation": |
| 413 |
var params ColorPresentationParams |
| 414 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 415 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 416 |
} |
| 417 |
resp, err := server.ColorPresentation(ctx, ¶ms) |
| 418 |
if err != nil { |
| 419 |
return nil, true, err |
| 420 |
} |
| 421 |
return resp, true, nil |
| 422 |
|
| 423 |
case "textDocument/completion": |
| 424 |
var params CompletionParams |
| 425 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 426 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 427 |
} |
| 428 |
if params.Range == (Range{}) { |
| 429 |
params.Range = Range{ |
| 430 |
Start: params.Position, |
| 431 |
End: params.Position, |
| 432 |
} |
| 433 |
} else if !params.Range.Contains(params.Position) { |
| 434 |
return nil, true, fmt.Errorf("position %v is outside the provided range %v.", params.Position, params.Range) |
| 435 |
} |
| 436 |
resp, err := server.Completion(ctx, ¶ms) |
| 437 |
if err != nil { |
| 438 |
return nil, true, err |
| 439 |
} |
| 440 |
return resp, true, nil |
| 441 |
|
| 442 |
case "textDocument/declaration": |
| 443 |
var params DeclarationParams |
| 444 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 445 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 446 |
} |
| 447 |
if params.Range == (Range{}) { |
| 448 |
params.Range = Range{ |
| 449 |
Start: params.Position, |
| 450 |
End: params.Position, |
| 451 |
} |
| 452 |
} else if !params.Range.Contains(params.Position) { |
| 453 |
return nil, true, fmt.Errorf("position %v is outside the provided range %v.", params.Position, params.Range) |
| 454 |
} |
| 455 |
resp, err := server.Declaration(ctx, ¶ms) |
| 456 |
if err != nil { |
| 457 |
return nil, true, err |
| 458 |
} |
| 459 |
return resp, true, nil |
| 460 |
|
| 461 |
case "textDocument/definition": |
| 462 |
var params DefinitionParams |
| 463 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 464 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 465 |
} |
| 466 |
if params.Range == (Range{}) { |
| 467 |
params.Range = Range{ |
| 468 |
Start: params.Position, |
| 469 |
End: params.Position, |
| 470 |
} |
| 471 |
} else if !params.Range.Contains(params.Position) { |
| 472 |
return nil, true, fmt.Errorf("position %v is outside the provided range %v.", params.Position, params.Range) |
| 473 |
} |
| 474 |
resp, err := server.Definition(ctx, ¶ms) |
| 475 |
if err != nil { |
| 476 |
return nil, true, err |
| 477 |
} |
| 478 |
return resp, true, nil |
| 479 |
|
| 480 |
case "textDocument/diagnostic": |
| 481 |
var params DocumentDiagnosticParams |
| 482 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 483 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 484 |
} |
| 485 |
resp, err := server.Diagnostic(ctx, ¶ms) |
| 486 |
if err != nil { |
| 487 |
return nil, true, err |
| 488 |
} |
| 489 |
return resp, true, nil |
| 490 |
|
| 491 |
case "textDocument/didChange": |
| 492 |
var params DidChangeTextDocumentParams |
| 493 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 494 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 495 |
} |
| 496 |
err := server.DidChange(ctx, ¶ms) |
| 497 |
return nil, true, err |
| 498 |
|
| 499 |
case "textDocument/didClose": |
| 500 |
var params DidCloseTextDocumentParams |
| 501 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 502 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 503 |
} |
| 504 |
err := server.DidClose(ctx, ¶ms) |
| 505 |
return nil, true, err |
| 506 |
|
| 507 |
case "textDocument/didOpen": |
| 508 |
var params DidOpenTextDocumentParams |
| 509 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 510 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 511 |
} |
| 512 |
err := server.DidOpen(ctx, ¶ms) |
| 513 |
return nil, true, err |
| 514 |
|
| 515 |
case "textDocument/didSave": |
| 516 |
var params DidSaveTextDocumentParams |
| 517 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 518 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 519 |
} |
| 520 |
err := server.DidSave(ctx, ¶ms) |
| 521 |
return nil, true, err |
| 522 |
|
| 523 |
case "textDocument/documentColor": |
| 524 |
var params DocumentColorParams |
| 525 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 526 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 527 |
} |
| 528 |
resp, err := server.DocumentColor(ctx, ¶ms) |
| 529 |
if err != nil { |
| 530 |
return nil, true, err |
| 531 |
} |
| 532 |
return resp, true, nil |
| 533 |
|
| 534 |
case "textDocument/documentHighlight": |
| 535 |
var params DocumentHighlightParams |
| 536 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 537 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 538 |
} |
| 539 |
if params.Range == (Range{}) { |
| 540 |
params.Range = Range{ |
| 541 |
Start: params.Position, |
| 542 |
End: params.Position, |
| 543 |
} |
| 544 |
} else if !params.Range.Contains(params.Position) { |
| 545 |
return nil, true, fmt.Errorf("position %v is outside the provided range %v.", params.Position, params.Range) |
| 546 |
} |
| 547 |
resp, err := server.DocumentHighlight(ctx, ¶ms) |
| 548 |
if err != nil { |
| 549 |
return nil, true, err |
| 550 |
} |
| 551 |
return resp, true, nil |
| 552 |
|
| 553 |
case "textDocument/documentLink": |
| 554 |
var params DocumentLinkParams |
| 555 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 556 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 557 |
} |
| 558 |
resp, err := server.DocumentLink(ctx, ¶ms) |
| 559 |
if err != nil { |
| 560 |
return nil, true, err |
| 561 |
} |
| 562 |
return resp, true, nil |
| 563 |
|
| 564 |
case "textDocument/documentSymbol": |
| 565 |
var params DocumentSymbolParams |
| 566 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 567 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 568 |
} |
| 569 |
resp, err := server.DocumentSymbol(ctx, ¶ms) |
| 570 |
if err != nil { |
| 571 |
return nil, true, err |
| 572 |
} |
| 573 |
return resp, true, nil |
| 574 |
|
| 575 |
case "textDocument/foldingRange": |
| 576 |
var params FoldingRangeParams |
| 577 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 578 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 579 |
} |
| 580 |
resp, err := server.FoldingRange(ctx, ¶ms) |
| 581 |
if err != nil { |
| 582 |
return nil, true, err |
| 583 |
} |
| 584 |
return resp, true, nil |
| 585 |
|
| 586 |
case "textDocument/formatting": |
| 587 |
var params DocumentFormattingParams |
| 588 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 589 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 590 |
} |
| 591 |
resp, err := server.Formatting(ctx, ¶ms) |
| 592 |
if err != nil { |
| 593 |
return nil, true, err |
| 594 |
} |
| 595 |
return resp, true, nil |
| 596 |
|
| 597 |
case "textDocument/hover": |
| 598 |
var params HoverParams |
| 599 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 600 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 601 |
} |
| 602 |
if params.Range == (Range{}) { |
| 603 |
params.Range = Range{ |
| 604 |
Start: params.Position, |
| 605 |
End: params.Position, |
| 606 |
} |
| 607 |
} else if !params.Range.Contains(params.Position) { |
| 608 |
return nil, true, fmt.Errorf("position %v is outside the provided range %v.", params.Position, params.Range) |
| 609 |
} |
| 610 |
resp, err := server.Hover(ctx, ¶ms) |
| 611 |
if err != nil { |
| 612 |
return nil, true, err |
| 613 |
} |
| 614 |
return resp, true, nil |
| 615 |
|
| 616 |
case "textDocument/implementation": |
| 617 |
var params ImplementationParams |
| 618 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 619 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 620 |
} |
| 621 |
if params.Range == (Range{}) { |
| 622 |
params.Range = Range{ |
| 623 |
Start: params.Position, |
| 624 |
End: params.Position, |
| 625 |
} |
| 626 |
} else if !params.Range.Contains(params.Position) { |
| 627 |
return nil, true, fmt.Errorf("position %v is outside the provided range %v.", params.Position, params.Range) |
| 628 |
} |
| 629 |
resp, err := server.Implementation(ctx, ¶ms) |
| 630 |
if err != nil { |
| 631 |
return nil, true, err |
| 632 |
} |
| 633 |
return resp, true, nil |
| 634 |
|
| 635 |
case "textDocument/inlayHint": |
| 636 |
var params InlayHintParams |
| 637 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 638 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 639 |
} |
| 640 |
resp, err := server.InlayHint(ctx, ¶ms) |
| 641 |
if err != nil { |
| 642 |
return nil, true, err |
| 643 |
} |
| 644 |
return resp, true, nil |
| 645 |
|
| 646 |
case "textDocument/inlineCompletion": |
| 647 |
var params InlineCompletionParams |
| 648 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 649 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 650 |
} |
| 651 |
if params.Range == (Range{}) { |
| 652 |
params.Range = Range{ |
| 653 |
Start: params.Position, |
| 654 |
End: params.Position, |
| 655 |
} |
| 656 |
} else if !params.Range.Contains(params.Position) { |
| 657 |
return nil, true, fmt.Errorf("position %v is outside the provided range %v.", params.Position, params.Range) |
| 658 |
} |
| 659 |
resp, err := server.InlineCompletion(ctx, ¶ms) |
| 660 |
if err != nil { |
| 661 |
return nil, true, err |
| 662 |
} |
| 663 |
return resp, true, nil |
| 664 |
|
| 665 |
case "textDocument/inlineValue": |
| 666 |
var params InlineValueParams |
| 667 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 668 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 669 |
} |
| 670 |
resp, err := server.InlineValue(ctx, ¶ms) |
| 671 |
if err != nil { |
| 672 |
return nil, true, err |
| 673 |
} |
| 674 |
return resp, true, nil |
| 675 |
|
| 676 |
case "textDocument/linkedEditingRange": |
| 677 |
var params LinkedEditingRangeParams |
| 678 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 679 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 680 |
} |
| 681 |
if params.Range == (Range{}) { |
| 682 |
params.Range = Range{ |
| 683 |
Start: params.Position, |
| 684 |
End: params.Position, |
| 685 |
} |
| 686 |
} else if !params.Range.Contains(params.Position) { |
| 687 |
return nil, true, fmt.Errorf("position %v is outside the provided range %v.", params.Position, params.Range) |
| 688 |
} |
| 689 |
resp, err := server.LinkedEditingRange(ctx, ¶ms) |
| 690 |
if err != nil { |
| 691 |
return nil, true, err |
| 692 |
} |
| 693 |
return resp, true, nil |
| 694 |
|
| 695 |
case "textDocument/moniker": |
| 696 |
var params MonikerParams |
| 697 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 698 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 699 |
} |
| 700 |
if params.Range == (Range{}) { |
| 701 |
params.Range = Range{ |
| 702 |
Start: params.Position, |
| 703 |
End: params.Position, |
| 704 |
} |
| 705 |
} else if !params.Range.Contains(params.Position) { |
| 706 |
return nil, true, fmt.Errorf("position %v is outside the provided range %v.", params.Position, params.Range) |
| 707 |
} |
| 708 |
resp, err := server.Moniker(ctx, ¶ms) |
| 709 |
if err != nil { |
| 710 |
return nil, true, err |
| 711 |
} |
| 712 |
return resp, true, nil |
| 713 |
|
| 714 |
case "textDocument/onTypeFormatting": |
| 715 |
var params DocumentOnTypeFormattingParams |
| 716 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 717 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 718 |
} |
| 719 |
resp, err := server.OnTypeFormatting(ctx, ¶ms) |
| 720 |
if err != nil { |
| 721 |
return nil, true, err |
| 722 |
} |
| 723 |
return resp, true, nil |
| 724 |
|
| 725 |
case "textDocument/prepareCallHierarchy": |
| 726 |
var params CallHierarchyPrepareParams |
| 727 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 728 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 729 |
} |
| 730 |
if params.Range == (Range{}) { |
| 731 |
params.Range = Range{ |
| 732 |
Start: params.Position, |
| 733 |
End: params.Position, |
| 734 |
} |
| 735 |
} else if !params.Range.Contains(params.Position) { |
| 736 |
return nil, true, fmt.Errorf("position %v is outside the provided range %v.", params.Position, params.Range) |
| 737 |
} |
| 738 |
resp, err := server.PrepareCallHierarchy(ctx, ¶ms) |
| 739 |
if err != nil { |
| 740 |
return nil, true, err |
| 741 |
} |
| 742 |
return resp, true, nil |
| 743 |
|
| 744 |
case "textDocument/prepareRename": |
| 745 |
var params PrepareRenameParams |
| 746 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 747 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 748 |
} |
| 749 |
if params.Range == (Range{}) { |
| 750 |
params.Range = Range{ |
| 751 |
Start: params.Position, |
| 752 |
End: params.Position, |
| 753 |
} |
| 754 |
} else if !params.Range.Contains(params.Position) { |
| 755 |
return nil, true, fmt.Errorf("position %v is outside the provided range %v.", params.Position, params.Range) |
| 756 |
} |
| 757 |
resp, err := server.PrepareRename(ctx, ¶ms) |
| 758 |
if err != nil { |
| 759 |
return nil, true, err |
| 760 |
} |
| 761 |
return resp, true, nil |
| 762 |
|
| 763 |
case "textDocument/prepareTypeHierarchy": |
| 764 |
var params TypeHierarchyPrepareParams |
| 765 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 766 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 767 |
} |
| 768 |
if params.Range == (Range{}) { |
| 769 |
params.Range = Range{ |
| 770 |
Start: params.Position, |
| 771 |
End: params.Position, |
| 772 |
} |
| 773 |
} else if !params.Range.Contains(params.Position) { |
| 774 |
return nil, true, fmt.Errorf("position %v is outside the provided range %v.", params.Position, params.Range) |
| 775 |
} |
| 776 |
resp, err := server.PrepareTypeHierarchy(ctx, ¶ms) |
| 777 |
if err != nil { |
| 778 |
return nil, true, err |
| 779 |
} |
| 780 |
return resp, true, nil |
| 781 |
|
| 782 |
case "textDocument/rangeFormatting": |
| 783 |
var params DocumentRangeFormattingParams |
| 784 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 785 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 786 |
} |
| 787 |
resp, err := server.RangeFormatting(ctx, ¶ms) |
| 788 |
if err != nil { |
| 789 |
return nil, true, err |
| 790 |
} |
| 791 |
return resp, true, nil |
| 792 |
|
| 793 |
case "textDocument/rangesFormatting": |
| 794 |
var params DocumentRangesFormattingParams |
| 795 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 796 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 797 |
} |
| 798 |
resp, err := server.RangesFormatting(ctx, ¶ms) |
| 799 |
if err != nil { |
| 800 |
return nil, true, err |
| 801 |
} |
| 802 |
return resp, true, nil |
| 803 |
|
| 804 |
case "textDocument/references": |
| 805 |
var params ReferenceParams |
| 806 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 807 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 808 |
} |
| 809 |
if params.Range == (Range{}) { |
| 810 |
params.Range = Range{ |
| 811 |
Start: params.Position, |
| 812 |
End: params.Position, |
| 813 |
} |
| 814 |
} else if !params.Range.Contains(params.Position) { |
| 815 |
return nil, true, fmt.Errorf("position %v is outside the provided range %v.", params.Position, params.Range) |
| 816 |
} |
| 817 |
resp, err := server.References(ctx, ¶ms) |
| 818 |
if err != nil { |
| 819 |
return nil, true, err |
| 820 |
} |
| 821 |
return resp, true, nil |
| 822 |
|
| 823 |
case "textDocument/rename": |
| 824 |
var params RenameParams |
| 825 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 826 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 827 |
} |
| 828 |
if params.Range == (Range{}) { |
| 829 |
params.Range = Range{ |
| 830 |
Start: params.Position, |
| 831 |
End: params.Position, |
| 832 |
} |
| 833 |
} else if !params.Range.Contains(params.Position) { |
| 834 |
return nil, true, fmt.Errorf("position %v is outside the provided range %v.", params.Position, params.Range) |
| 835 |
} |
| 836 |
resp, err := server.Rename(ctx, ¶ms) |
| 837 |
if err != nil { |
| 838 |
return nil, true, err |
| 839 |
} |
| 840 |
return resp, true, nil |
| 841 |
|
| 842 |
case "textDocument/selectionRange": |
| 843 |
var params SelectionRangeParams |
| 844 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 845 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 846 |
} |
| 847 |
resp, err := server.SelectionRange(ctx, ¶ms) |
| 848 |
if err != nil { |
| 849 |
return nil, true, err |
| 850 |
} |
| 851 |
return resp, true, nil |
| 852 |
|
| 853 |
case "textDocument/semanticTokens/full": |
| 854 |
var params SemanticTokensParams |
| 855 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 856 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 857 |
} |
| 858 |
resp, err := server.SemanticTokensFull(ctx, ¶ms) |
| 859 |
if err != nil { |
| 860 |
return nil, true, err |
| 861 |
} |
| 862 |
return resp, true, nil |
| 863 |
|
| 864 |
case "textDocument/semanticTokens/full/delta": |
| 865 |
var params SemanticTokensDeltaParams |
| 866 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 867 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 868 |
} |
| 869 |
resp, err := server.SemanticTokensFullDelta(ctx, ¶ms) |
| 870 |
if err != nil { |
| 871 |
return nil, true, err |
| 872 |
} |
| 873 |
return resp, true, nil |
| 874 |
|
| 875 |
case "textDocument/semanticTokens/range": |
| 876 |
var params SemanticTokensRangeParams |
| 877 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 878 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 879 |
} |
| 880 |
resp, err := server.SemanticTokensRange(ctx, ¶ms) |
| 881 |
if err != nil { |
| 882 |
return nil, true, err |
| 883 |
} |
| 884 |
return resp, true, nil |
| 885 |
|
| 886 |
case "textDocument/signatureHelp": |
| 887 |
var params SignatureHelpParams |
| 888 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 889 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 890 |
} |
| 891 |
if params.Range == (Range{}) { |
| 892 |
params.Range = Range{ |
| 893 |
Start: params.Position, |
| 894 |
End: params.Position, |
| 895 |
} |
| 896 |
} else if !params.Range.Contains(params.Position) { |
| 897 |
return nil, true, fmt.Errorf("position %v is outside the provided range %v.", params.Position, params.Range) |
| 898 |
} |
| 899 |
resp, err := server.SignatureHelp(ctx, ¶ms) |
| 900 |
if err != nil { |
| 901 |
return nil, true, err |
| 902 |
} |
| 903 |
return resp, true, nil |
| 904 |
|
| 905 |
case "textDocument/typeDefinition": |
| 906 |
var params TypeDefinitionParams |
| 907 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 908 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 909 |
} |
| 910 |
if params.Range == (Range{}) { |
| 911 |
params.Range = Range{ |
| 912 |
Start: params.Position, |
| 913 |
End: params.Position, |
| 914 |
} |
| 915 |
} else if !params.Range.Contains(params.Position) { |
| 916 |
return nil, true, fmt.Errorf("position %v is outside the provided range %v.", params.Position, params.Range) |
| 917 |
} |
| 918 |
resp, err := server.TypeDefinition(ctx, ¶ms) |
| 919 |
if err != nil { |
| 920 |
return nil, true, err |
| 921 |
} |
| 922 |
return resp, true, nil |
| 923 |
|
| 924 |
case "textDocument/willSave": |
| 925 |
var params WillSaveTextDocumentParams |
| 926 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 927 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 928 |
} |
| 929 |
err := server.WillSave(ctx, ¶ms) |
| 930 |
return nil, true, err |
| 931 |
|
| 932 |
case "textDocument/willSaveWaitUntil": |
| 933 |
var params WillSaveTextDocumentParams |
| 934 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 935 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 936 |
} |
| 937 |
resp, err := server.WillSaveWaitUntil(ctx, ¶ms) |
| 938 |
if err != nil { |
| 939 |
return nil, true, err |
| 940 |
} |
| 941 |
return resp, true, nil |
| 942 |
|
| 943 |
case "typeHierarchy/subtypes": |
| 944 |
var params TypeHierarchySubtypesParams |
| 945 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 946 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 947 |
} |
| 948 |
resp, err := server.Subtypes(ctx, ¶ms) |
| 949 |
if err != nil { |
| 950 |
return nil, true, err |
| 951 |
} |
| 952 |
return resp, true, nil |
| 953 |
|
| 954 |
case "typeHierarchy/supertypes": |
| 955 |
var params TypeHierarchySupertypesParams |
| 956 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 957 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 958 |
} |
| 959 |
resp, err := server.Supertypes(ctx, ¶ms) |
| 960 |
if err != nil { |
| 961 |
return nil, true, err |
| 962 |
} |
| 963 |
return resp, true, nil |
| 964 |
|
| 965 |
case "window/workDoneProgress/cancel": |
| 966 |
var params WorkDoneProgressCancelParams |
| 967 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 968 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 969 |
} |
| 970 |
err := server.WorkDoneProgressCancel(ctx, ¶ms) |
| 971 |
return nil, true, err |
| 972 |
|
| 973 |
case "workspace/diagnostic": |
| 974 |
var params WorkspaceDiagnosticParams |
| 975 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 976 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 977 |
} |
| 978 |
resp, err := server.DiagnosticWorkspace(ctx, ¶ms) |
| 979 |
if err != nil { |
| 980 |
return nil, true, err |
| 981 |
} |
| 982 |
return resp, true, nil |
| 983 |
|
| 984 |
case "workspace/didChangeConfiguration": |
| 985 |
var params DidChangeConfigurationParams |
| 986 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 987 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 988 |
} |
| 989 |
err := server.DidChangeConfiguration(ctx, ¶ms) |
| 990 |
return nil, true, err |
| 991 |
|
| 992 |
case "workspace/didChangeWatchedFiles": |
| 993 |
var params DidChangeWatchedFilesParams |
| 994 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 995 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 996 |
} |
| 997 |
err := server.DidChangeWatchedFiles(ctx, ¶ms) |
| 998 |
return nil, true, err |
| 999 |
|
| 1000 |
case "workspace/didChangeWorkspaceFolders": |
| 1001 |
var params DidChangeWorkspaceFoldersParams |
| 1002 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 1003 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 1004 |
} |
| 1005 |
err := server.DidChangeWorkspaceFolders(ctx, ¶ms) |
| 1006 |
return nil, true, err |
| 1007 |
|
| 1008 |
case "workspace/didCreateFiles": |
| 1009 |
var params CreateFilesParams |
| 1010 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 1011 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 1012 |
} |
| 1013 |
err := server.DidCreateFiles(ctx, ¶ms) |
| 1014 |
return nil, true, err |
| 1015 |
|
| 1016 |
case "workspace/didDeleteFiles": |
| 1017 |
var params DeleteFilesParams |
| 1018 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 1019 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 1020 |
} |
| 1021 |
err := server.DidDeleteFiles(ctx, ¶ms) |
| 1022 |
return nil, true, err |
| 1023 |
|
| 1024 |
case "workspace/didRenameFiles": |
| 1025 |
var params RenameFilesParams |
| 1026 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 1027 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 1028 |
} |
| 1029 |
err := server.DidRenameFiles(ctx, ¶ms) |
| 1030 |
return nil, true, err |
| 1031 |
|
| 1032 |
case "workspace/executeCommand": |
| 1033 |
var params ExecuteCommandParams |
| 1034 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 1035 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 1036 |
} |
| 1037 |
resp, err := server.ExecuteCommand(ctx, ¶ms) |
| 1038 |
if err != nil { |
| 1039 |
return nil, true, err |
| 1040 |
} |
| 1041 |
return resp, true, nil |
| 1042 |
|
| 1043 |
case "workspace/symbol": |
| 1044 |
var params WorkspaceSymbolParams |
| 1045 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 1046 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 1047 |
} |
| 1048 |
resp, err := server.Symbol(ctx, ¶ms) |
| 1049 |
if err != nil { |
| 1050 |
return nil, true, err |
| 1051 |
} |
| 1052 |
return resp, true, nil |
| 1053 |
|
| 1054 |
case "workspace/textDocumentContent": |
| 1055 |
var params TextDocumentContentParams |
| 1056 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 1057 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 1058 |
} |
| 1059 |
resp, err := server.TextDocumentContent(ctx, ¶ms) |
| 1060 |
if err != nil { |
| 1061 |
return nil, true, err |
| 1062 |
} |
| 1063 |
return resp, true, nil |
| 1064 |
|
| 1065 |
case "workspace/willCreateFiles": |
| 1066 |
var params CreateFilesParams |
| 1067 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 1068 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 1069 |
} |
| 1070 |
resp, err := server.WillCreateFiles(ctx, ¶ms) |
| 1071 |
if err != nil { |
| 1072 |
return nil, true, err |
| 1073 |
} |
| 1074 |
return resp, true, nil |
| 1075 |
|
| 1076 |
case "workspace/willDeleteFiles": |
| 1077 |
var params DeleteFilesParams |
| 1078 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 1079 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 1080 |
} |
| 1081 |
resp, err := server.WillDeleteFiles(ctx, ¶ms) |
| 1082 |
if err != nil { |
| 1083 |
return nil, true, err |
| 1084 |
} |
| 1085 |
return resp, true, nil |
| 1086 |
|
| 1087 |
case "workspace/willRenameFiles": |
| 1088 |
var params RenameFilesParams |
| 1089 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 1090 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 1091 |
} |
| 1092 |
resp, err := server.WillRenameFiles(ctx, ¶ms) |
| 1093 |
if err != nil { |
| 1094 |
return nil, true, err |
| 1095 |
} |
| 1096 |
return resp, true, nil |
| 1097 |
|
| 1098 |
case "workspaceSymbol/resolve": |
| 1099 |
var params WorkspaceSymbol |
| 1100 |
if err := UnmarshalJSON(raw, ¶ms); err != nil { |
| 1101 |
return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err) |
| 1102 |
} |
| 1103 |
resp, err := server.ResolveWorkspaceSymbol(ctx, ¶ms) |
| 1104 |
if err != nil { |
| 1105 |
return nil, true, err |
| 1106 |
} |
| 1107 |
return resp, true, nil |
| 1108 |
|
| 1109 |
default: |
| 1110 |
return nil, false, nil |
| 1111 |
} |
| 1112 |
} |
| 1113 |
|
| 1114 |
func (s *serverDispatcher) Progress(ctx context.Context, params *ProgressParams) error { |
| 1115 |
return s.sender.Notify(ctx, "$/progress", params) |
| 1116 |
} |
| 1117 |
func (s *serverDispatcher) SetTrace(ctx context.Context, params *SetTraceParams) error { |
| 1118 |
return s.sender.Notify(ctx, "$/setTrace", params) |
| 1119 |
} |
| 1120 |
func (s *serverDispatcher) IncomingCalls(ctx context.Context, params *CallHierarchyIncomingCallsParams) ([]CallHierarchyIncomingCall, error) { |
| 1121 |
var result []CallHierarchyIncomingCall |
| 1122 |
if err := s.sender.Call(ctx, "callHierarchy/incomingCalls", params, &result); err != nil { |
| 1123 |
return nil, err |
| 1124 |
} |
| 1125 |
return result, nil |
| 1126 |
} |
| 1127 |
func (s *serverDispatcher) OutgoingCalls(ctx context.Context, params *CallHierarchyOutgoingCallsParams) ([]CallHierarchyOutgoingCall, error) { |
| 1128 |
var result []CallHierarchyOutgoingCall |
| 1129 |
if err := s.sender.Call(ctx, "callHierarchy/outgoingCalls", params, &result); err != nil { |
| 1130 |
return nil, err |
| 1131 |
} |
| 1132 |
return result, nil |
| 1133 |
} |
| 1134 |
func (s *serverDispatcher) ResolveCodeAction(ctx context.Context, params *CodeAction) (*CodeAction, error) { |
| 1135 |
var result *CodeAction |
| 1136 |
if err := s.sender.Call(ctx, "codeAction/resolve", params, &result); err != nil { |
| 1137 |
return nil, err |
| 1138 |
} |
| 1139 |
return result, nil |
| 1140 |
} |
| 1141 |
func (s *serverDispatcher) ResolveCodeLens(ctx context.Context, params *CodeLens) (*CodeLens, error) { |
| 1142 |
var result *CodeLens |
| 1143 |
if err := s.sender.Call(ctx, "codeLens/resolve", params, &result); err != nil { |
| 1144 |
return nil, err |
| 1145 |
} |
| 1146 |
return result, nil |
| 1147 |
} |
| 1148 |
func (s *serverDispatcher) ResolveCommand(ctx context.Context, params *ExecuteCommandParams) (*ExecuteCommandParams, error) { |
| 1149 |
var result *ExecuteCommandParams |
| 1150 |
if err := s.sender.Call(ctx, "command/resolve", params, &result); err != nil { |
| 1151 |
return nil, err |
| 1152 |
} |
| 1153 |
return result, nil |
| 1154 |
} |
| 1155 |
func (s *serverDispatcher) ResolveCompletionItem(ctx context.Context, params *CompletionItem) (*CompletionItem, error) { |
| 1156 |
var result *CompletionItem |
| 1157 |
if err := s.sender.Call(ctx, "completionItem/resolve", params, &result); err != nil { |
| 1158 |
return nil, err |
| 1159 |
} |
| 1160 |
return result, nil |
| 1161 |
} |
| 1162 |
func (s *serverDispatcher) ResolveDocumentLink(ctx context.Context, params *DocumentLink) (*DocumentLink, error) { |
| 1163 |
var result *DocumentLink |
| 1164 |
if err := s.sender.Call(ctx, "documentLink/resolve", params, &result); err != nil { |
| 1165 |
return nil, err |
| 1166 |
} |
| 1167 |
return result, nil |
| 1168 |
} |
| 1169 |
func (s *serverDispatcher) Exit(ctx context.Context) error { |
| 1170 |
return s.sender.Notify(ctx, "exit", nil) |
| 1171 |
} |
| 1172 |
func (s *serverDispatcher) Initialize(ctx context.Context, params *ParamInitialize) (*InitializeResult, error) { |
| 1173 |
var result *InitializeResult |
| 1174 |
if err := s.sender.Call(ctx, "initialize", params, &result); err != nil { |
| 1175 |
return nil, err |
| 1176 |
} |
| 1177 |
return result, nil |
| 1178 |
} |
| 1179 |
func (s *serverDispatcher) Initialized(ctx context.Context, params *InitializedParams) error { |
| 1180 |
return s.sender.Notify(ctx, "initialized", params) |
| 1181 |
} |
| 1182 |
func (s *serverDispatcher) Resolve(ctx context.Context, params *InlayHint) (*InlayHint, error) { |
| 1183 |
var result *InlayHint |
| 1184 |
if err := s.sender.Call(ctx, "inlayHint/resolve", params, &result); err != nil { |
| 1185 |
return nil, err |
| 1186 |
} |
| 1187 |
return result, nil |
| 1188 |
} |
| 1189 |
func (s *serverDispatcher) InteractiveListEnum(ctx context.Context, params *InteractiveListEnumParams) ([]FormEnumEntry, error) { |
| 1190 |
var result []FormEnumEntry |
| 1191 |
if err := s.sender.Call(ctx, "interactive/listEnum", params, &result); err != nil { |
| 1192 |
return nil, err |
| 1193 |
} |
| 1194 |
return result, nil |
| 1195 |
} |
| 1196 |
func (s *serverDispatcher) DidChangeNotebookDocument(ctx context.Context, params *DidChangeNotebookDocumentParams) error { |
| 1197 |
return s.sender.Notify(ctx, "notebookDocument/didChange", params) |
| 1198 |
} |
| 1199 |
func (s *serverDispatcher) DidCloseNotebookDocument(ctx context.Context, params *DidCloseNotebookDocumentParams) error { |
| 1200 |
return s.sender.Notify(ctx, "notebookDocument/didClose", params) |
| 1201 |
} |
| 1202 |
func (s *serverDispatcher) DidOpenNotebookDocument(ctx context.Context, params *DidOpenNotebookDocumentParams) error { |
| 1203 |
return s.sender.Notify(ctx, "notebookDocument/didOpen", params) |
| 1204 |
} |
| 1205 |
func (s *serverDispatcher) DidSaveNotebookDocument(ctx context.Context, params *DidSaveNotebookDocumentParams) error { |
| 1206 |
return s.sender.Notify(ctx, "notebookDocument/didSave", params) |
| 1207 |
} |
| 1208 |
func (s *serverDispatcher) Shutdown(ctx context.Context) error { |
| 1209 |
return s.sender.Call(ctx, "shutdown", nil, nil) |
| 1210 |
} |
| 1211 |
func (s *serverDispatcher) CodeAction(ctx context.Context, params *CodeActionParams) ([]CodeAction, error) { |
| 1212 |
var result []CodeAction |
| 1213 |
if err := s.sender.Call(ctx, "textDocument/codeAction", params, &result); err != nil { |
| 1214 |
return nil, err |
| 1215 |
} |
| 1216 |
return result, nil |
| 1217 |
} |
| 1218 |
func (s *serverDispatcher) CodeLens(ctx context.Context, params *CodeLensParams) ([]CodeLens, error) { |
| 1219 |
var result []CodeLens |
| 1220 |
if err := s.sender.Call(ctx, "textDocument/codeLens", params, &result); err != nil { |
| 1221 |
return nil, err |
| 1222 |
} |
| 1223 |
return result, nil |
| 1224 |
} |
| 1225 |
func (s *serverDispatcher) ColorPresentation(ctx context.Context, params *ColorPresentationParams) ([]ColorPresentation, error) { |
| 1226 |
var result []ColorPresentation |
| 1227 |
if err := s.sender.Call(ctx, "textDocument/colorPresentation", params, &result); err != nil { |
| 1228 |
return nil, err |
| 1229 |
} |
| 1230 |
return result, nil |
| 1231 |
} |
| 1232 |
func (s *serverDispatcher) Completion(ctx context.Context, params *CompletionParams) (*CompletionList, error) { |
| 1233 |
var result *CompletionList |
| 1234 |
if err := s.sender.Call(ctx, "textDocument/completion", params, &result); err != nil { |
| 1235 |
return nil, err |
| 1236 |
} |
| 1237 |
return result, nil |
| 1238 |
} |
| 1239 |
func (s *serverDispatcher) Declaration(ctx context.Context, params *DeclarationParams) (*Or_textDocument_declaration, error) { |
| 1240 |
var result *Or_textDocument_declaration |
| 1241 |
if err := s.sender.Call(ctx, "textDocument/declaration", params, &result); err != nil { |
| 1242 |
return nil, err |
| 1243 |
} |
| 1244 |
return result, nil |
| 1245 |
} |
| 1246 |
func (s *serverDispatcher) Definition(ctx context.Context, params *DefinitionParams) ([]Location, error) { |
| 1247 |
var result []Location |
| 1248 |
if err := s.sender.Call(ctx, "textDocument/definition", params, &result); err != nil { |
| 1249 |
return nil, err |
| 1250 |
} |
| 1251 |
return result, nil |
| 1252 |
} |
| 1253 |
func (s *serverDispatcher) Diagnostic(ctx context.Context, params *DocumentDiagnosticParams) (*DocumentDiagnosticReport, error) { |
| 1254 |
var result *DocumentDiagnosticReport |
| 1255 |
if err := s.sender.Call(ctx, "textDocument/diagnostic", params, &result); err != nil { |
| 1256 |
return nil, err |
| 1257 |
} |
| 1258 |
return result, nil |
| 1259 |
} |
| 1260 |
func (s *serverDispatcher) DidChange(ctx context.Context, params *DidChangeTextDocumentParams) error { |
| 1261 |
return s.sender.Notify(ctx, "textDocument/didChange", params) |
| 1262 |
} |
| 1263 |
func (s *serverDispatcher) DidClose(ctx context.Context, params *DidCloseTextDocumentParams) error { |
| 1264 |
return s.sender.Notify(ctx, "textDocument/didClose", params) |
| 1265 |
} |
| 1266 |
func (s *serverDispatcher) DidOpen(ctx context.Context, params *DidOpenTextDocumentParams) error { |
| 1267 |
return s.sender.Notify(ctx, "textDocument/didOpen", params) |
| 1268 |
} |
| 1269 |
func (s *serverDispatcher) DidSave(ctx context.Context, params *DidSaveTextDocumentParams) error { |
| 1270 |
return s.sender.Notify(ctx, "textDocument/didSave", params) |
| 1271 |
} |
| 1272 |
func (s *serverDispatcher) DocumentColor(ctx context.Context, params *DocumentColorParams) ([]ColorInformation, error) { |
| 1273 |
var result []ColorInformation |
| 1274 |
if err := s.sender.Call(ctx, "textDocument/documentColor", params, &result); err != nil { |
| 1275 |
return nil, err |
| 1276 |
} |
| 1277 |
return result, nil |
| 1278 |
} |
| 1279 |
func (s *serverDispatcher) DocumentHighlight(ctx context.Context, params *DocumentHighlightParams) ([]DocumentHighlight, error) { |
| 1280 |
var result []DocumentHighlight |
| 1281 |
if err := s.sender.Call(ctx, "textDocument/documentHighlight", params, &result); err != nil { |
| 1282 |
return nil, err |
| 1283 |
} |
| 1284 |
return result, nil |
| 1285 |
} |
| 1286 |
func (s *serverDispatcher) DocumentLink(ctx context.Context, params *DocumentLinkParams) ([]DocumentLink, error) { |
| 1287 |
var result []DocumentLink |
| 1288 |
if err := s.sender.Call(ctx, "textDocument/documentLink", params, &result); err != nil { |
| 1289 |
return nil, err |
| 1290 |
} |
| 1291 |
return result, nil |
| 1292 |
} |
| 1293 |
func (s *serverDispatcher) DocumentSymbol(ctx context.Context, params *DocumentSymbolParams) ([]any, error) { |
| 1294 |
var result []any |
| 1295 |
if err := s.sender.Call(ctx, "textDocument/documentSymbol", params, &result); err != nil { |
| 1296 |
return nil, err |
| 1297 |
} |
| 1298 |
return result, nil |
| 1299 |
} |
| 1300 |
func (s *serverDispatcher) FoldingRange(ctx context.Context, params *FoldingRangeParams) ([]FoldingRange, error) { |
| 1301 |
var result []FoldingRange |
| 1302 |
if err := s.sender.Call(ctx, "textDocument/foldingRange", params, &result); err != nil { |
| 1303 |
return nil, err |
| 1304 |
} |
| 1305 |
return result, nil |
| 1306 |
} |
| 1307 |
func (s *serverDispatcher) Formatting(ctx context.Context, params *DocumentFormattingParams) ([]TextEdit, error) { |
| 1308 |
var result []TextEdit |
| 1309 |
if err := s.sender.Call(ctx, "textDocument/formatting", params, &result); err != nil { |
| 1310 |
return nil, err |
| 1311 |
} |
| 1312 |
return result, nil |
| 1313 |
} |
| 1314 |
func (s *serverDispatcher) Hover(ctx context.Context, params *HoverParams) (*Hover, error) { |
| 1315 |
var result *Hover |
| 1316 |
if err := s.sender.Call(ctx, "textDocument/hover", params, &result); err != nil { |
| 1317 |
return nil, err |
| 1318 |
} |
| 1319 |
return result, nil |
| 1320 |
} |
| 1321 |
func (s *serverDispatcher) Implementation(ctx context.Context, params *ImplementationParams) ([]Location, error) { |
| 1322 |
var result []Location |
| 1323 |
if err := s.sender.Call(ctx, "textDocument/implementation", params, &result); err != nil { |
| 1324 |
return nil, err |
| 1325 |
} |
| 1326 |
return result, nil |
| 1327 |
} |
| 1328 |
func (s *serverDispatcher) InlayHint(ctx context.Context, params *InlayHintParams) ([]InlayHint, error) { |
| 1329 |
var result []InlayHint |
| 1330 |
if err := s.sender.Call(ctx, "textDocument/inlayHint", params, &result); err != nil { |
| 1331 |
return nil, err |
| 1332 |
} |
| 1333 |
return result, nil |
| 1334 |
} |
| 1335 |
func (s *serverDispatcher) InlineCompletion(ctx context.Context, params *InlineCompletionParams) (*Or_Result_textDocument_inlineCompletion, error) { |
| 1336 |
var result *Or_Result_textDocument_inlineCompletion |
| 1337 |
if err := s.sender.Call(ctx, "textDocument/inlineCompletion", params, &result); err != nil { |
| 1338 |
return nil, err |
| 1339 |
} |
| 1340 |
return result, nil |
| 1341 |
} |
| 1342 |
func (s *serverDispatcher) InlineValue(ctx context.Context, params *InlineValueParams) ([]InlineValue, error) { |
| 1343 |
var result []InlineValue |
| 1344 |
if err := s.sender.Call(ctx, "textDocument/inlineValue", params, &result); err != nil { |
| 1345 |
return nil, err |
| 1346 |
} |
| 1347 |
return result, nil |
| 1348 |
} |
| 1349 |
func (s *serverDispatcher) LinkedEditingRange(ctx context.Context, params *LinkedEditingRangeParams) (*LinkedEditingRanges, error) { |
| 1350 |
var result *LinkedEditingRanges |
| 1351 |
if err := s.sender.Call(ctx, "textDocument/linkedEditingRange", params, &result); err != nil { |
| 1352 |
return nil, err |
| 1353 |
} |
| 1354 |
return result, nil |
| 1355 |
} |
| 1356 |
func (s *serverDispatcher) Moniker(ctx context.Context, params *MonikerParams) ([]Moniker, error) { |
| 1357 |
var result []Moniker |
| 1358 |
if err := s.sender.Call(ctx, "textDocument/moniker", params, &result); err != nil { |
| 1359 |
return nil, err |
| 1360 |
} |
| 1361 |
return result, nil |
| 1362 |
} |
| 1363 |
func (s *serverDispatcher) OnTypeFormatting(ctx context.Context, params *DocumentOnTypeFormattingParams) ([]TextEdit, error) { |
| 1364 |
var result []TextEdit |
| 1365 |
if err := s.sender.Call(ctx, "textDocument/onTypeFormatting", params, &result); err != nil { |
| 1366 |
return nil, err |
| 1367 |
} |
| 1368 |
return result, nil |
| 1369 |
} |
| 1370 |
func (s *serverDispatcher) PrepareCallHierarchy(ctx context.Context, params *CallHierarchyPrepareParams) ([]CallHierarchyItem, error) { |
| 1371 |
var result []CallHierarchyItem |
| 1372 |
if err := s.sender.Call(ctx, "textDocument/prepareCallHierarchy", params, &result); err != nil { |
| 1373 |
return nil, err |
| 1374 |
} |
| 1375 |
return result, nil |
| 1376 |
} |
| 1377 |
func (s *serverDispatcher) PrepareRename(ctx context.Context, params *PrepareRenameParams) (*PrepareRenameResult, error) { |
| 1378 |
var result *PrepareRenameResult |
| 1379 |
if err := s.sender.Call(ctx, "textDocument/prepareRename", params, &result); err != nil { |
| 1380 |
return nil, err |
| 1381 |
} |
| 1382 |
return result, nil |
| 1383 |
} |
| 1384 |
func (s *serverDispatcher) PrepareTypeHierarchy(ctx context.Context, params *TypeHierarchyPrepareParams) ([]TypeHierarchyItem, error) { |
| 1385 |
var result []TypeHierarchyItem |
| 1386 |
if err := s.sender.Call(ctx, "textDocument/prepareTypeHierarchy", params, &result); err != nil { |
| 1387 |
return nil, err |
| 1388 |
} |
| 1389 |
return result, nil |
| 1390 |
} |
| 1391 |
func (s *serverDispatcher) RangeFormatting(ctx context.Context, params *DocumentRangeFormattingParams) ([]TextEdit, error) { |
| 1392 |
var result []TextEdit |
| 1393 |
if err := s.sender.Call(ctx, "textDocument/rangeFormatting", params, &result); err != nil { |
| 1394 |
return nil, err |
| 1395 |
} |
| 1396 |
return result, nil |
| 1397 |
} |
| 1398 |
func (s *serverDispatcher) RangesFormatting(ctx context.Context, params *DocumentRangesFormattingParams) ([]TextEdit, error) { |
| 1399 |
var result []TextEdit |
| 1400 |
if err := s.sender.Call(ctx, "textDocument/rangesFormatting", params, &result); err != nil { |
| 1401 |
return nil, err |
| 1402 |
} |
| 1403 |
return result, nil |
| 1404 |
} |
| 1405 |
func (s *serverDispatcher) References(ctx context.Context, params *ReferenceParams) ([]Location, error) { |
| 1406 |
var result []Location |
| 1407 |
if err := s.sender.Call(ctx, "textDocument/references", params, &result); err != nil { |
| 1408 |
return nil, err |
| 1409 |
} |
| 1410 |
return result, nil |
| 1411 |
} |
| 1412 |
func (s *serverDispatcher) Rename(ctx context.Context, params *RenameParams) (*WorkspaceEdit, error) { |
| 1413 |
var result *WorkspaceEdit |
| 1414 |
if err := s.sender.Call(ctx, "textDocument/rename", params, &result); err != nil { |
| 1415 |
return nil, err |
| 1416 |
} |
| 1417 |
return result, nil |
| 1418 |
} |
| 1419 |
func (s *serverDispatcher) SelectionRange(ctx context.Context, params *SelectionRangeParams) ([]SelectionRange, error) { |
| 1420 |
var result []SelectionRange |
| 1421 |
if err := s.sender.Call(ctx, "textDocument/selectionRange", params, &result); err != nil { |
| 1422 |
return nil, err |
| 1423 |
} |
| 1424 |
return result, nil |
| 1425 |
} |
| 1426 |
func (s *serverDispatcher) SemanticTokensFull(ctx context.Context, params *SemanticTokensParams) (*SemanticTokens, error) { |
| 1427 |
var result *SemanticTokens |
| 1428 |
if err := s.sender.Call(ctx, "textDocument/semanticTokens/full", params, &result); err != nil { |
| 1429 |
return nil, err |
| 1430 |
} |
| 1431 |
return result, nil |
| 1432 |
} |
| 1433 |
func (s *serverDispatcher) SemanticTokensFullDelta(ctx context.Context, params *SemanticTokensDeltaParams) (any, error) { |
| 1434 |
var result any |
| 1435 |
if err := s.sender.Call(ctx, "textDocument/semanticTokens/full/delta", params, &result); err != nil { |
| 1436 |
return nil, err |
| 1437 |
} |
| 1438 |
return result, nil |
| 1439 |
} |
| 1440 |
func (s *serverDispatcher) SemanticTokensRange(ctx context.Context, params *SemanticTokensRangeParams) (*SemanticTokens, error) { |
| 1441 |
var result *SemanticTokens |
| 1442 |
if err := s.sender.Call(ctx, "textDocument/semanticTokens/range", params, &result); err != nil { |
| 1443 |
return nil, err |
| 1444 |
} |
| 1445 |
return result, nil |
| 1446 |
} |
| 1447 |
func (s *serverDispatcher) SignatureHelp(ctx context.Context, params *SignatureHelpParams) (*SignatureHelp, error) { |
| 1448 |
var result *SignatureHelp |
| 1449 |
if err := s.sender.Call(ctx, "textDocument/signatureHelp", params, &result); err != nil { |
| 1450 |
return nil, err |
| 1451 |
} |
| 1452 |
return result, nil |
| 1453 |
} |
| 1454 |
func (s *serverDispatcher) TypeDefinition(ctx context.Context, params *TypeDefinitionParams) ([]Location, error) { |
| 1455 |
var result []Location |
| 1456 |
if err := s.sender.Call(ctx, "textDocument/typeDefinition", params, &result); err != nil { |
| 1457 |
return nil, err |
| 1458 |
} |
| 1459 |
return result, nil |
| 1460 |
} |
| 1461 |
func (s *serverDispatcher) WillSave(ctx context.Context, params *WillSaveTextDocumentParams) error { |
| 1462 |
return s.sender.Notify(ctx, "textDocument/willSave", params) |
| 1463 |
} |
| 1464 |
func (s *serverDispatcher) WillSaveWaitUntil(ctx context.Context, params *WillSaveTextDocumentParams) ([]TextEdit, error) { |
| 1465 |
var result []TextEdit |
| 1466 |
if err := s.sender.Call(ctx, "textDocument/willSaveWaitUntil", params, &result); err != nil { |
| 1467 |
return nil, err |
| 1468 |
} |
| 1469 |
return result, nil |
| 1470 |
} |
| 1471 |
func (s *serverDispatcher) Subtypes(ctx context.Context, params *TypeHierarchySubtypesParams) ([]TypeHierarchyItem, error) { |
| 1472 |
var result []TypeHierarchyItem |
| 1473 |
if err := s.sender.Call(ctx, "typeHierarchy/subtypes", params, &result); err != nil { |
| 1474 |
return nil, err |
| 1475 |
} |
| 1476 |
return result, nil |
| 1477 |
} |
| 1478 |
func (s *serverDispatcher) Supertypes(ctx context.Context, params *TypeHierarchySupertypesParams) ([]TypeHierarchyItem, error) { |
| 1479 |
var result []TypeHierarchyItem |
| 1480 |
if err := s.sender.Call(ctx, "typeHierarchy/supertypes", params, &result); err != nil { |
| 1481 |
return nil, err |
| 1482 |
} |
| 1483 |
return result, nil |
| 1484 |
} |
| 1485 |
func (s *serverDispatcher) WorkDoneProgressCancel(ctx context.Context, params *WorkDoneProgressCancelParams) error { |
| 1486 |
return s.sender.Notify(ctx, "window/workDoneProgress/cancel", params) |
| 1487 |
} |
| 1488 |
func (s *serverDispatcher) DiagnosticWorkspace(ctx context.Context, params *WorkspaceDiagnosticParams) (*WorkspaceDiagnosticReport, error) { |
| 1489 |
var result *WorkspaceDiagnosticReport |
| 1490 |
if err := s.sender.Call(ctx, "workspace/diagnostic", params, &result); err != nil { |
| 1491 |
return nil, err |
| 1492 |
} |
| 1493 |
return result, nil |
| 1494 |
} |
| 1495 |
func (s *serverDispatcher) DidChangeConfiguration(ctx context.Context, params *DidChangeConfigurationParams) error { |
| 1496 |
return s.sender.Notify(ctx, "workspace/didChangeConfiguration", params) |
| 1497 |
} |
| 1498 |
func (s *serverDispatcher) DidChangeWatchedFiles(ctx context.Context, params *DidChangeWatchedFilesParams) error { |
| 1499 |
return s.sender.Notify(ctx, "workspace/didChangeWatchedFiles", params) |
| 1500 |
} |
| 1501 |
func (s *serverDispatcher) DidChangeWorkspaceFolders(ctx context.Context, params *DidChangeWorkspaceFoldersParams) error { |
| 1502 |
return s.sender.Notify(ctx, "workspace/didChangeWorkspaceFolders", params) |
| 1503 |
} |
| 1504 |
func (s *serverDispatcher) DidCreateFiles(ctx context.Context, params *CreateFilesParams) error { |
| 1505 |
return s.sender.Notify(ctx, "workspace/didCreateFiles", params) |
| 1506 |
} |
| 1507 |
func (s *serverDispatcher) DidDeleteFiles(ctx context.Context, params *DeleteFilesParams) error { |
| 1508 |
return s.sender.Notify(ctx, "workspace/didDeleteFiles", params) |
| 1509 |
} |
| 1510 |
func (s *serverDispatcher) DidRenameFiles(ctx context.Context, params *RenameFilesParams) error { |
| 1511 |
return s.sender.Notify(ctx, "workspace/didRenameFiles", params) |
| 1512 |
} |
| 1513 |
func (s *serverDispatcher) ExecuteCommand(ctx context.Context, params *ExecuteCommandParams) (any, error) { |
| 1514 |
var result any |
| 1515 |
if err := s.sender.Call(ctx, "workspace/executeCommand", params, &result); err != nil { |
| 1516 |
return nil, err |
| 1517 |
} |
| 1518 |
return result, nil |
| 1519 |
} |
| 1520 |
func (s *serverDispatcher) Symbol(ctx context.Context, params *WorkspaceSymbolParams) ([]SymbolInformation, error) { |
| 1521 |
var result []SymbolInformation |
| 1522 |
if err := s.sender.Call(ctx, "workspace/symbol", params, &result); err != nil { |
| 1523 |
return nil, err |
| 1524 |
} |
| 1525 |
return result, nil |
| 1526 |
} |
| 1527 |
func (s *serverDispatcher) TextDocumentContent(ctx context.Context, params *TextDocumentContentParams) (*TextDocumentContentResult, error) { |
| 1528 |
var result *TextDocumentContentResult |
| 1529 |
if err := s.sender.Call(ctx, "workspace/textDocumentContent", params, &result); err != nil { |
| 1530 |
return nil, err |
| 1531 |
} |
| 1532 |
return result, nil |
| 1533 |
} |
| 1534 |
func (s *serverDispatcher) WillCreateFiles(ctx context.Context, params *CreateFilesParams) (*WorkspaceEdit, error) { |
| 1535 |
var result *WorkspaceEdit |
| 1536 |
if err := s.sender.Call(ctx, "workspace/willCreateFiles", params, &result); err != nil { |
| 1537 |
return nil, err |
| 1538 |
} |
| 1539 |
return result, nil |
| 1540 |
} |
| 1541 |
func (s *serverDispatcher) WillDeleteFiles(ctx context.Context, params *DeleteFilesParams) (*WorkspaceEdit, error) { |
| 1542 |
var result *WorkspaceEdit |
| 1543 |
if err := s.sender.Call(ctx, "workspace/willDeleteFiles", params, &result); err != nil { |
| 1544 |
return nil, err |
| 1545 |
} |
| 1546 |
return result, nil |
| 1547 |
} |
| 1548 |
func (s *serverDispatcher) WillRenameFiles(ctx context.Context, params *RenameFilesParams) (*WorkspaceEdit, error) { |
| 1549 |
var result *WorkspaceEdit |
| 1550 |
if err := s.sender.Call(ctx, "workspace/willRenameFiles", params, &result); err != nil { |
| 1551 |
return nil, err |
| 1552 |
} |
| 1553 |
return result, nil |
| 1554 |
} |
| 1555 |
func (s *serverDispatcher) ResolveWorkspaceSymbol(ctx context.Context, params *WorkspaceSymbol) (*WorkspaceSymbol, error) { |
| 1556 |
var result *WorkspaceSymbol |
| 1557 |
if err := s.sender.Call(ctx, "workspaceSymbol/resolve", params, &result); err != nil { |
| 1558 |
return nil, err |
| 1559 |
} |
| 1560 |
return result, nil |
| 1561 |
} |