1// Copyright 2018 The Go Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5// This file contains the corresponding structures to the 6// "Language Features" part of the LSP specification. 7 8package protocol 9 10type CompletionParams struct { 11 TextDocumentPositionParams 12 13 /** 14 * The completion context. This is only available if the client specifies 15 * to send this using `ClientCapabilities.textDocument.completion.contextSupport === true` 16 */ 17 Context CompletionContext `json:"context,omitempty"` 18} 19 20/** 21 * How a completion was triggered 22 */ 23type CompletionTriggerKind float64 24 25const ( 26 /** 27 * Completion was triggered by typing an identifier (24x7 code 28 * complete), manual invocation (e.g Ctrl+Space) or via API. 29 */ 30 Invoked CompletionTriggerKind = 1 31 32 /** 33 * Completion was triggered by a trigger character specified by 34 * the `triggerCharacters` properties of the `CompletionRegistrationOptions`. 35 */ 36 TriggerCharacter CompletionTriggerKind = 2 37 38 /** 39 * Completion was re-triggered as the current completion list is incomplete. 40 */ 41 TriggerForIncompleteCompletions CompletionTriggerKind = 3 42) 43 44/** 45 * Contains additional information about the context in which a completion request is triggered. 46 */ 47type CompletionContext struct { 48 /** 49 * How the completion was triggered. 50 */ 51 TriggerKind CompletionTriggerKind `json:"triggerKind"` 52 53 /** 54 * The trigger character (a single character) that has trigger code complete. 55 * Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter` 56 */ 57 TriggerCharacter string `json:"triggerCharacter,omitempty"` 58} 59 60/** 61 * Represents a collection of [completion items](#CompletionItem) to be presented 62 * in the editor. 63 */ 64type CompletionList struct { 65 /** 66 * This list it not complete. Further typing should result in recomputing 67 * this list. 68 */ 69 IsIncomplete bool `json:"isIncomplete"` 70 71 /** 72 * The completion items. 73 */ 74 Items []CompletionItem `json:"items"` 75} 76 77/** 78 * Defines whether the insert text in a completion item should be interpreted as 79 * plain text or a snippet. 80 */ 81type InsertTextFormat float64 82 83const ( 84 /** 85 * The primary text to be inserted is treated as a plain string. 86 */ 87 PlainTextFormat InsertTextFormat = 1 88 89 /** 90 * The primary text to be inserted is treated as a snippet. 91 * 92 * A snippet can define tab stops and placeholders with `$1`, `$2` 93 * and `${3:foo}`. `$0` defines the final tab stop, it defaults to 94 * the end of the snippet. Placeholders with equal identifiers are linked, 95 * that is typing in one will update others too. 96 */ 97 SnippetTextFormat InsertTextFormat = 2 98) 99 100type CompletionItem struct { 101 /** 102 * The label of this completion item. By default 103 * also the text that is inserted when selecting 104 * this completion. 105 */ 106 Label string `json:"label"` 107 108 /** 109 * The kind of this completion item. Based of the kind 110 * an icon is chosen by the editor. 111 */ 112 Kind float64 `json:"kind,omitempty"` 113 114 /** 115 * A human-readable string with additional information 116 * about this item, like type or symbol information. 117 */ 118 Detail string `json:"detail,omitempty"` 119 120 /** 121 * A human-readable string that represents a doc-comment. 122 */ 123 Documentation interface{} `json:"documentation,omitempty"` // string | MarkupContent 124 125 /** 126 * Indicates if this item is deprecated. 127 */ 128 Deprecated bool `json:"deprecated,omitempty"` 129 130 /** 131 * Select this item when showing. 132 * 133 * *Note* that only one completion item can be selected and that the 134 * tool / client decides which item that is. The rule is that the *first* 135 * item of those that match best is selected. 136 */ 137 Preselect bool `json:"preselect,omitempty"` 138 139 /** 140 * A string that should be used when comparing this item 141 * with other items. When `falsy` the label is used. 142 */ 143 SortText string `json:"sortText,omitempty"` 144 145 /** 146 * A string that should be used when filtering a set of 147 * completion items. When `falsy` the label is used. 148 */ 149 FilterText string `json:"filterText,omitempty"` 150 151 /** 152 * A string that should be inserted into a document when selecting 153 * this completion. When `falsy` the label is used. 154 * 155 * The `insertText` is subject to interpretation by the client side. 156 * Some tools might not take the string literally. For example 157 * VS Code when code complete is requested in this example `con<cursor position>` 158 * and a completion item with an `insertText` of `console` is provided it 159 * will only insert `sole`. Therefore it is recommended to use `textEdit` instead 160 * since it avoids additional client side interpretation. 161 * 162 * @deprecated Use textEdit instead. 163 */ 164 InsertText string `json:"insertText,omitempty"` 165 166 /** 167 * The format of the insert text. The format applies to both the `insertText` property 168 * and the `newText` property of a provided `textEdit`. 169 */ 170 InsertTextFormat InsertTextFormat `json:"insertTextFormat,omitempty"` 171 172 /** 173 * An edit which is applied to a document when selecting this completion. When an edit is provided the value of 174 * `insertText` is ignored. 175 * 176 * *Note:* The range of the edit must be a single line range and it must contain the position at which completion 177 * has been requested. 178 */ 179 TextEdit *TextEdit `json:"textEdit,omitempty"` 180 181 /** 182 * An optional array of additional text edits that are applied when 183 * selecting this completion. Edits must not overlap (including the same insert position) 184 * with the main edit nor with themselves. 185 * 186 * Additional text edits should be used to change text unrelated to the current cursor position 187 * (for example adding an import statement at the top of the file if the completion item will 188 * insert an unqualified type). 189 */ 190 AdditionalTextEdits []TextEdit `json:"additionalTextEdits,omitempty"` 191 192 /** 193 * An optional set of characters that when pressed while this completion is active will accept it first and 194 * then type that character. *Note* that all commit characters should have `length=1` and that superfluous 195 * characters will be ignored. 196 */ 197 CommitCharacters []string `json:"commitCharacters,omitempty"` 198 199 /** 200 * An optional command that is executed *after* inserting this completion. *Note* that 201 * additional modifications to the current document should be described with the 202 * additionalTextEdits-property. 203 */ 204 Command *Command `json:"command,omitempty"` 205 206 /** 207 * An data entry field that is preserved on a completion item between 208 * a completion and a completion resolve request. 209 */ 210 Data interface{} `json:"data"` 211} 212 213/** 214 * The kind of a completion entry. 215 */ 216type CompletionItemKind float64 217 218const ( 219 TextCompletion CompletionItemKind = 1 220 MethodCompletion CompletionItemKind = 2 221 FunctionCompletion CompletionItemKind = 3 222 ConstructorCompletion CompletionItemKind = 4 223 FieldCompletion CompletionItemKind = 5 224 VariableCompletion CompletionItemKind = 6 225 ClassCompletion CompletionItemKind = 7 226 InterfaceCompletion CompletionItemKind = 8 227 ModuleCompletion CompletionItemKind = 9 228 PropertyCompletion CompletionItemKind = 10 229 UnitCompletion CompletionItemKind = 11 230 ValueCompletion CompletionItemKind = 12 231 EnumCompletion CompletionItemKind = 13 232 KeywordCompletion CompletionItemKind = 14 233 SnippetCompletion CompletionItemKind = 15 234 ColorCompletion CompletionItemKind = 16 235 FileCompletion CompletionItemKind = 17 236 ReferenceCompletion CompletionItemKind = 18 237 FolderCompletion CompletionItemKind = 19 238 EnumMemberCompletion CompletionItemKind = 20 239 ConstantCompletion CompletionItemKind = 21 240 StructCompletion CompletionItemKind = 22 241 EventCompletion CompletionItemKind = 23 242 OperatorCompletion CompletionItemKind = 24 243 TypeParameterCompletion CompletionItemKind = 25 244) 245 246type CompletionRegistrationOptions struct { 247 TextDocumentRegistrationOptions 248 /** 249 * Most tools trigger completion request automatically without explicitly requesting 250 * it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user 251 * starts to type an identifier. For example if the user types `c` in a JavaScript file 252 * code complete will automatically pop up present `console` besides others as a 253 * completion item. Characters that make up identifiers don't need to be listed here. 254 * 255 * If code complete should automatically be trigger on characters not being valid inside 256 * an identifier (for example `.` in JavaScript) list them in `triggerCharacters`. 257 */ 258 TriggerCharacters []string `json:"triggerCharacters,omitempty"` 259 260 /** 261 * The server provides support to resolve additional 262 * information for a completion item. 263 */ 264 ResolveProvider bool `json:"resolveProvider,omitempty"` 265} 266 267/** 268 * The result of a hover request. 269 */ 270type Hover struct { 271 /** 272 * The hover's content 273 */ 274 Contents MarkupContent `json:"contents"` 275 276 /** 277 * An optional range is a range inside a text document 278 * that is used to visualize a hover, e.g. by changing the background color. 279 */ 280 Range Range `json:"range,omitempty"` 281} 282 283/** 284 * Signature help represents the signature of something 285 * callable. There can be multiple signature but only one 286 * active and only one active parameter. 287 */ 288type SignatureHelp struct { 289 /** 290 * One or more signatures. 291 */ 292 Signatures []SignatureInformation `json:"signatures"` 293 294 /** 295 * The active signature. If omitted or the value lies outside the 296 * range of `signatures` the value defaults to zero or is ignored if 297 * `signatures.length === 0`. Whenever possible implementors should 298 * make an active decision about the active signature and shouldn't 299 * rely on a default value. 300 * In future version of the protocol this property might become 301 * mandatory to better express this. 302 */ 303 ActiveSignature float64 `json:"activeSignature,omitempty"` 304 305 /** 306 * The active parameter of the active signature. If omitted or the value 307 * lies outside the range of `signatures[activeSignature].parameters` 308 * defaults to 0 if the active signature has parameters. If 309 * the active signature has no parameters it is ignored. 310 * In future version of the protocol this property might become 311 * mandatory to better express the active parameter if the 312 * active signature does have any. 313 */ 314 ActiveParameter float64 `json:"activeParameter,omitempty"` 315} 316 317/** 318 * Represents the signature of something callable. A signature 319 * can have a label, like a function-name, a doc-comment, and 320 * a set of parameters. 321 */ 322type SignatureInformation struct { 323 /** 324 * The label of this signature. Will be shown in 325 * the UI. 326 */ 327 Label string `json:"label"` 328 329 /** 330 * The human-readable doc-comment of this signature. Will be shown 331 * in the UI but can be omitted. 332 */ 333 Documentation interface{} `json:"documentation,omitempty"` // string | MarkupContent 334 335 /** 336 * The parameters of this signature. 337 */ 338 Parameters []ParameterInformation `json:"parameters,omitempty"` 339} 340 341/** 342 * Represents a parameter of a callable-signature. A parameter can 343 * have a label and a doc-comment. 344 */ 345type ParameterInformation struct { 346 /** 347 * The label of this parameter. Will be shown in 348 * the UI. 349 */ 350 Label string `json:"label"` 351 352 /** 353 * The human-readable doc-comment of this parameter. Will be shown 354 * in the UI but can be omitted. 355 */ 356 Documentation interface{} `json:"documentation,omitempty"` // string | MarkupContent 357} 358 359type SignatureHelpRegistrationOptions struct { 360 TextDocumentRegistrationOptions 361 /** 362 * The characters that trigger signature help 363 * automatically. 364 */ 365 TriggerCharacters []string `json:"triggerCharacters,omitempty"` 366} 367 368type ReferenceParams struct { 369 TextDocumentPositionParams 370 Context ReferenceContext 371} 372 373type ReferenceContext struct { 374 /** 375 * Include the declaration of the current symbol. 376 */ 377 IncludeDeclaration bool `json:"includeDeclaration"` 378} 379 380/** 381 * A document highlight is a range inside a text document which deserves 382 * special attention. Usually a document highlight is visualized by changing 383 * the background color of its range. 384 * 385 */ 386type DocumentHighlight struct { 387 /** 388 * The range this highlight applies to. 389 */ 390 Range Range `json:"range"` 391 392 /** 393 * The highlight kind, default is DocumentHighlightKind.Text. 394 */ 395 Kind float64 `json:"kind,omitempty"` 396} 397 398/** 399 * A document highlight kind. 400 */ 401type DocumentHighlightKind float64 402 403const ( 404 /** 405 * A textual occurrence. 406 */ 407 TextHighlight DocumentHighlightKind = 1 408 409 /** 410 * Read-access of a symbol, like reading a variable. 411 */ 412 ReadHighlight DocumentHighlightKind = 2 413 414 /** 415 * Write-access of a symbol, like writing to a variable. 416 */ 417 WriteHighlight DocumentHighlightKind = 3 418) 419 420type DocumentSymbolParams struct { 421 /** 422 * The text document. 423 */ 424 TextDocument TextDocumentIdentifier `json:"textDocument"` 425} 426 427/** 428 * A symbol kind. 429 */ 430type SymbolKind float64 431 432const ( 433 FileSymbol SymbolKind = 1 434 ModuleSymbol SymbolKind = 2 435 NamespaceSymbol SymbolKind = 3 436 PackageSymbol SymbolKind = 4 437 ClassSymbol SymbolKind = 5 438 MethodSymbol SymbolKind = 6 439 PropertySymbol SymbolKind = 7 440 FieldSymbol SymbolKind = 8 441 ConstructorSymbol SymbolKind = 9 442 EnumSymbol SymbolKind = 10 443 InterfaceSymbol SymbolKind = 11 444 FunctionSymbol SymbolKind = 12 445 VariableSymbol SymbolKind = 13 446 ConstantSymbol SymbolKind = 14 447 StringSymbol SymbolKind = 15 448 NumberSymbol SymbolKind = 16 449 BooleanSymbol SymbolKind = 17 450 ArraySymbol SymbolKind = 18 451 ObjectSymbol SymbolKind = 19 452 KeySymbol SymbolKind = 20 453 NullSymbol SymbolKind = 21 454 EnumMemberSymbol SymbolKind = 22 455 StructSymbol SymbolKind = 23 456 EventSymbol SymbolKind = 24 457 OperatorSymbol SymbolKind = 25 458 TypeParameterSymbol SymbolKind = 26 459) 460 461/** 462 * Represents programming constructs like variables, classes, interfaces etc. that appear in a document. Document symbols can be 463 * hierarchical and they have two ranges: one that encloses its definition and one that points to its most interesting range, 464 * e.g. the range of an identifier. 465 */ 466type DocumentSymbol struct { 467 468 /** 469 * The name of this symbol. 470 */ 471 Name string `json:"name"` 472 473 /** 474 * More detail for this symbol, e.g the signature of a function. If not provided the 475 * name is used. 476 */ 477 Detail string `json:"detail,omitempty"` 478 479 /** 480 * The kind of this symbol. 481 */ 482 Kind SymbolKind `json:"kind"` 483 484 /** 485 * Indicates if this symbol is deprecated. 486 */ 487 Deprecated bool `json:"deprecated,omitempty"` 488 489 /** 490 * The range enclosing this symbol not including leading/trailing whitespace but everything else 491 * like comments. This information is typically used to determine if the clients cursor is 492 * inside the symbol to reveal in the symbol in the UI. 493 */ 494 Range Range `json:"range"` 495 496 /** 497 * The range that should be selected and revealed when this symbol is being picked, e.g the name of a function. 498 * Must be contained by the `range`. 499 */ 500 SelectionRange Range `json:"selectionRange"` 501 502 /** 503 * Children of this symbol, e.g. properties of a class. 504 */ 505 Children []DocumentSymbol `json:"children,omitempty"` 506} 507 508/** 509 * Represents information about programming constructs like variables, classes, 510 * interfaces etc. 511 */ 512type SymbolInformation struct { 513 /** 514 * The name of this symbol. 515 */ 516 Name string `json:"name"` 517 518 /** 519 * The kind of this symbol. 520 */ 521 Kind float64 `json:"kind"` 522 523 /** 524 * Indicates if this symbol is deprecated. 525 */ 526 Deprecated bool `json:"deprecated,omitempty"` 527 528 /** 529 * The location of this symbol. The location's range is used by a tool 530 * to reveal the location in the editor. If the symbol is selected in the 531 * tool the range's start information is used to position the cursor. So 532 * the range usually spans more then the actual symbol's name and does 533 * normally include things like visibility modifiers. 534 * 535 * The range doesn't have to denote a node range in the sense of a abstract 536 * syntax tree. It can therefore not be used to re-construct a hierarchy of 537 * the symbols. 538 */ 539 Location Location `json:"location"` 540 541 /** 542 * The name of the symbol containing this symbol. This information is for 543 * user interface purposes (e.g. to render a qualifier in the user interface 544 * if necessary). It can't be used to re-infer a hierarchy for the document 545 * symbols. 546 */ 547 ContainerName string `json:"containerName,omitempty"` 548} 549 550/** 551 * Params for the CodeActionRequest 552 */ 553type CodeActionParams struct { 554 /** 555 * The document in which the command was invoked. 556 */ 557 TextDocument TextDocumentIdentifier `json:"textDocument"` 558 559 /** 560 * The range for which the command was invoked. 561 */ 562 Range Range `json:"range"` 563 564 /** 565 * Context carrying additional information. 566 */ 567 Context CodeActionContext `json:"context"` 568} 569 570/** 571 * The kind of a code action. 572 * 573 * Kinds are a hierarchical list of identifiers separated by `.`, e.g. `"refactor.extract.function"`. 574 * 575 * The set of kinds is open and client needs to announce the kinds it supports to the server during 576 * initialization. 577 */ 578type CodeActionKind string 579 580/** 581 * A set of predefined code action kinds 582 */ 583const ( 584 /** 585 * Base kind for quickfix actions: 'quickfix' 586 */ 587 QuickFix CodeActionKind = "quickfix" 588 589 /** 590 * Base kind for refactoring actions: 'refactor' 591 */ 592 Refactor CodeActionKind = "refactor" 593 594 /** 595 * Base kind for refactoring extraction actions: 'refactor.extract' 596 * 597 * Example extract actions: 598 * 599 * - Extract method 600 * - Extract function 601 * - Extract variable 602 * - Extract interface from class 603 * - ... 604 */ 605 RefactorExtract CodeActionKind = "refactor.extract" 606 607 /** 608 * Base kind for refactoring inline actions: 'refactor.inline' 609 * 610 * Example inline actions: 611 * 612 * - Inline function 613 * - Inline variable 614 * - Inline constant 615 * - ... 616 */ 617 RefactorInline CodeActionKind = "refactor.inline" 618 619 /** 620 * Base kind for refactoring rewrite actions: 'refactor.rewrite' 621 * 622 * Example rewrite actions: 623 * 624 * - Convert JavaScript function to class 625 * - Add or remove parameter 626 * - Encapsulate field 627 * - Make method static 628 * - Move method to base class 629 * - ... 630 */ 631 RefactorRewrite CodeActionKind = "refactor.rewrite" 632 633 /** 634 * Base kind for source actions: `source` 635 * 636 * Source code actions apply to the entire file. 637 */ 638 Source CodeActionKind = "source" 639 640 /** 641 * Base kind for an organize imports source action: `source.organizeImports` 642 */ 643 SourceOrganizeImports CodeActionKind = "source.organizeImports" 644) 645 646/** 647 * Contains additional diagnostic information about the context in which 648 * a code action is run. 649 */ 650type CodeActionContext struct { 651 /** 652 * An array of diagnostics. 653 */ 654 Diagnostics []Diagnostic `json:"diagnostics"` 655 656 /** 657 * Requested kind of actions to return. 658 * 659 * Actions not of this kind are filtered out by the client before being shown. So servers 660 * can omit computing them. 661 */ 662 Only []CodeActionKind `json:"only,omitempty"` 663} 664 665/** 666 * A code action represents a change that can be performed in code, e.g. to fix a problem or 667 * to refactor code. 668 * 669 * A CodeAction must set either `edit` and/or a `command`. If both are supplied, the `edit` is applied first, then the `command` is executed. 670 */ 671type CodeAction struct { 672 673 /** 674 * A short, human-readable, title for this code action. 675 */ 676 Title string `json:"title"` 677 678 /** 679 * The kind of the code action. 680 * 681 * Used to filter code actions. 682 */ 683 Kind CodeActionKind `json:"kind,omitempty"` 684 685 /** 686 * The diagnostics that this code action resolves. 687 */ 688 Diagnostics []Diagnostic `json:"diagnostics,omitempty"` 689 690 /** 691 * The workspace edit this code action performs. 692 */ 693 Edit WorkspaceEdit `json:"edit,omitempty"` 694 695 /** 696 * A command this code action executes. If a code action 697 * provides an edit and a command, first the edit is 698 * executed and then the command. 699 */ 700 Command Command `json:"command,omitempty"` 701} 702 703type CodeLensParams struct { 704 /** 705 * The document to request code lens for. 706 */ 707 TextDocument TextDocumentIdentifier `json:"textDocument"` 708} 709 710/** 711 * A code lens represents a command that should be shown along with 712 * source text, like the number of references, a way to run tests, etc. 713 * 714 * A code lens is _unresolved_ when no command is associated to it. For performance 715 * reasons the creation of a code lens and resolving should be done in two stages. 716 */ 717type CodeLens struct { 718 /** 719 * The range in which this code lens is valid. Should only span a single line. 720 */ 721 Range Range `json:"range"` 722 723 /** 724 * The command this code lens represents. 725 */ 726 Command Command `json:"command,omitempty"` 727 728 /** 729 * A data entry field that is preserved on a code lens item between 730 * a code lens and a code lens resolve request. 731 */ 732 Data interface{} `json:"data"` 733} 734 735type CodeLensRegistrationOptions struct { 736 TextDocumentRegistrationOptions 737 /** 738 * Code lens has a resolve provider as well. 739 */ 740 ResolveProvider bool `json:"resolveProvider,omitempty"` 741} 742 743type DocumentLinkParams struct { 744 /** 745 * The document to provide document links for. 746 */ 747 TextDocument TextDocumentIdentifier `json:"textDocument"` 748} 749 750/** 751 * A document link is a range in a text document that links to an internal or external resource, like another 752 * text document or a web site. 753 */ 754type DocumentLink struct { 755 /** 756 * The range this link applies to. 757 */ 758 Range Range `json:"range"` 759 /** 760 * The uri this link points to. If missing a resolve request is sent later. 761 */ 762 Target DocumentURI `json:"target,omitempty"` 763 /** 764 * A data entry field that is preserved on a document link between a 765 * DocumentLinkRequest and a DocumentLinkResolveRequest. 766 */ 767 Data interface{} `json:"data,omitempty"` 768} 769 770type DocumentLinkRegistrationOptions struct { 771 TextDocumentRegistrationOptions 772 /** 773 * Document links have a resolve provider as well. 774 */ 775 ResolveProvider bool `json:"resolveProvider,omitempty"` 776} 777 778type DocumentColorParams struct { 779 /** 780 * The text document. 781 */ 782 TextDocument TextDocumentIdentifier `json:"textDocument"` 783} 784 785type ColorInformation struct { 786 /** 787 * The range in the document where this color appears. 788 */ 789 Range Range `json:"range"` 790 791 /** 792 * The actual color value for this color range. 793 */ 794 Color Color `json:"color"` 795} 796 797/** 798 * Represents a color in RGBA space. 799 */ 800type Color struct { 801 802 /** 803 * The red component of this color in the range [0-1]. 804 */ 805 Red float64 `json:"red"` 806 807 /** 808 * The green component of this color in the range [0-1]. 809 */ 810 Green float64 `json:"green"` 811 812 /** 813 * The blue component of this color in the range [0-1]. 814 */ 815 Blue float64 `json:"blue"` 816 817 /** 818 * The alpha component of this color in the range [0-1]. 819 */ 820 Alpha float64 `json:"alpha"` 821} 822 823type ColorPresentationParams struct { 824 /** 825 * The text document. 826 */ 827 TextDocument TextDocumentIdentifier `json:"textDocument"` 828 829 /** 830 * The color information to request presentations for. 831 */ 832 Color Color `json:"color"` 833 834 /** 835 * The range where the color would be inserted. Serves as a context. 836 */ 837 Range Range `json:"range"` 838} 839 840type ColorPresentation struct { 841 /** 842 * The label of this color presentation. It will be shown on the color 843 * picker header. By default this is also the text that is inserted when selecting 844 * this color presentation. 845 */ 846 Label string `json:"label"` 847 /** 848 * An [edit](#TextEdit) which is applied to a document when selecting 849 * this presentation for the color. When `falsy` the [label](#ColorPresentation.label) 850 * is used. 851 */ 852 TextEdit TextEdit `json:"textEdit,omitempty"` 853 /** 854 * An optional array of additional [text edits](#TextEdit) that are applied when 855 * selecting this color presentation. Edits must not overlap with the main [edit](#ColorPresentation.textEdit) nor with themselves. 856 */ 857 AdditionalTextEdits []TextEdit `json:"additionalTextEdits,omitempty"` 858} 859 860type DocumentFormattingParams struct { 861 /** 862 * The document to format. 863 */ 864 TextDocument TextDocumentIdentifier `json:"textDocument"` 865 866 /** 867 * The format options. 868 */ 869 Options FormattingOptions `json:"options"` 870} 871 872/** 873 * Value-object describing what options formatting should use. 874 */ 875type FormattingOptions struct { 876 /** 877 * Size of a tab in spaces. 878 */ 879 TabSize float64 `json:"tabSize"` 880 881 /** 882 * Prefer spaces over tabs. 883 */ 884 InsertSpaces bool `json:"insertSpaces"` 885 886 /** 887 * Signature for further properties. 888 */ 889 // TODO: [key: string]: boolean | number | string; 890} 891 892type DocumentRangeFormattingParams struct { 893 /** 894 * The document to format. 895 */ 896 TextDocument TextDocumentIdentifier `json:"textDocument"` 897 898 /** 899 * The range to format 900 */ 901 Range Range `json:"range"` 902 903 /** 904 * The format options 905 */ 906 Options FormattingOptions `json:"options"` 907} 908 909type DocumentOnTypeFormattingParams struct { 910 /** 911 * The document to format. 912 */ 913 TextDocument TextDocumentIdentifier `json:"textDocument"` 914 915 /** 916 * The position at which this request was sent. 917 */ 918 Position Position `json:"position"` 919 920 /** 921 * The character that has been typed. 922 */ 923 Ch string `json:"ch"` 924 925 /** 926 * The format options. 927 */ 928 Options FormattingOptions `json:"options"` 929} 930 931type DocumentOnTypeFormattingRegistrationOptions struct { 932 TextDocumentRegistrationOptions 933 /** 934 * A character on which formatting should be triggered, like `}`. 935 */ 936 FirstTriggerCharacter string `json:"firstTriggerCharacter"` 937 /** 938 * More trigger characters. 939 */ 940 MoreTriggerCharacter []string `json:"moreTriggerCharacter"` 941} 942 943type RenameParams struct { 944 /** 945 * The document to rename. 946 */ 947 TextDocument TextDocumentIdentifier `json:"textDocument"` 948 949 /** 950 * The position at which this request was sent. 951 */ 952 Position Position `json:"position"` 953 954 /** 955 * The new name of the symbol. If the given name is not valid the 956 * request must return a [ResponseError](#ResponseError) with an 957 * appropriate message set. 958 */ 959 NewName string `json:"newName"` 960} 961 962type FoldingRangeRequestParam struct { 963 /** 964 * The text document. 965 */ 966 TextDocument TextDocumentIdentifier `json:"textDocument"` 967} 968 969/** 970 * Enum of known range kinds 971 */ 972type FoldingRangeKind string 973 974const ( 975 /** 976 * Folding range for a comment 977 */ 978 Comment FoldingRangeKind = "comment" 979 /** 980 * Folding range for a imports or includes 981 */ 982 Imports FoldingRangeKind = "imports" 983 /** 984 * Folding range for a region (e.g. `#region`) 985 */ 986 Region FoldingRangeKind = "region" 987) 988 989/** 990 * Represents a folding range. 991 */ 992type FoldingRange struct { 993 994 /** 995 * The zero-based line number from where the folded range starts. 996 */ 997 StartLine float64 `json:"startLine"` 998 999 /** 1000 * The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line. 1001 */ 1002 StartCharacter float64 `json:"startCharacter,omitempty"` 1003 1004 /** 1005 * The zero-based line number where the folded range ends. 1006 */ 1007 EndLine float64 `json:"endLine"` 1008 1009 /** 1010 * The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line. 1011 */ 1012 EndCharacter float64 `json:"endCharacter,omitempty"` 1013 1014 /** 1015 * Describes the kind of the folding range such as `comment' or 'region'. The kind 1016 * is used to categorize folding ranges and used by commands like 'Fold all comments'. See 1017 * [FoldingRangeKind](#FoldingRangeKind) for an enumeration of standardized kinds. 1018 */ 1019 Kind string `json:"kind,omitempty"` 1020} 1021