1/** 2 * Declaration module describing the TypeScript Server protocol 3 */ 4declare namespace ts.server.protocol { 5 const enum CommandTypes { 6 JsxClosingTag = "jsxClosingTag", 7 Brace = "brace", 8 BraceCompletion = "braceCompletion", 9 GetSpanOfEnclosingComment = "getSpanOfEnclosingComment", 10 Change = "change", 11 Close = "close", 12 /** @deprecated Prefer CompletionInfo -- see comment on CompletionsResponse */ 13 Completions = "completions", 14 CompletionInfo = "completionInfo", 15 CompletionDetails = "completionEntryDetails", 16 CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList", 17 CompileOnSaveEmitFile = "compileOnSaveEmitFile", 18 Configure = "configure", 19 Definition = "definition", 20 DefinitionAndBoundSpan = "definitionAndBoundSpan", 21 Implementation = "implementation", 22 Exit = "exit", 23 Format = "format", 24 Formatonkey = "formatonkey", 25 Geterr = "geterr", 26 GeterrForProject = "geterrForProject", 27 SemanticDiagnosticsSync = "semanticDiagnosticsSync", 28 SyntacticDiagnosticsSync = "syntacticDiagnosticsSync", 29 SuggestionDiagnosticsSync = "suggestionDiagnosticsSync", 30 NavBar = "navbar", 31 Navto = "navto", 32 NavTree = "navtree", 33 NavTreeFull = "navtree-full", 34 /** @deprecated */ 35 Occurrences = "occurrences", 36 DocumentHighlights = "documentHighlights", 37 Open = "open", 38 Quickinfo = "quickinfo", 39 References = "references", 40 Reload = "reload", 41 Rename = "rename", 42 Saveto = "saveto", 43 SignatureHelp = "signatureHelp", 44 Status = "status", 45 TypeDefinition = "typeDefinition", 46 ProjectInfo = "projectInfo", 47 ReloadProjects = "reloadProjects", 48 Unknown = "unknown", 49 OpenExternalProject = "openExternalProject", 50 OpenExternalProjects = "openExternalProjects", 51 CloseExternalProject = "closeExternalProject", 52 UpdateOpen = "updateOpen", 53 GetOutliningSpans = "getOutliningSpans", 54 TodoComments = "todoComments", 55 Indentation = "indentation", 56 DocCommentTemplate = "docCommentTemplate", 57 CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects", 58 GetCodeFixes = "getCodeFixes", 59 GetCombinedCodeFix = "getCombinedCodeFix", 60 ApplyCodeActionCommand = "applyCodeActionCommand", 61 GetSupportedCodeFixes = "getSupportedCodeFixes", 62 GetApplicableRefactors = "getApplicableRefactors", 63 GetEditsForRefactor = "getEditsForRefactor", 64 OrganizeImports = "organizeImports", 65 GetEditsForFileRename = "getEditsForFileRename", 66 ConfigurePlugin = "configurePlugin", 67 SelectionRange = "selectionRange", 68 ToggleLineComment = "toggleLineComment", 69 ToggleMultilineComment = "toggleMultilineComment", 70 CommentSelection = "commentSelection", 71 UncommentSelection = "uncommentSelection", 72 PrepareCallHierarchy = "prepareCallHierarchy", 73 ProvideCallHierarchyIncomingCalls = "provideCallHierarchyIncomingCalls", 74 ProvideCallHierarchyOutgoingCalls = "provideCallHierarchyOutgoingCalls" 75 } 76 /** 77 * A TypeScript Server message 78 */ 79 interface Message { 80 /** 81 * Sequence number of the message 82 */ 83 seq: number; 84 /** 85 * One of "request", "response", or "event" 86 */ 87 type: "request" | "response" | "event"; 88 } 89 /** 90 * Client-initiated request message 91 */ 92 interface Request extends Message { 93 type: "request"; 94 /** 95 * The command to execute 96 */ 97 command: string; 98 /** 99 * Object containing arguments for the command 100 */ 101 arguments?: any; 102 } 103 /** 104 * Request to reload the project structure for all the opened files 105 */ 106 interface ReloadProjectsRequest extends Message { 107 command: CommandTypes.ReloadProjects; 108 } 109 /** 110 * Server-initiated event message 111 */ 112 interface Event extends Message { 113 type: "event"; 114 /** 115 * Name of event 116 */ 117 event: string; 118 /** 119 * Event-specific information 120 */ 121 body?: any; 122 } 123 /** 124 * Response by server to client request message. 125 */ 126 interface Response extends Message { 127 type: "response"; 128 /** 129 * Sequence number of the request message. 130 */ 131 request_seq: number; 132 /** 133 * Outcome of the request. 134 */ 135 success: boolean; 136 /** 137 * The command requested. 138 */ 139 command: string; 140 /** 141 * If success === false, this should always be provided. 142 * Otherwise, may (or may not) contain a success message. 143 */ 144 message?: string; 145 /** 146 * Contains message body if success === true. 147 */ 148 body?: any; 149 /** 150 * Contains extra information that plugin can include to be passed on 151 */ 152 metadata?: unknown; 153 /** 154 * Exposes information about the performance of this request-response pair. 155 */ 156 performanceData?: PerformanceData; 157 } 158 interface PerformanceData { 159 /** 160 * Time spent updating the program graph, in milliseconds. 161 */ 162 updateGraphDurationMs?: number; 163 /** 164 * The time spent creating or updating the auto-import program, in milliseconds. 165 */ 166 createAutoImportProviderProgramDurationMs?: number; 167 } 168 /** 169 * Arguments for FileRequest messages. 170 */ 171 interface FileRequestArgs { 172 /** 173 * The file for the request (absolute pathname required). 174 */ 175 file: string; 176 projectFileName?: string; 177 } 178 interface StatusRequest extends Request { 179 command: CommandTypes.Status; 180 } 181 interface StatusResponseBody { 182 /** 183 * The TypeScript version (`ts.version`). 184 */ 185 version: string; 186 } 187 /** 188 * Response to StatusRequest 189 */ 190 interface StatusResponse extends Response { 191 body: StatusResponseBody; 192 } 193 /** 194 * Requests a JS Doc comment template for a given position 195 */ 196 interface DocCommentTemplateRequest extends FileLocationRequest { 197 command: CommandTypes.DocCommentTemplate; 198 } 199 /** 200 * Response to DocCommentTemplateRequest 201 */ 202 interface DocCommandTemplateResponse extends Response { 203 body?: TextInsertion; 204 } 205 /** 206 * A request to get TODO comments from the file 207 */ 208 interface TodoCommentRequest extends FileRequest { 209 command: CommandTypes.TodoComments; 210 arguments: TodoCommentRequestArgs; 211 } 212 /** 213 * Arguments for TodoCommentRequest request. 214 */ 215 interface TodoCommentRequestArgs extends FileRequestArgs { 216 /** 217 * Array of target TodoCommentDescriptors that describes TODO comments to be found 218 */ 219 descriptors: TodoCommentDescriptor[]; 220 } 221 /** 222 * Response for TodoCommentRequest request. 223 */ 224 interface TodoCommentsResponse extends Response { 225 body?: TodoComment[]; 226 } 227 /** 228 * A request to determine if the caret is inside a comment. 229 */ 230 interface SpanOfEnclosingCommentRequest extends FileLocationRequest { 231 command: CommandTypes.GetSpanOfEnclosingComment; 232 arguments: SpanOfEnclosingCommentRequestArgs; 233 } 234 interface SpanOfEnclosingCommentRequestArgs extends FileLocationRequestArgs { 235 /** 236 * Requires that the enclosing span be a multi-line comment, or else the request returns undefined. 237 */ 238 onlyMultiLine: boolean; 239 } 240 /** 241 * Request to obtain outlining spans in file. 242 */ 243 interface OutliningSpansRequest extends FileRequest { 244 command: CommandTypes.GetOutliningSpans; 245 } 246 interface OutliningSpan { 247 /** The span of the document to actually collapse. */ 248 textSpan: TextSpan; 249 /** The span of the document to display when the user hovers over the collapsed span. */ 250 hintSpan: TextSpan; 251 /** The text to display in the editor for the collapsed region. */ 252 bannerText: string; 253 /** 254 * Whether or not this region should be automatically collapsed when 255 * the 'Collapse to Definitions' command is invoked. 256 */ 257 autoCollapse: boolean; 258 /** 259 * Classification of the contents of the span 260 */ 261 kind: OutliningSpanKind; 262 } 263 /** 264 * Response to OutliningSpansRequest request. 265 */ 266 interface OutliningSpansResponse extends Response { 267 body?: OutliningSpan[]; 268 } 269 /** 270 * A request to get indentation for a location in file 271 */ 272 interface IndentationRequest extends FileLocationRequest { 273 command: CommandTypes.Indentation; 274 arguments: IndentationRequestArgs; 275 } 276 /** 277 * Response for IndentationRequest request. 278 */ 279 interface IndentationResponse extends Response { 280 body?: IndentationResult; 281 } 282 /** 283 * Indentation result representing where indentation should be placed 284 */ 285 interface IndentationResult { 286 /** 287 * The base position in the document that the indent should be relative to 288 */ 289 position: number; 290 /** 291 * The number of columns the indent should be at relative to the position's column. 292 */ 293 indentation: number; 294 } 295 /** 296 * Arguments for IndentationRequest request. 297 */ 298 interface IndentationRequestArgs extends FileLocationRequestArgs { 299 /** 300 * An optional set of settings to be used when computing indentation. 301 * If argument is omitted - then it will use settings for file that were previously set via 'configure' request or global settings. 302 */ 303 options?: EditorSettings; 304 } 305 /** 306 * Arguments for ProjectInfoRequest request. 307 */ 308 interface ProjectInfoRequestArgs extends FileRequestArgs { 309 /** 310 * Indicate if the file name list of the project is needed 311 */ 312 needFileNameList: boolean; 313 } 314 /** 315 * A request to get the project information of the current file. 316 */ 317 interface ProjectInfoRequest extends Request { 318 command: CommandTypes.ProjectInfo; 319 arguments: ProjectInfoRequestArgs; 320 } 321 /** 322 * A request to retrieve compiler options diagnostics for a project 323 */ 324 interface CompilerOptionsDiagnosticsRequest extends Request { 325 arguments: CompilerOptionsDiagnosticsRequestArgs; 326 } 327 /** 328 * Arguments for CompilerOptionsDiagnosticsRequest request. 329 */ 330 interface CompilerOptionsDiagnosticsRequestArgs { 331 /** 332 * Name of the project to retrieve compiler options diagnostics. 333 */ 334 projectFileName: string; 335 } 336 /** 337 * Response message body for "projectInfo" request 338 */ 339 interface ProjectInfo { 340 /** 341 * For configured project, this is the normalized path of the 'tsconfig.json' file 342 * For inferred project, this is undefined 343 */ 344 configFileName: string; 345 /** 346 * The list of normalized file name in the project, including 'lib.d.ts' 347 */ 348 fileNames?: string[]; 349 /** 350 * Indicates if the project has a active language service instance 351 */ 352 languageServiceDisabled?: boolean; 353 } 354 /** 355 * Represents diagnostic info that includes location of diagnostic in two forms 356 * - start position and length of the error span 357 * - startLocation and endLocation - a pair of Location objects that store start/end line and offset of the error span. 358 */ 359 interface DiagnosticWithLinePosition { 360 message: string; 361 start: number; 362 length: number; 363 startLocation: Location; 364 endLocation: Location; 365 category: string; 366 code: number; 367 /** May store more in future. For now, this will simply be `true` to indicate when a diagnostic is an unused-identifier diagnostic. */ 368 reportsUnnecessary?: {}; 369 reportsDeprecated?: {}; 370 relatedInformation?: DiagnosticRelatedInformation[]; 371 } 372 /** 373 * Response message for "projectInfo" request 374 */ 375 interface ProjectInfoResponse extends Response { 376 body?: ProjectInfo; 377 } 378 /** 379 * Request whose sole parameter is a file name. 380 */ 381 interface FileRequest extends Request { 382 arguments: FileRequestArgs; 383 } 384 /** 385 * Instances of this interface specify a location in a source file: 386 * (file, line, character offset), where line and character offset are 1-based. 387 */ 388 interface FileLocationRequestArgs extends FileRequestArgs { 389 /** 390 * The line number for the request (1-based). 391 */ 392 line: number; 393 /** 394 * The character offset (on the line) for the request (1-based). 395 */ 396 offset: number; 397 } 398 type FileLocationOrRangeRequestArgs = FileLocationRequestArgs | FileRangeRequestArgs; 399 /** 400 * Request refactorings at a given position or selection area. 401 */ 402 interface GetApplicableRefactorsRequest extends Request { 403 command: CommandTypes.GetApplicableRefactors; 404 arguments: GetApplicableRefactorsRequestArgs; 405 } 406 type GetApplicableRefactorsRequestArgs = FileLocationOrRangeRequestArgs & { 407 triggerReason?: RefactorTriggerReason; 408 }; 409 type RefactorTriggerReason = "implicit" | "invoked"; 410 /** 411 * Response is a list of available refactorings. 412 * Each refactoring exposes one or more "Actions"; a user selects one action to invoke a refactoring 413 */ 414 interface GetApplicableRefactorsResponse extends Response { 415 body?: ApplicableRefactorInfo[]; 416 } 417 /** 418 * A set of one or more available refactoring actions, grouped under a parent refactoring. 419 */ 420 interface ApplicableRefactorInfo { 421 /** 422 * The programmatic name of the refactoring 423 */ 424 name: string; 425 /** 426 * A description of this refactoring category to show to the user. 427 * If the refactoring gets inlined (see below), this text will not be visible. 428 */ 429 description: string; 430 /** 431 * Inlineable refactorings can have their actions hoisted out to the top level 432 * of a context menu. Non-inlineanable refactorings should always be shown inside 433 * their parent grouping. 434 * 435 * If not specified, this value is assumed to be 'true' 436 */ 437 inlineable?: boolean; 438 actions: RefactorActionInfo[]; 439 } 440 /** 441 * Represents a single refactoring action - for example, the "Extract Method..." refactor might 442 * offer several actions, each corresponding to a surround class or closure to extract into. 443 */ 444 interface RefactorActionInfo { 445 /** 446 * The programmatic name of the refactoring action 447 */ 448 name: string; 449 /** 450 * A description of this refactoring action to show to the user. 451 * If the parent refactoring is inlined away, this will be the only text shown, 452 * so this description should make sense by itself if the parent is inlineable=true 453 */ 454 description: string; 455 /** 456 * A message to show to the user if the refactoring cannot be applied in 457 * the current context. 458 */ 459 notApplicableReason?: string; 460 } 461 interface GetEditsForRefactorRequest extends Request { 462 command: CommandTypes.GetEditsForRefactor; 463 arguments: GetEditsForRefactorRequestArgs; 464 } 465 /** 466 * Request the edits that a particular refactoring action produces. 467 * Callers must specify the name of the refactor and the name of the action. 468 */ 469 type GetEditsForRefactorRequestArgs = FileLocationOrRangeRequestArgs & { 470 refactor: string; 471 action: string; 472 }; 473 interface GetEditsForRefactorResponse extends Response { 474 body?: RefactorEditInfo; 475 } 476 interface RefactorEditInfo { 477 edits: FileCodeEdits[]; 478 /** 479 * An optional location where the editor should start a rename operation once 480 * the refactoring edits have been applied 481 */ 482 renameLocation?: Location; 483 renameFilename?: string; 484 } 485 /** 486 * Organize imports by: 487 * 1) Removing unused imports 488 * 2) Coalescing imports from the same module 489 * 3) Sorting imports 490 */ 491 interface OrganizeImportsRequest extends Request { 492 command: CommandTypes.OrganizeImports; 493 arguments: OrganizeImportsRequestArgs; 494 } 495 type OrganizeImportsScope = GetCombinedCodeFixScope; 496 interface OrganizeImportsRequestArgs { 497 scope: OrganizeImportsScope; 498 } 499 interface OrganizeImportsResponse extends Response { 500 body: readonly FileCodeEdits[]; 501 } 502 interface GetEditsForFileRenameRequest extends Request { 503 command: CommandTypes.GetEditsForFileRename; 504 arguments: GetEditsForFileRenameRequestArgs; 505 } 506 /** Note: Paths may also be directories. */ 507 interface GetEditsForFileRenameRequestArgs { 508 readonly oldFilePath: string; 509 readonly newFilePath: string; 510 } 511 interface GetEditsForFileRenameResponse extends Response { 512 body: readonly FileCodeEdits[]; 513 } 514 /** 515 * Request for the available codefixes at a specific position. 516 */ 517 interface CodeFixRequest extends Request { 518 command: CommandTypes.GetCodeFixes; 519 arguments: CodeFixRequestArgs; 520 } 521 interface GetCombinedCodeFixRequest extends Request { 522 command: CommandTypes.GetCombinedCodeFix; 523 arguments: GetCombinedCodeFixRequestArgs; 524 } 525 interface GetCombinedCodeFixResponse extends Response { 526 body: CombinedCodeActions; 527 } 528 interface ApplyCodeActionCommandRequest extends Request { 529 command: CommandTypes.ApplyCodeActionCommand; 530 arguments: ApplyCodeActionCommandRequestArgs; 531 } 532 interface ApplyCodeActionCommandResponse extends Response { 533 } 534 interface FileRangeRequestArgs extends FileRequestArgs { 535 /** 536 * The line number for the request (1-based). 537 */ 538 startLine: number; 539 /** 540 * The character offset (on the line) for the request (1-based). 541 */ 542 startOffset: number; 543 /** 544 * The line number for the request (1-based). 545 */ 546 endLine: number; 547 /** 548 * The character offset (on the line) for the request (1-based). 549 */ 550 endOffset: number; 551 } 552 /** 553 * Instances of this interface specify errorcodes on a specific location in a sourcefile. 554 */ 555 interface CodeFixRequestArgs extends FileRangeRequestArgs { 556 /** 557 * Errorcodes we want to get the fixes for. 558 */ 559 errorCodes: readonly number[]; 560 } 561 interface GetCombinedCodeFixRequestArgs { 562 scope: GetCombinedCodeFixScope; 563 fixId: {}; 564 } 565 interface GetCombinedCodeFixScope { 566 type: "file"; 567 args: FileRequestArgs; 568 } 569 interface ApplyCodeActionCommandRequestArgs { 570 /** May also be an array of commands. */ 571 command: {}; 572 } 573 /** 574 * Response for GetCodeFixes request. 575 */ 576 interface GetCodeFixesResponse extends Response { 577 body?: CodeAction[]; 578 } 579 /** 580 * A request whose arguments specify a file location (file, line, col). 581 */ 582 interface FileLocationRequest extends FileRequest { 583 arguments: FileLocationRequestArgs; 584 } 585 /** 586 * A request to get codes of supported code fixes. 587 */ 588 interface GetSupportedCodeFixesRequest extends Request { 589 command: CommandTypes.GetSupportedCodeFixes; 590 } 591 /** 592 * A response for GetSupportedCodeFixesRequest request. 593 */ 594 interface GetSupportedCodeFixesResponse extends Response { 595 /** 596 * List of error codes supported by the server. 597 */ 598 body?: string[]; 599 } 600 /** 601 * Arguments in document highlight request; include: filesToSearch, file, 602 * line, offset. 603 */ 604 interface DocumentHighlightsRequestArgs extends FileLocationRequestArgs { 605 /** 606 * List of files to search for document highlights. 607 */ 608 filesToSearch: string[]; 609 } 610 /** 611 * Go to definition request; value of command field is 612 * "definition". Return response giving the file locations that 613 * define the symbol found in file at location line, col. 614 */ 615 interface DefinitionRequest extends FileLocationRequest { 616 command: CommandTypes.Definition; 617 } 618 interface DefinitionAndBoundSpanRequest extends FileLocationRequest { 619 readonly command: CommandTypes.DefinitionAndBoundSpan; 620 } 621 interface DefinitionAndBoundSpanResponse extends Response { 622 readonly body: DefinitionInfoAndBoundSpan; 623 } 624 /** 625 * Go to type request; value of command field is 626 * "typeDefinition". Return response giving the file locations that 627 * define the type for the symbol found in file at location line, col. 628 */ 629 interface TypeDefinitionRequest extends FileLocationRequest { 630 command: CommandTypes.TypeDefinition; 631 } 632 /** 633 * Go to implementation request; value of command field is 634 * "implementation". Return response giving the file locations that 635 * implement the symbol found in file at location line, col. 636 */ 637 interface ImplementationRequest extends FileLocationRequest { 638 command: CommandTypes.Implementation; 639 } 640 /** 641 * Location in source code expressed as (one-based) line and (one-based) column offset. 642 */ 643 interface Location { 644 line: number; 645 offset: number; 646 } 647 /** 648 * Object found in response messages defining a span of text in source code. 649 */ 650 interface TextSpan { 651 /** 652 * First character of the definition. 653 */ 654 start: Location; 655 /** 656 * One character past last character of the definition. 657 */ 658 end: Location; 659 } 660 /** 661 * Object found in response messages defining a span of text in a specific source file. 662 */ 663 interface FileSpan extends TextSpan { 664 /** 665 * File containing text span. 666 */ 667 file: string; 668 } 669 interface TextSpanWithContext extends TextSpan { 670 contextStart?: Location; 671 contextEnd?: Location; 672 } 673 interface FileSpanWithContext extends FileSpan, TextSpanWithContext { 674 } 675 interface DefinitionInfoAndBoundSpan { 676 definitions: readonly FileSpanWithContext[]; 677 textSpan: TextSpan; 678 } 679 /** 680 * Definition response message. Gives text range for definition. 681 */ 682 interface DefinitionResponse extends Response { 683 body?: FileSpanWithContext[]; 684 } 685 interface DefinitionInfoAndBoundSpanResponse extends Response { 686 body?: DefinitionInfoAndBoundSpan; 687 } 688 /** @deprecated Use `DefinitionInfoAndBoundSpanResponse` instead. */ 689 type DefinitionInfoAndBoundSpanReponse = DefinitionInfoAndBoundSpanResponse; 690 /** 691 * Definition response message. Gives text range for definition. 692 */ 693 interface TypeDefinitionResponse extends Response { 694 body?: FileSpanWithContext[]; 695 } 696 /** 697 * Implementation response message. Gives text range for implementations. 698 */ 699 interface ImplementationResponse extends Response { 700 body?: FileSpanWithContext[]; 701 } 702 /** 703 * Request to get brace completion for a location in the file. 704 */ 705 interface BraceCompletionRequest extends FileLocationRequest { 706 command: CommandTypes.BraceCompletion; 707 arguments: BraceCompletionRequestArgs; 708 } 709 /** 710 * Argument for BraceCompletionRequest request. 711 */ 712 interface BraceCompletionRequestArgs extends FileLocationRequestArgs { 713 /** 714 * Kind of opening brace 715 */ 716 openingBrace: string; 717 } 718 interface JsxClosingTagRequest extends FileLocationRequest { 719 readonly command: CommandTypes.JsxClosingTag; 720 readonly arguments: JsxClosingTagRequestArgs; 721 } 722 interface JsxClosingTagRequestArgs extends FileLocationRequestArgs { 723 } 724 interface JsxClosingTagResponse extends Response { 725 readonly body: TextInsertion; 726 } 727 /** 728 * @deprecated 729 * Get occurrences request; value of command field is 730 * "occurrences". Return response giving spans that are relevant 731 * in the file at a given line and column. 732 */ 733 interface OccurrencesRequest extends FileLocationRequest { 734 command: CommandTypes.Occurrences; 735 } 736 /** @deprecated */ 737 interface OccurrencesResponseItem extends FileSpanWithContext { 738 /** 739 * True if the occurrence is a write location, false otherwise. 740 */ 741 isWriteAccess: boolean; 742 /** 743 * True if the occurrence is in a string, undefined otherwise; 744 */ 745 isInString?: true; 746 } 747 /** @deprecated */ 748 interface OccurrencesResponse extends Response { 749 body?: OccurrencesResponseItem[]; 750 } 751 /** 752 * Get document highlights request; value of command field is 753 * "documentHighlights". Return response giving spans that are relevant 754 * in the file at a given line and column. 755 */ 756 interface DocumentHighlightsRequest extends FileLocationRequest { 757 command: CommandTypes.DocumentHighlights; 758 arguments: DocumentHighlightsRequestArgs; 759 } 760 /** 761 * Span augmented with extra information that denotes the kind of the highlighting to be used for span. 762 */ 763 interface HighlightSpan extends TextSpanWithContext { 764 kind: HighlightSpanKind; 765 } 766 /** 767 * Represents a set of highligh spans for a give name 768 */ 769 interface DocumentHighlightsItem { 770 /** 771 * File containing highlight spans. 772 */ 773 file: string; 774 /** 775 * Spans to highlight in file. 776 */ 777 highlightSpans: HighlightSpan[]; 778 } 779 /** 780 * Response for a DocumentHighlightsRequest request. 781 */ 782 interface DocumentHighlightsResponse extends Response { 783 body?: DocumentHighlightsItem[]; 784 } 785 /** 786 * Find references request; value of command field is 787 * "references". Return response giving the file locations that 788 * reference the symbol found in file at location line, col. 789 */ 790 interface ReferencesRequest extends FileLocationRequest { 791 command: CommandTypes.References; 792 } 793 interface ReferencesResponseItem extends FileSpanWithContext { 794 /** Text of line containing the reference. Including this 795 * with the response avoids latency of editor loading files 796 * to show text of reference line (the server already has 797 * loaded the referencing files). 798 */ 799 lineText: string; 800 /** 801 * True if reference is a write location, false otherwise. 802 */ 803 isWriteAccess: boolean; 804 /** 805 * True if reference is a definition, false otherwise. 806 */ 807 isDefinition: boolean; 808 } 809 /** 810 * The body of a "references" response message. 811 */ 812 interface ReferencesResponseBody { 813 /** 814 * The file locations referencing the symbol. 815 */ 816 refs: readonly ReferencesResponseItem[]; 817 /** 818 * The name of the symbol. 819 */ 820 symbolName: string; 821 /** 822 * The start character offset of the symbol (on the line provided by the references request). 823 */ 824 symbolStartOffset: number; 825 /** 826 * The full display name of the symbol. 827 */ 828 symbolDisplayString: string; 829 } 830 /** 831 * Response to "references" request. 832 */ 833 interface ReferencesResponse extends Response { 834 body?: ReferencesResponseBody; 835 } 836 /** 837 * Argument for RenameRequest request. 838 */ 839 interface RenameRequestArgs extends FileLocationRequestArgs { 840 /** 841 * Should text at specified location be found/changed in comments? 842 */ 843 findInComments?: boolean; 844 /** 845 * Should text at specified location be found/changed in strings? 846 */ 847 findInStrings?: boolean; 848 } 849 /** 850 * Rename request; value of command field is "rename". Return 851 * response giving the file locations that reference the symbol 852 * found in file at location line, col. Also return full display 853 * name of the symbol so that client can print it unambiguously. 854 */ 855 interface RenameRequest extends FileLocationRequest { 856 command: CommandTypes.Rename; 857 arguments: RenameRequestArgs; 858 } 859 /** 860 * Information about the item to be renamed. 861 */ 862 type RenameInfo = RenameInfoSuccess | RenameInfoFailure; 863 interface RenameInfoSuccess { 864 /** 865 * True if item can be renamed. 866 */ 867 canRename: true; 868 /** 869 * File or directory to rename. 870 * If set, `getEditsForFileRename` should be called instead of `findRenameLocations`. 871 */ 872 fileToRename?: string; 873 /** 874 * Display name of the item to be renamed. 875 */ 876 displayName: string; 877 /** 878 * Full display name of item to be renamed. 879 */ 880 fullDisplayName: string; 881 /** 882 * The items's kind (such as 'className' or 'parameterName' or plain 'text'). 883 */ 884 kind: ScriptElementKind; 885 /** 886 * Optional modifiers for the kind (such as 'public'). 887 */ 888 kindModifiers: string; 889 /** Span of text to rename. */ 890 triggerSpan: TextSpan; 891 } 892 interface RenameInfoFailure { 893 canRename: false; 894 /** 895 * Error message if item can not be renamed. 896 */ 897 localizedErrorMessage: string; 898 } 899 /** 900 * A group of text spans, all in 'file'. 901 */ 902 interface SpanGroup { 903 /** The file to which the spans apply */ 904 file: string; 905 /** The text spans in this group */ 906 locs: RenameTextSpan[]; 907 } 908 interface RenameTextSpan extends TextSpanWithContext { 909 readonly prefixText?: string; 910 readonly suffixText?: string; 911 } 912 interface RenameResponseBody { 913 /** 914 * Information about the item to be renamed. 915 */ 916 info: RenameInfo; 917 /** 918 * An array of span groups (one per file) that refer to the item to be renamed. 919 */ 920 locs: readonly SpanGroup[]; 921 } 922 /** 923 * Rename response message. 924 */ 925 interface RenameResponse extends Response { 926 body?: RenameResponseBody; 927 } 928 /** 929 * Represents a file in external project. 930 * External project is project whose set of files, compilation options and open\close state 931 * is maintained by the client (i.e. if all this data come from .csproj file in Visual Studio). 932 * External project will exist even if all files in it are closed and should be closed explicitly. 933 * If external project includes one or more tsconfig.json/jsconfig.json files then tsserver will 934 * create configured project for every config file but will maintain a link that these projects were created 935 * as a result of opening external project so they should be removed once external project is closed. 936 */ 937 interface ExternalFile { 938 /** 939 * Name of file file 940 */ 941 fileName: string; 942 /** 943 * Script kind of the file 944 */ 945 scriptKind?: ScriptKindName | ts.ScriptKind; 946 /** 947 * Whether file has mixed content (i.e. .cshtml file that combines html markup with C#/JavaScript) 948 */ 949 hasMixedContent?: boolean; 950 /** 951 * Content of the file 952 */ 953 content?: string; 954 } 955 /** 956 * Represent an external project 957 */ 958 interface ExternalProject { 959 /** 960 * Project name 961 */ 962 projectFileName: string; 963 /** 964 * List of root files in project 965 */ 966 rootFiles: ExternalFile[]; 967 /** 968 * Compiler options for the project 969 */ 970 options: ExternalProjectCompilerOptions; 971 /** 972 * @deprecated typingOptions. Use typeAcquisition instead 973 */ 974 typingOptions?: TypeAcquisition; 975 /** 976 * Explicitly specified type acquisition for the project 977 */ 978 typeAcquisition?: TypeAcquisition; 979 } 980 interface CompileOnSaveMixin { 981 /** 982 * If compile on save is enabled for the project 983 */ 984 compileOnSave?: boolean; 985 } 986 /** 987 * For external projects, some of the project settings are sent together with 988 * compiler settings. 989 */ 990 type ExternalProjectCompilerOptions = CompilerOptions & CompileOnSaveMixin & WatchOptions; 991 interface FileWithProjectReferenceRedirectInfo { 992 /** 993 * Name of file 994 */ 995 fileName: string; 996 /** 997 * True if the file is primarily included in a referenced project 998 */ 999 isSourceOfProjectReferenceRedirect: boolean; 1000 } 1001 /** 1002 * Represents a set of changes that happen in project 1003 */ 1004 interface ProjectChanges { 1005 /** 1006 * List of added files 1007 */ 1008 added: string[] | FileWithProjectReferenceRedirectInfo[]; 1009 /** 1010 * List of removed files 1011 */ 1012 removed: string[] | FileWithProjectReferenceRedirectInfo[]; 1013 /** 1014 * List of updated files 1015 */ 1016 updated: string[] | FileWithProjectReferenceRedirectInfo[]; 1017 /** 1018 * List of files that have had their project reference redirect status updated 1019 * Only provided when the synchronizeProjectList request has includeProjectReferenceRedirectInfo set to true 1020 */ 1021 updatedRedirects?: FileWithProjectReferenceRedirectInfo[]; 1022 } 1023 /** 1024 * Information found in a configure request. 1025 */ 1026 interface ConfigureRequestArguments { 1027 /** 1028 * Information about the host, for example 'Emacs 24.4' or 1029 * 'Sublime Text version 3075' 1030 */ 1031 hostInfo?: string; 1032 /** 1033 * If present, tab settings apply only to this file. 1034 */ 1035 file?: string; 1036 /** 1037 * The format options to use during formatting and other code editing features. 1038 */ 1039 formatOptions?: FormatCodeSettings; 1040 preferences?: UserPreferences; 1041 /** 1042 * The host's additional supported .js file extensions 1043 */ 1044 extraFileExtensions?: FileExtensionInfo[]; 1045 watchOptions?: WatchOptions; 1046 } 1047 const enum WatchFileKind { 1048 FixedPollingInterval = "FixedPollingInterval", 1049 PriorityPollingInterval = "PriorityPollingInterval", 1050 DynamicPriorityPolling = "DynamicPriorityPolling", 1051 UseFsEvents = "UseFsEvents", 1052 UseFsEventsOnParentDirectory = "UseFsEventsOnParentDirectory" 1053 } 1054 const enum WatchDirectoryKind { 1055 UseFsEvents = "UseFsEvents", 1056 FixedPollingInterval = "FixedPollingInterval", 1057 DynamicPriorityPolling = "DynamicPriorityPolling" 1058 } 1059 const enum PollingWatchKind { 1060 FixedInterval = "FixedInterval", 1061 PriorityInterval = "PriorityInterval", 1062 DynamicPriority = "DynamicPriority" 1063 } 1064 interface WatchOptions { 1065 watchFile?: WatchFileKind | ts.WatchFileKind; 1066 watchDirectory?: WatchDirectoryKind | ts.WatchDirectoryKind; 1067 fallbackPolling?: PollingWatchKind | ts.PollingWatchKind; 1068 synchronousWatchDirectory?: boolean; 1069 [option: string]: CompilerOptionsValue | undefined; 1070 } 1071 /** 1072 * Configure request; value of command field is "configure". Specifies 1073 * host information, such as host type, tab size, and indent size. 1074 */ 1075 interface ConfigureRequest extends Request { 1076 command: CommandTypes.Configure; 1077 arguments: ConfigureRequestArguments; 1078 } 1079 /** 1080 * Response to "configure" request. This is just an acknowledgement, so 1081 * no body field is required. 1082 */ 1083 interface ConfigureResponse extends Response { 1084 } 1085 interface ConfigurePluginRequestArguments { 1086 pluginName: string; 1087 configuration: any; 1088 } 1089 interface ConfigurePluginRequest extends Request { 1090 command: CommandTypes.ConfigurePlugin; 1091 arguments: ConfigurePluginRequestArguments; 1092 } 1093 interface ConfigurePluginResponse extends Response { 1094 } 1095 interface SelectionRangeRequest extends FileRequest { 1096 command: CommandTypes.SelectionRange; 1097 arguments: SelectionRangeRequestArgs; 1098 } 1099 interface SelectionRangeRequestArgs extends FileRequestArgs { 1100 locations: Location[]; 1101 } 1102 interface SelectionRangeResponse extends Response { 1103 body?: SelectionRange[]; 1104 } 1105 interface SelectionRange { 1106 textSpan: TextSpan; 1107 parent?: SelectionRange; 1108 } 1109 interface ToggleLineCommentRequest extends FileRequest { 1110 command: CommandTypes.ToggleLineComment; 1111 arguments: FileRangeRequestArgs; 1112 } 1113 interface ToggleMultilineCommentRequest extends FileRequest { 1114 command: CommandTypes.ToggleMultilineComment; 1115 arguments: FileRangeRequestArgs; 1116 } 1117 interface CommentSelectionRequest extends FileRequest { 1118 command: CommandTypes.CommentSelection; 1119 arguments: FileRangeRequestArgs; 1120 } 1121 interface UncommentSelectionRequest extends FileRequest { 1122 command: CommandTypes.UncommentSelection; 1123 arguments: FileRangeRequestArgs; 1124 } 1125 /** 1126 * Information found in an "open" request. 1127 */ 1128 interface OpenRequestArgs extends FileRequestArgs { 1129 /** 1130 * Used when a version of the file content is known to be more up to date than the one on disk. 1131 * Then the known content will be used upon opening instead of the disk copy 1132 */ 1133 fileContent?: string; 1134 /** 1135 * Used to specify the script kind of the file explicitly. It could be one of the following: 1136 * "TS", "JS", "TSX", "JSX" 1137 */ 1138 scriptKindName?: ScriptKindName; 1139 /** 1140 * Used to limit the searching for project config file. If given the searching will stop at this 1141 * root path; otherwise it will go all the way up to the dist root path. 1142 */ 1143 projectRootPath?: string; 1144 } 1145 type ScriptKindName = "TS" | "JS" | "TSX" | "JSX"; 1146 /** 1147 * Open request; value of command field is "open". Notify the 1148 * server that the client has file open. The server will not 1149 * monitor the filesystem for changes in this file and will assume 1150 * that the client is updating the server (using the change and/or 1151 * reload messages) when the file changes. Server does not currently 1152 * send a response to an open request. 1153 */ 1154 interface OpenRequest extends Request { 1155 command: CommandTypes.Open; 1156 arguments: OpenRequestArgs; 1157 } 1158 /** 1159 * Request to open or update external project 1160 */ 1161 interface OpenExternalProjectRequest extends Request { 1162 command: CommandTypes.OpenExternalProject; 1163 arguments: OpenExternalProjectArgs; 1164 } 1165 /** 1166 * Arguments to OpenExternalProjectRequest request 1167 */ 1168 type OpenExternalProjectArgs = ExternalProject; 1169 /** 1170 * Request to open multiple external projects 1171 */ 1172 interface OpenExternalProjectsRequest extends Request { 1173 command: CommandTypes.OpenExternalProjects; 1174 arguments: OpenExternalProjectsArgs; 1175 } 1176 /** 1177 * Arguments to OpenExternalProjectsRequest 1178 */ 1179 interface OpenExternalProjectsArgs { 1180 /** 1181 * List of external projects to open or update 1182 */ 1183 projects: ExternalProject[]; 1184 } 1185 /** 1186 * Response to OpenExternalProjectRequest request. This is just an acknowledgement, so 1187 * no body field is required. 1188 */ 1189 interface OpenExternalProjectResponse extends Response { 1190 } 1191 /** 1192 * Response to OpenExternalProjectsRequest request. This is just an acknowledgement, so 1193 * no body field is required. 1194 */ 1195 interface OpenExternalProjectsResponse extends Response { 1196 } 1197 /** 1198 * Request to close external project. 1199 */ 1200 interface CloseExternalProjectRequest extends Request { 1201 command: CommandTypes.CloseExternalProject; 1202 arguments: CloseExternalProjectRequestArgs; 1203 } 1204 /** 1205 * Arguments to CloseExternalProjectRequest request 1206 */ 1207 interface CloseExternalProjectRequestArgs { 1208 /** 1209 * Name of the project to close 1210 */ 1211 projectFileName: string; 1212 } 1213 /** 1214 * Response to CloseExternalProjectRequest request. This is just an acknowledgement, so 1215 * no body field is required. 1216 */ 1217 interface CloseExternalProjectResponse extends Response { 1218 } 1219 /** 1220 * Request to synchronize list of open files with the client 1221 */ 1222 interface UpdateOpenRequest extends Request { 1223 command: CommandTypes.UpdateOpen; 1224 arguments: UpdateOpenRequestArgs; 1225 } 1226 /** 1227 * Arguments to UpdateOpenRequest 1228 */ 1229 interface UpdateOpenRequestArgs { 1230 /** 1231 * List of newly open files 1232 */ 1233 openFiles?: OpenRequestArgs[]; 1234 /** 1235 * List of open files files that were changes 1236 */ 1237 changedFiles?: FileCodeEdits[]; 1238 /** 1239 * List of files that were closed 1240 */ 1241 closedFiles?: string[]; 1242 } 1243 /** 1244 * External projects have a typeAcquisition option so they need to be added separately to compiler options for inferred projects. 1245 */ 1246 type InferredProjectCompilerOptions = ExternalProjectCompilerOptions & TypeAcquisition; 1247 /** 1248 * Request to set compiler options for inferred projects. 1249 * External projects are opened / closed explicitly. 1250 * Configured projects are opened when user opens loose file that has 'tsconfig.json' or 'jsconfig.json' anywhere in one of containing folders. 1251 * This configuration file will be used to obtain a list of files and configuration settings for the project. 1252 * Inferred projects are created when user opens a loose file that is not the part of external project 1253 * or configured project and will contain only open file and transitive closure of referenced files if 'useOneInferredProject' is false, 1254 * or all open loose files and its transitive closure of referenced files if 'useOneInferredProject' is true. 1255 */ 1256 interface SetCompilerOptionsForInferredProjectsRequest extends Request { 1257 command: CommandTypes.CompilerOptionsForInferredProjects; 1258 arguments: SetCompilerOptionsForInferredProjectsArgs; 1259 } 1260 /** 1261 * Argument for SetCompilerOptionsForInferredProjectsRequest request. 1262 */ 1263 interface SetCompilerOptionsForInferredProjectsArgs { 1264 /** 1265 * Compiler options to be used with inferred projects. 1266 */ 1267 options: InferredProjectCompilerOptions; 1268 /** 1269 * Specifies the project root path used to scope compiler options. 1270 * It is an error to provide this property if the server has not been started with 1271 * `useInferredProjectPerProjectRoot` enabled. 1272 */ 1273 projectRootPath?: string; 1274 } 1275 /** 1276 * Response to SetCompilerOptionsForInferredProjectsResponse request. This is just an acknowledgement, so 1277 * no body field is required. 1278 */ 1279 interface SetCompilerOptionsForInferredProjectsResponse extends Response { 1280 } 1281 /** 1282 * Exit request; value of command field is "exit". Ask the server process 1283 * to exit. 1284 */ 1285 interface ExitRequest extends Request { 1286 command: CommandTypes.Exit; 1287 } 1288 /** 1289 * Close request; value of command field is "close". Notify the 1290 * server that the client has closed a previously open file. If 1291 * file is still referenced by open files, the server will resume 1292 * monitoring the filesystem for changes to file. Server does not 1293 * currently send a response to a close request. 1294 */ 1295 interface CloseRequest extends FileRequest { 1296 command: CommandTypes.Close; 1297 } 1298 /** 1299 * Request to obtain the list of files that should be regenerated if target file is recompiled. 1300 * NOTE: this us query-only operation and does not generate any output on disk. 1301 */ 1302 interface CompileOnSaveAffectedFileListRequest extends FileRequest { 1303 command: CommandTypes.CompileOnSaveAffectedFileList; 1304 } 1305 /** 1306 * Contains a list of files that should be regenerated in a project 1307 */ 1308 interface CompileOnSaveAffectedFileListSingleProject { 1309 /** 1310 * Project name 1311 */ 1312 projectFileName: string; 1313 /** 1314 * List of files names that should be recompiled 1315 */ 1316 fileNames: string[]; 1317 /** 1318 * true if project uses outFile or out compiler option 1319 */ 1320 projectUsesOutFile: boolean; 1321 } 1322 /** 1323 * Response for CompileOnSaveAffectedFileListRequest request; 1324 */ 1325 interface CompileOnSaveAffectedFileListResponse extends Response { 1326 body: CompileOnSaveAffectedFileListSingleProject[]; 1327 } 1328 /** 1329 * Request to recompile the file. All generated outputs (.js, .d.ts or .js.map files) is written on disk. 1330 */ 1331 interface CompileOnSaveEmitFileRequest extends FileRequest { 1332 command: CommandTypes.CompileOnSaveEmitFile; 1333 arguments: CompileOnSaveEmitFileRequestArgs; 1334 } 1335 /** 1336 * Arguments for CompileOnSaveEmitFileRequest 1337 */ 1338 interface CompileOnSaveEmitFileRequestArgs extends FileRequestArgs { 1339 /** 1340 * if true - then file should be recompiled even if it does not have any changes. 1341 */ 1342 forced?: boolean; 1343 includeLinePosition?: boolean; 1344 /** if true - return response as object with emitSkipped and diagnostics */ 1345 richResponse?: boolean; 1346 } 1347 interface CompileOnSaveEmitFileResponse extends Response { 1348 body: boolean | EmitResult; 1349 } 1350 interface EmitResult { 1351 emitSkipped: boolean; 1352 diagnostics: Diagnostic[] | DiagnosticWithLinePosition[]; 1353 } 1354 /** 1355 * Quickinfo request; value of command field is 1356 * "quickinfo". Return response giving a quick type and 1357 * documentation string for the symbol found in file at location 1358 * line, col. 1359 */ 1360 interface QuickInfoRequest extends FileLocationRequest { 1361 command: CommandTypes.Quickinfo; 1362 } 1363 /** 1364 * Body of QuickInfoResponse. 1365 */ 1366 interface QuickInfoResponseBody { 1367 /** 1368 * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). 1369 */ 1370 kind: ScriptElementKind; 1371 /** 1372 * Optional modifiers for the kind (such as 'public'). 1373 */ 1374 kindModifiers: string; 1375 /** 1376 * Starting file location of symbol. 1377 */ 1378 start: Location; 1379 /** 1380 * One past last character of symbol. 1381 */ 1382 end: Location; 1383 /** 1384 * Type and kind of symbol. 1385 */ 1386 displayString: string; 1387 /** 1388 * Documentation associated with symbol. 1389 */ 1390 documentation: string; 1391 /** 1392 * JSDoc tags associated with symbol. 1393 */ 1394 tags: JSDocTagInfo[]; 1395 } 1396 /** 1397 * Quickinfo response message. 1398 */ 1399 interface QuickInfoResponse extends Response { 1400 body?: QuickInfoResponseBody; 1401 } 1402 /** 1403 * Arguments for format messages. 1404 */ 1405 interface FormatRequestArgs extends FileLocationRequestArgs { 1406 /** 1407 * Last line of range for which to format text in file. 1408 */ 1409 endLine: number; 1410 /** 1411 * Character offset on last line of range for which to format text in file. 1412 */ 1413 endOffset: number; 1414 /** 1415 * Format options to be used. 1416 */ 1417 options?: FormatCodeSettings; 1418 } 1419 /** 1420 * Format request; value of command field is "format". Return 1421 * response giving zero or more edit instructions. The edit 1422 * instructions will be sorted in file order. Applying the edit 1423 * instructions in reverse to file will result in correctly 1424 * reformatted text. 1425 */ 1426 interface FormatRequest extends FileLocationRequest { 1427 command: CommandTypes.Format; 1428 arguments: FormatRequestArgs; 1429 } 1430 /** 1431 * Object found in response messages defining an editing 1432 * instruction for a span of text in source code. The effect of 1433 * this instruction is to replace the text starting at start and 1434 * ending one character before end with newText. For an insertion, 1435 * the text span is empty. For a deletion, newText is empty. 1436 */ 1437 interface CodeEdit { 1438 /** 1439 * First character of the text span to edit. 1440 */ 1441 start: Location; 1442 /** 1443 * One character past last character of the text span to edit. 1444 */ 1445 end: Location; 1446 /** 1447 * Replace the span defined above with this string (may be 1448 * the empty string). 1449 */ 1450 newText: string; 1451 } 1452 interface FileCodeEdits { 1453 fileName: string; 1454 textChanges: CodeEdit[]; 1455 } 1456 interface CodeFixResponse extends Response { 1457 /** The code actions that are available */ 1458 body?: CodeFixAction[]; 1459 } 1460 interface CodeAction { 1461 /** Description of the code action to display in the UI of the editor */ 1462 description: string; 1463 /** Text changes to apply to each file as part of the code action */ 1464 changes: FileCodeEdits[]; 1465 /** A command is an opaque object that should be passed to `ApplyCodeActionCommandRequestArgs` without modification. */ 1466 commands?: {}[]; 1467 } 1468 interface CombinedCodeActions { 1469 changes: readonly FileCodeEdits[]; 1470 commands?: readonly {}[]; 1471 } 1472 interface CodeFixAction extends CodeAction { 1473 /** Short name to identify the fix, for use by telemetry. */ 1474 fixName: string; 1475 /** 1476 * If present, one may call 'getCombinedCodeFix' with this fixId. 1477 * This may be omitted to indicate that the code fix can't be applied in a group. 1478 */ 1479 fixId?: {}; 1480 /** Should be present if and only if 'fixId' is. */ 1481 fixAllDescription?: string; 1482 } 1483 /** 1484 * Format and format on key response message. 1485 */ 1486 interface FormatResponse extends Response { 1487 body?: CodeEdit[]; 1488 } 1489 /** 1490 * Arguments for format on key messages. 1491 */ 1492 interface FormatOnKeyRequestArgs extends FileLocationRequestArgs { 1493 /** 1494 * Key pressed (';', '\n', or '}'). 1495 */ 1496 key: string; 1497 options?: FormatCodeSettings; 1498 } 1499 /** 1500 * Format on key request; value of command field is 1501 * "formatonkey". Given file location and key typed (as string), 1502 * return response giving zero or more edit instructions. The 1503 * edit instructions will be sorted in file order. Applying the 1504 * edit instructions in reverse to file will result in correctly 1505 * reformatted text. 1506 */ 1507 interface FormatOnKeyRequest extends FileLocationRequest { 1508 command: CommandTypes.Formatonkey; 1509 arguments: FormatOnKeyRequestArgs; 1510 } 1511 type CompletionsTriggerCharacter = "." | '"' | "'" | "`" | "/" | "@" | "<" | "#"; 1512 /** 1513 * Arguments for completions messages. 1514 */ 1515 interface CompletionsRequestArgs extends FileLocationRequestArgs { 1516 /** 1517 * Optional prefix to apply to possible completions. 1518 */ 1519 prefix?: string; 1520 /** 1521 * Character that was responsible for triggering completion. 1522 * Should be `undefined` if a user manually requested completion. 1523 */ 1524 triggerCharacter?: CompletionsTriggerCharacter; 1525 /** 1526 * @deprecated Use UserPreferences.includeCompletionsForModuleExports 1527 */ 1528 includeExternalModuleExports?: boolean; 1529 /** 1530 * @deprecated Use UserPreferences.includeCompletionsWithInsertText 1531 */ 1532 includeInsertTextCompletions?: boolean; 1533 } 1534 /** 1535 * Completions request; value of command field is "completions". 1536 * Given a file location (file, line, col) and a prefix (which may 1537 * be the empty string), return the possible completions that 1538 * begin with prefix. 1539 */ 1540 interface CompletionsRequest extends FileLocationRequest { 1541 command: CommandTypes.Completions | CommandTypes.CompletionInfo; 1542 arguments: CompletionsRequestArgs; 1543 } 1544 /** 1545 * Arguments for completion details request. 1546 */ 1547 interface CompletionDetailsRequestArgs extends FileLocationRequestArgs { 1548 /** 1549 * Names of one or more entries for which to obtain details. 1550 */ 1551 entryNames: (string | CompletionEntryIdentifier)[]; 1552 } 1553 interface CompletionEntryIdentifier { 1554 name: string; 1555 source?: string; 1556 } 1557 /** 1558 * Completion entry details request; value of command field is 1559 * "completionEntryDetails". Given a file location (file, line, 1560 * col) and an array of completion entry names return more 1561 * detailed information for each completion entry. 1562 */ 1563 interface CompletionDetailsRequest extends FileLocationRequest { 1564 command: CommandTypes.CompletionDetails; 1565 arguments: CompletionDetailsRequestArgs; 1566 } 1567 /** 1568 * Part of a symbol description. 1569 */ 1570 interface SymbolDisplayPart { 1571 /** 1572 * Text of an item describing the symbol. 1573 */ 1574 text: string; 1575 /** 1576 * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). 1577 */ 1578 kind: string; 1579 } 1580 /** 1581 * An item found in a completion response. 1582 */ 1583 interface CompletionEntry { 1584 /** 1585 * The symbol's name. 1586 */ 1587 name: string; 1588 /** 1589 * The symbol's kind (such as 'className' or 'parameterName'). 1590 */ 1591 kind: ScriptElementKind; 1592 /** 1593 * Optional modifiers for the kind (such as 'public'). 1594 */ 1595 kindModifiers?: string; 1596 /** 1597 * A string that is used for comparing completion items so that they can be ordered. This 1598 * is often the same as the name but may be different in certain circumstances. 1599 */ 1600 sortText: string; 1601 /** 1602 * Text to insert instead of `name`. 1603 * This is used to support bracketed completions; If `name` might be "a-b" but `insertText` would be `["a-b"]`, 1604 * coupled with `replacementSpan` to replace a dotted access with a bracket access. 1605 */ 1606 insertText?: string; 1607 /** 1608 * An optional span that indicates the text to be replaced by this completion item. 1609 * If present, this span should be used instead of the default one. 1610 * It will be set if the required span differs from the one generated by the default replacement behavior. 1611 */ 1612 replacementSpan?: TextSpan; 1613 /** 1614 * Indicates whether commiting this completion entry will require additional code actions to be 1615 * made to avoid errors. The CompletionEntryDetails will have these actions. 1616 */ 1617 hasAction?: true; 1618 /** 1619 * Identifier (not necessarily human-readable) identifying where this completion came from. 1620 */ 1621 source?: string; 1622 /** 1623 * If true, this completion should be highlighted as recommended. There will only be one of these. 1624 * This will be set when we know the user should write an expression with a certain type and that type is an enum or constructable class. 1625 * Then either that enum/class or a namespace containing it will be the recommended symbol. 1626 */ 1627 isRecommended?: true; 1628 /** 1629 * If true, this completion was generated from traversing the name table of an unchecked JS file, 1630 * and therefore may not be accurate. 1631 */ 1632 isFromUncheckedFile?: true; 1633 /** 1634 * If true, this completion was for an auto-import of a module not yet in the program, but listed 1635 * in the project package.json. 1636 */ 1637 isPackageJsonImport?: true; 1638 } 1639 /** 1640 * Additional completion entry details, available on demand 1641 */ 1642 interface CompletionEntryDetails { 1643 /** 1644 * The symbol's name. 1645 */ 1646 name: string; 1647 /** 1648 * The symbol's kind (such as 'className' or 'parameterName'). 1649 */ 1650 kind: ScriptElementKind; 1651 /** 1652 * Optional modifiers for the kind (such as 'public'). 1653 */ 1654 kindModifiers: string; 1655 /** 1656 * Display parts of the symbol (similar to quick info). 1657 */ 1658 displayParts: SymbolDisplayPart[]; 1659 /** 1660 * Documentation strings for the symbol. 1661 */ 1662 documentation?: SymbolDisplayPart[]; 1663 /** 1664 * JSDoc tags for the symbol. 1665 */ 1666 tags?: JSDocTagInfo[]; 1667 /** 1668 * The associated code actions for this entry 1669 */ 1670 codeActions?: CodeAction[]; 1671 /** 1672 * Human-readable description of the `source` from the CompletionEntry. 1673 */ 1674 source?: SymbolDisplayPart[]; 1675 } 1676 /** @deprecated Prefer CompletionInfoResponse, which supports several top-level fields in addition to the array of entries. */ 1677 interface CompletionsResponse extends Response { 1678 body?: CompletionEntry[]; 1679 } 1680 interface CompletionInfoResponse extends Response { 1681 body?: CompletionInfo; 1682 } 1683 interface CompletionInfo { 1684 readonly isGlobalCompletion: boolean; 1685 readonly isMemberCompletion: boolean; 1686 readonly isNewIdentifierLocation: boolean; 1687 /** 1688 * In the absence of `CompletionEntry["replacementSpan"]`, the editor may choose whether to use 1689 * this span or its default one. If `CompletionEntry["replacementSpan"]` is defined, that span 1690 * must be used to commit that completion entry. 1691 */ 1692 readonly optionalReplacementSpan?: TextSpan; 1693 readonly entries: readonly CompletionEntry[]; 1694 } 1695 interface CompletionDetailsResponse extends Response { 1696 body?: CompletionEntryDetails[]; 1697 } 1698 /** 1699 * Signature help information for a single parameter 1700 */ 1701 interface SignatureHelpParameter { 1702 /** 1703 * The parameter's name 1704 */ 1705 name: string; 1706 /** 1707 * Documentation of the parameter. 1708 */ 1709 documentation: SymbolDisplayPart[]; 1710 /** 1711 * Display parts of the parameter. 1712 */ 1713 displayParts: SymbolDisplayPart[]; 1714 /** 1715 * Whether the parameter is optional or not. 1716 */ 1717 isOptional: boolean; 1718 } 1719 /** 1720 * Represents a single signature to show in signature help. 1721 */ 1722 interface SignatureHelpItem { 1723 /** 1724 * Whether the signature accepts a variable number of arguments. 1725 */ 1726 isVariadic: boolean; 1727 /** 1728 * The prefix display parts. 1729 */ 1730 prefixDisplayParts: SymbolDisplayPart[]; 1731 /** 1732 * The suffix display parts. 1733 */ 1734 suffixDisplayParts: SymbolDisplayPart[]; 1735 /** 1736 * The separator display parts. 1737 */ 1738 separatorDisplayParts: SymbolDisplayPart[]; 1739 /** 1740 * The signature helps items for the parameters. 1741 */ 1742 parameters: SignatureHelpParameter[]; 1743 /** 1744 * The signature's documentation 1745 */ 1746 documentation: SymbolDisplayPart[]; 1747 /** 1748 * The signature's JSDoc tags 1749 */ 1750 tags: JSDocTagInfo[]; 1751 } 1752 /** 1753 * Signature help items found in the response of a signature help request. 1754 */ 1755 interface SignatureHelpItems { 1756 /** 1757 * The signature help items. 1758 */ 1759 items: SignatureHelpItem[]; 1760 /** 1761 * The span for which signature help should appear on a signature 1762 */ 1763 applicableSpan: TextSpan; 1764 /** 1765 * The item selected in the set of available help items. 1766 */ 1767 selectedItemIndex: number; 1768 /** 1769 * The argument selected in the set of parameters. 1770 */ 1771 argumentIndex: number; 1772 /** 1773 * The argument count 1774 */ 1775 argumentCount: number; 1776 } 1777 type SignatureHelpTriggerCharacter = "," | "(" | "<"; 1778 type SignatureHelpRetriggerCharacter = SignatureHelpTriggerCharacter | ")"; 1779 /** 1780 * Arguments of a signature help request. 1781 */ 1782 interface SignatureHelpRequestArgs extends FileLocationRequestArgs { 1783 /** 1784 * Reason why signature help was invoked. 1785 * See each individual possible 1786 */ 1787 triggerReason?: SignatureHelpTriggerReason; 1788 } 1789 type SignatureHelpTriggerReason = SignatureHelpInvokedReason | SignatureHelpCharacterTypedReason | SignatureHelpRetriggeredReason; 1790 /** 1791 * Signals that the user manually requested signature help. 1792 * The language service will unconditionally attempt to provide a result. 1793 */ 1794 interface SignatureHelpInvokedReason { 1795 kind: "invoked"; 1796 triggerCharacter?: undefined; 1797 } 1798 /** 1799 * Signals that the signature help request came from a user typing a character. 1800 * Depending on the character and the syntactic context, the request may or may not be served a result. 1801 */ 1802 interface SignatureHelpCharacterTypedReason { 1803 kind: "characterTyped"; 1804 /** 1805 * Character that was responsible for triggering signature help. 1806 */ 1807 triggerCharacter: SignatureHelpTriggerCharacter; 1808 } 1809 /** 1810 * Signals that this signature help request came from typing a character or moving the cursor. 1811 * This should only occur if a signature help session was already active and the editor needs to see if it should adjust. 1812 * The language service will unconditionally attempt to provide a result. 1813 * `triggerCharacter` can be `undefined` for a retrigger caused by a cursor move. 1814 */ 1815 interface SignatureHelpRetriggeredReason { 1816 kind: "retrigger"; 1817 /** 1818 * Character that was responsible for triggering signature help. 1819 */ 1820 triggerCharacter?: SignatureHelpRetriggerCharacter; 1821 } 1822 /** 1823 * Signature help request; value of command field is "signatureHelp". 1824 * Given a file location (file, line, col), return the signature 1825 * help. 1826 */ 1827 interface SignatureHelpRequest extends FileLocationRequest { 1828 command: CommandTypes.SignatureHelp; 1829 arguments: SignatureHelpRequestArgs; 1830 } 1831 /** 1832 * Response object for a SignatureHelpRequest. 1833 */ 1834 interface SignatureHelpResponse extends Response { 1835 body?: SignatureHelpItems; 1836 } 1837 /** 1838 * Synchronous request for semantic diagnostics of one file. 1839 */ 1840 interface SemanticDiagnosticsSyncRequest extends FileRequest { 1841 command: CommandTypes.SemanticDiagnosticsSync; 1842 arguments: SemanticDiagnosticsSyncRequestArgs; 1843 } 1844 interface SemanticDiagnosticsSyncRequestArgs extends FileRequestArgs { 1845 includeLinePosition?: boolean; 1846 } 1847 /** 1848 * Response object for synchronous sematic diagnostics request. 1849 */ 1850 interface SemanticDiagnosticsSyncResponse extends Response { 1851 body?: Diagnostic[] | DiagnosticWithLinePosition[]; 1852 } 1853 interface SuggestionDiagnosticsSyncRequest extends FileRequest { 1854 command: CommandTypes.SuggestionDiagnosticsSync; 1855 arguments: SuggestionDiagnosticsSyncRequestArgs; 1856 } 1857 type SuggestionDiagnosticsSyncRequestArgs = SemanticDiagnosticsSyncRequestArgs; 1858 type SuggestionDiagnosticsSyncResponse = SemanticDiagnosticsSyncResponse; 1859 /** 1860 * Synchronous request for syntactic diagnostics of one file. 1861 */ 1862 interface SyntacticDiagnosticsSyncRequest extends FileRequest { 1863 command: CommandTypes.SyntacticDiagnosticsSync; 1864 arguments: SyntacticDiagnosticsSyncRequestArgs; 1865 } 1866 interface SyntacticDiagnosticsSyncRequestArgs extends FileRequestArgs { 1867 includeLinePosition?: boolean; 1868 } 1869 /** 1870 * Response object for synchronous syntactic diagnostics request. 1871 */ 1872 interface SyntacticDiagnosticsSyncResponse extends Response { 1873 body?: Diagnostic[] | DiagnosticWithLinePosition[]; 1874 } 1875 /** 1876 * Arguments for GeterrForProject request. 1877 */ 1878 interface GeterrForProjectRequestArgs { 1879 /** 1880 * the file requesting project error list 1881 */ 1882 file: string; 1883 /** 1884 * Delay in milliseconds to wait before starting to compute 1885 * errors for the files in the file list 1886 */ 1887 delay: number; 1888 } 1889 /** 1890 * GeterrForProjectRequest request; value of command field is 1891 * "geterrForProject". It works similarly with 'Geterr', only 1892 * it request for every file in this project. 1893 */ 1894 interface GeterrForProjectRequest extends Request { 1895 command: CommandTypes.GeterrForProject; 1896 arguments: GeterrForProjectRequestArgs; 1897 } 1898 /** 1899 * Arguments for geterr messages. 1900 */ 1901 interface GeterrRequestArgs { 1902 /** 1903 * List of file names for which to compute compiler errors. 1904 * The files will be checked in list order. 1905 */ 1906 files: string[]; 1907 /** 1908 * Delay in milliseconds to wait before starting to compute 1909 * errors for the files in the file list 1910 */ 1911 delay: number; 1912 } 1913 /** 1914 * Geterr request; value of command field is "geterr". Wait for 1915 * delay milliseconds and then, if during the wait no change or 1916 * reload messages have arrived for the first file in the files 1917 * list, get the syntactic errors for the file, field requests, 1918 * and then get the semantic errors for the file. Repeat with a 1919 * smaller delay for each subsequent file on the files list. Best 1920 * practice for an editor is to send a file list containing each 1921 * file that is currently visible, in most-recently-used order. 1922 */ 1923 interface GeterrRequest extends Request { 1924 command: CommandTypes.Geterr; 1925 arguments: GeterrRequestArgs; 1926 } 1927 type RequestCompletedEventName = "requestCompleted"; 1928 /** 1929 * Event that is sent when server have finished processing request with specified id. 1930 */ 1931 interface RequestCompletedEvent extends Event { 1932 event: RequestCompletedEventName; 1933 body: RequestCompletedEventBody; 1934 } 1935 interface RequestCompletedEventBody { 1936 request_seq: number; 1937 } 1938 /** 1939 * Item of diagnostic information found in a DiagnosticEvent message. 1940 */ 1941 interface Diagnostic { 1942 /** 1943 * Starting file location at which text applies. 1944 */ 1945 start: Location; 1946 /** 1947 * The last file location at which the text applies. 1948 */ 1949 end: Location; 1950 /** 1951 * Text of diagnostic message. 1952 */ 1953 text: string; 1954 /** 1955 * The category of the diagnostic message, e.g. "error", "warning", or "suggestion". 1956 */ 1957 category: string; 1958 reportsUnnecessary?: {}; 1959 reportsDeprecated?: {}; 1960 /** 1961 * Any related spans the diagnostic may have, such as other locations relevant to an error, such as declarartion sites 1962 */ 1963 relatedInformation?: DiagnosticRelatedInformation[]; 1964 /** 1965 * The error code of the diagnostic message. 1966 */ 1967 code?: number; 1968 /** 1969 * The name of the plugin reporting the message. 1970 */ 1971 source?: string; 1972 } 1973 interface DiagnosticWithFileName extends Diagnostic { 1974 /** 1975 * Name of the file the diagnostic is in 1976 */ 1977 fileName: string; 1978 } 1979 /** 1980 * Represents additional spans returned with a diagnostic which are relevant to it 1981 */ 1982 interface DiagnosticRelatedInformation { 1983 /** 1984 * The category of the related information message, e.g. "error", "warning", or "suggestion". 1985 */ 1986 category: string; 1987 /** 1988 * The code used ot identify the related information 1989 */ 1990 code: number; 1991 /** 1992 * Text of related or additional information. 1993 */ 1994 message: string; 1995 /** 1996 * Associated location 1997 */ 1998 span?: FileSpan; 1999 } 2000 interface DiagnosticEventBody { 2001 /** 2002 * The file for which diagnostic information is reported. 2003 */ 2004 file: string; 2005 /** 2006 * An array of diagnostic information items. 2007 */ 2008 diagnostics: Diagnostic[]; 2009 } 2010 type DiagnosticEventKind = "semanticDiag" | "syntaxDiag" | "suggestionDiag"; 2011 /** 2012 * Event message for DiagnosticEventKind event types. 2013 * These events provide syntactic and semantic errors for a file. 2014 */ 2015 interface DiagnosticEvent extends Event { 2016 body?: DiagnosticEventBody; 2017 event: DiagnosticEventKind; 2018 } 2019 interface ConfigFileDiagnosticEventBody { 2020 /** 2021 * The file which trigged the searching and error-checking of the config file 2022 */ 2023 triggerFile: string; 2024 /** 2025 * The name of the found config file. 2026 */ 2027 configFile: string; 2028 /** 2029 * An arry of diagnostic information items for the found config file. 2030 */ 2031 diagnostics: DiagnosticWithFileName[]; 2032 } 2033 /** 2034 * Event message for "configFileDiag" event type. 2035 * This event provides errors for a found config file. 2036 */ 2037 interface ConfigFileDiagnosticEvent extends Event { 2038 body?: ConfigFileDiagnosticEventBody; 2039 event: "configFileDiag"; 2040 } 2041 type ProjectLanguageServiceStateEventName = "projectLanguageServiceState"; 2042 interface ProjectLanguageServiceStateEvent extends Event { 2043 event: ProjectLanguageServiceStateEventName; 2044 body?: ProjectLanguageServiceStateEventBody; 2045 } 2046 interface ProjectLanguageServiceStateEventBody { 2047 /** 2048 * Project name that has changes in the state of language service. 2049 * For configured projects this will be the config file path. 2050 * For external projects this will be the name of the projects specified when project was open. 2051 * For inferred projects this event is not raised. 2052 */ 2053 projectName: string; 2054 /** 2055 * True if language service state switched from disabled to enabled 2056 * and false otherwise. 2057 */ 2058 languageServiceEnabled: boolean; 2059 } 2060 type ProjectsUpdatedInBackgroundEventName = "projectsUpdatedInBackground"; 2061 interface ProjectsUpdatedInBackgroundEvent extends Event { 2062 event: ProjectsUpdatedInBackgroundEventName; 2063 body: ProjectsUpdatedInBackgroundEventBody; 2064 } 2065 interface ProjectsUpdatedInBackgroundEventBody { 2066 /** 2067 * Current set of open files 2068 */ 2069 openFiles: string[]; 2070 } 2071 type ProjectLoadingStartEventName = "projectLoadingStart"; 2072 interface ProjectLoadingStartEvent extends Event { 2073 event: ProjectLoadingStartEventName; 2074 body: ProjectLoadingStartEventBody; 2075 } 2076 interface ProjectLoadingStartEventBody { 2077 /** name of the project */ 2078 projectName: string; 2079 /** reason for loading */ 2080 reason: string; 2081 } 2082 type ProjectLoadingFinishEventName = "projectLoadingFinish"; 2083 interface ProjectLoadingFinishEvent extends Event { 2084 event: ProjectLoadingFinishEventName; 2085 body: ProjectLoadingFinishEventBody; 2086 } 2087 interface ProjectLoadingFinishEventBody { 2088 /** name of the project */ 2089 projectName: string; 2090 } 2091 type SurveyReadyEventName = "surveyReady"; 2092 interface SurveyReadyEvent extends Event { 2093 event: SurveyReadyEventName; 2094 body: SurveyReadyEventBody; 2095 } 2096 interface SurveyReadyEventBody { 2097 /** Name of the survey. This is an internal machine- and programmer-friendly name */ 2098 surveyId: string; 2099 } 2100 type LargeFileReferencedEventName = "largeFileReferenced"; 2101 interface LargeFileReferencedEvent extends Event { 2102 event: LargeFileReferencedEventName; 2103 body: LargeFileReferencedEventBody; 2104 } 2105 interface LargeFileReferencedEventBody { 2106 /** 2107 * name of the large file being loaded 2108 */ 2109 file: string; 2110 /** 2111 * size of the file 2112 */ 2113 fileSize: number; 2114 /** 2115 * max file size allowed on the server 2116 */ 2117 maxFileSize: number; 2118 } 2119 /** 2120 * Arguments for reload request. 2121 */ 2122 interface ReloadRequestArgs extends FileRequestArgs { 2123 /** 2124 * Name of temporary file from which to reload file 2125 * contents. May be same as file. 2126 */ 2127 tmpfile: string; 2128 } 2129 /** 2130 * Reload request message; value of command field is "reload". 2131 * Reload contents of file with name given by the 'file' argument 2132 * from temporary file with name given by the 'tmpfile' argument. 2133 * The two names can be identical. 2134 */ 2135 interface ReloadRequest extends FileRequest { 2136 command: CommandTypes.Reload; 2137 arguments: ReloadRequestArgs; 2138 } 2139 /** 2140 * Response to "reload" request. This is just an acknowledgement, so 2141 * no body field is required. 2142 */ 2143 interface ReloadResponse extends Response { 2144 } 2145 /** 2146 * Arguments for saveto request. 2147 */ 2148 interface SavetoRequestArgs extends FileRequestArgs { 2149 /** 2150 * Name of temporary file into which to save server's view of 2151 * file contents. 2152 */ 2153 tmpfile: string; 2154 } 2155 /** 2156 * Saveto request message; value of command field is "saveto". 2157 * For debugging purposes, save to a temporaryfile (named by 2158 * argument 'tmpfile') the contents of file named by argument 2159 * 'file'. The server does not currently send a response to a 2160 * "saveto" request. 2161 */ 2162 interface SavetoRequest extends FileRequest { 2163 command: CommandTypes.Saveto; 2164 arguments: SavetoRequestArgs; 2165 } 2166 /** 2167 * Arguments for navto request message. 2168 */ 2169 interface NavtoRequestArgs { 2170 /** 2171 * Search term to navigate to from current location; term can 2172 * be '.*' or an identifier prefix. 2173 */ 2174 searchValue: string; 2175 /** 2176 * Optional limit on the number of items to return. 2177 */ 2178 maxResultCount?: number; 2179 /** 2180 * The file for the request (absolute pathname required). 2181 */ 2182 file?: string; 2183 /** 2184 * Optional flag to indicate we want results for just the current file 2185 * or the entire project. 2186 */ 2187 currentFileOnly?: boolean; 2188 projectFileName?: string; 2189 } 2190 /** 2191 * Navto request message; value of command field is "navto". 2192 * Return list of objects giving file locations and symbols that 2193 * match the search term given in argument 'searchTerm'. The 2194 * context for the search is given by the named file. 2195 */ 2196 interface NavtoRequest extends Request { 2197 command: CommandTypes.Navto; 2198 arguments: NavtoRequestArgs; 2199 } 2200 /** 2201 * An item found in a navto response. 2202 */ 2203 interface NavtoItem extends FileSpan { 2204 /** 2205 * The symbol's name. 2206 */ 2207 name: string; 2208 /** 2209 * The symbol's kind (such as 'className' or 'parameterName'). 2210 */ 2211 kind: ScriptElementKind; 2212 /** 2213 * exact, substring, or prefix. 2214 */ 2215 matchKind: string; 2216 /** 2217 * If this was a case sensitive or insensitive match. 2218 */ 2219 isCaseSensitive: boolean; 2220 /** 2221 * Optional modifiers for the kind (such as 'public'). 2222 */ 2223 kindModifiers?: string; 2224 /** 2225 * Name of symbol's container symbol (if any); for example, 2226 * the class name if symbol is a class member. 2227 */ 2228 containerName?: string; 2229 /** 2230 * Kind of symbol's container symbol (if any). 2231 */ 2232 containerKind?: ScriptElementKind; 2233 } 2234 /** 2235 * Navto response message. Body is an array of navto items. Each 2236 * item gives a symbol that matched the search term. 2237 */ 2238 interface NavtoResponse extends Response { 2239 body?: NavtoItem[]; 2240 } 2241 /** 2242 * Arguments for change request message. 2243 */ 2244 interface ChangeRequestArgs extends FormatRequestArgs { 2245 /** 2246 * Optional string to insert at location (file, line, offset). 2247 */ 2248 insertString?: string; 2249 } 2250 /** 2251 * Change request message; value of command field is "change". 2252 * Update the server's view of the file named by argument 'file'. 2253 * Server does not currently send a response to a change request. 2254 */ 2255 interface ChangeRequest extends FileLocationRequest { 2256 command: CommandTypes.Change; 2257 arguments: ChangeRequestArgs; 2258 } 2259 /** 2260 * Response to "brace" request. 2261 */ 2262 interface BraceResponse extends Response { 2263 body?: TextSpan[]; 2264 } 2265 /** 2266 * Brace matching request; value of command field is "brace". 2267 * Return response giving the file locations of matching braces 2268 * found in file at location line, offset. 2269 */ 2270 interface BraceRequest extends FileLocationRequest { 2271 command: CommandTypes.Brace; 2272 } 2273 /** 2274 * NavBar items request; value of command field is "navbar". 2275 * Return response giving the list of navigation bar entries 2276 * extracted from the requested file. 2277 */ 2278 interface NavBarRequest extends FileRequest { 2279 command: CommandTypes.NavBar; 2280 } 2281 /** 2282 * NavTree request; value of command field is "navtree". 2283 * Return response giving the navigation tree of the requested file. 2284 */ 2285 interface NavTreeRequest extends FileRequest { 2286 command: CommandTypes.NavTree; 2287 } 2288 interface NavigationBarItem { 2289 /** 2290 * The item's display text. 2291 */ 2292 text: string; 2293 /** 2294 * The symbol's kind (such as 'className' or 'parameterName'). 2295 */ 2296 kind: ScriptElementKind; 2297 /** 2298 * Optional modifiers for the kind (such as 'public'). 2299 */ 2300 kindModifiers?: string; 2301 /** 2302 * The definition locations of the item. 2303 */ 2304 spans: TextSpan[]; 2305 /** 2306 * Optional children. 2307 */ 2308 childItems?: NavigationBarItem[]; 2309 /** 2310 * Number of levels deep this item should appear. 2311 */ 2312 indent: number; 2313 } 2314 /** protocol.NavigationTree is identical to ts.NavigationTree, except using protocol.TextSpan instead of ts.TextSpan */ 2315 interface NavigationTree { 2316 text: string; 2317 kind: ScriptElementKind; 2318 kindModifiers: string; 2319 spans: TextSpan[]; 2320 nameSpan: TextSpan | undefined; 2321 childItems?: NavigationTree[]; 2322 } 2323 type TelemetryEventName = "telemetry"; 2324 interface TelemetryEvent extends Event { 2325 event: TelemetryEventName; 2326 body: TelemetryEventBody; 2327 } 2328 interface TelemetryEventBody { 2329 telemetryEventName: string; 2330 payload: any; 2331 } 2332 type TypesInstallerInitializationFailedEventName = "typesInstallerInitializationFailed"; 2333 interface TypesInstallerInitializationFailedEvent extends Event { 2334 event: TypesInstallerInitializationFailedEventName; 2335 body: TypesInstallerInitializationFailedEventBody; 2336 } 2337 interface TypesInstallerInitializationFailedEventBody { 2338 message: string; 2339 } 2340 type TypingsInstalledTelemetryEventName = "typingsInstalled"; 2341 interface TypingsInstalledTelemetryEventBody extends TelemetryEventBody { 2342 telemetryEventName: TypingsInstalledTelemetryEventName; 2343 payload: TypingsInstalledTelemetryEventPayload; 2344 } 2345 interface TypingsInstalledTelemetryEventPayload { 2346 /** 2347 * Comma separated list of installed typing packages 2348 */ 2349 installedPackages: string; 2350 /** 2351 * true if install request succeeded, otherwise - false 2352 */ 2353 installSuccess: boolean; 2354 /** 2355 * version of typings installer 2356 */ 2357 typingsInstallerVersion: string; 2358 } 2359 type BeginInstallTypesEventName = "beginInstallTypes"; 2360 type EndInstallTypesEventName = "endInstallTypes"; 2361 interface BeginInstallTypesEvent extends Event { 2362 event: BeginInstallTypesEventName; 2363 body: BeginInstallTypesEventBody; 2364 } 2365 interface EndInstallTypesEvent extends Event { 2366 event: EndInstallTypesEventName; 2367 body: EndInstallTypesEventBody; 2368 } 2369 interface InstallTypesEventBody { 2370 /** 2371 * correlation id to match begin and end events 2372 */ 2373 eventId: number; 2374 /** 2375 * list of packages to install 2376 */ 2377 packages: readonly string[]; 2378 } 2379 interface BeginInstallTypesEventBody extends InstallTypesEventBody { 2380 } 2381 interface EndInstallTypesEventBody extends InstallTypesEventBody { 2382 /** 2383 * true if installation succeeded, otherwise false 2384 */ 2385 success: boolean; 2386 } 2387 interface NavBarResponse extends Response { 2388 body?: NavigationBarItem[]; 2389 } 2390 interface NavTreeResponse extends Response { 2391 body?: NavigationTree; 2392 } 2393 interface CallHierarchyItem { 2394 name: string; 2395 kind: ScriptElementKind; 2396 kindModifiers?: string; 2397 file: string; 2398 span: TextSpan; 2399 selectionSpan: TextSpan; 2400 containerName?: string; 2401 } 2402 interface CallHierarchyIncomingCall { 2403 from: CallHierarchyItem; 2404 fromSpans: TextSpan[]; 2405 } 2406 interface CallHierarchyOutgoingCall { 2407 to: CallHierarchyItem; 2408 fromSpans: TextSpan[]; 2409 } 2410 interface PrepareCallHierarchyRequest extends FileLocationRequest { 2411 command: CommandTypes.PrepareCallHierarchy; 2412 } 2413 interface PrepareCallHierarchyResponse extends Response { 2414 readonly body: CallHierarchyItem | CallHierarchyItem[]; 2415 } 2416 interface ProvideCallHierarchyIncomingCallsRequest extends FileLocationRequest { 2417 command: CommandTypes.ProvideCallHierarchyIncomingCalls; 2418 } 2419 interface ProvideCallHierarchyIncomingCallsResponse extends Response { 2420 readonly body: CallHierarchyIncomingCall[]; 2421 } 2422 interface ProvideCallHierarchyOutgoingCallsRequest extends FileLocationRequest { 2423 command: CommandTypes.ProvideCallHierarchyOutgoingCalls; 2424 } 2425 interface ProvideCallHierarchyOutgoingCallsResponse extends Response { 2426 readonly body: CallHierarchyOutgoingCall[]; 2427 } 2428 const enum IndentStyle { 2429 None = "None", 2430 Block = "Block", 2431 Smart = "Smart" 2432 } 2433 enum SemicolonPreference { 2434 Ignore = "ignore", 2435 Insert = "insert", 2436 Remove = "remove" 2437 } 2438 interface EditorSettings { 2439 baseIndentSize?: number; 2440 indentSize?: number; 2441 tabSize?: number; 2442 newLineCharacter?: string; 2443 convertTabsToSpaces?: boolean; 2444 indentStyle?: IndentStyle | ts.IndentStyle; 2445 trimTrailingWhitespace?: boolean; 2446 } 2447 interface FormatCodeSettings extends EditorSettings { 2448 insertSpaceAfterCommaDelimiter?: boolean; 2449 insertSpaceAfterSemicolonInForStatements?: boolean; 2450 insertSpaceBeforeAndAfterBinaryOperators?: boolean; 2451 insertSpaceAfterConstructor?: boolean; 2452 insertSpaceAfterKeywordsInControlFlowStatements?: boolean; 2453 insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean; 2454 insertSpaceAfterOpeningAndBeforeClosingEmptyBraces?: boolean; 2455 insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean; 2456 insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean; 2457 insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces?: boolean; 2458 insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean; 2459 insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean; 2460 insertSpaceAfterTypeAssertion?: boolean; 2461 insertSpaceBeforeFunctionParenthesis?: boolean; 2462 placeOpenBraceOnNewLineForFunctions?: boolean; 2463 placeOpenBraceOnNewLineForControlBlocks?: boolean; 2464 insertSpaceBeforeTypeAnnotation?: boolean; 2465 semicolons?: SemicolonPreference; 2466 } 2467 interface UserPreferences { 2468 readonly disableSuggestions?: boolean; 2469 readonly quotePreference?: "auto" | "double" | "single"; 2470 /** 2471 * If enabled, TypeScript will search through all external modules' exports and add them to the completions list. 2472 * This affects lone identifier completions but not completions on the right hand side of `obj.`. 2473 */ 2474 readonly includeCompletionsForModuleExports?: boolean; 2475 /** 2476 * If enabled, the completion list will include completions with invalid identifier names. 2477 * For those entries, The `insertText` and `replacementSpan` properties will be set to change from `.x` property access to `["x"]`. 2478 */ 2479 readonly includeCompletionsWithInsertText?: boolean; 2480 /** 2481 * Unless this option is `false`, or `includeCompletionsWithInsertText` is not enabled, 2482 * member completion lists triggered with `.` will include entries on potentially-null and potentially-undefined 2483 * values, with insertion text to replace preceding `.` tokens with `?.`. 2484 */ 2485 readonly includeAutomaticOptionalChainCompletions?: boolean; 2486 readonly importModuleSpecifierPreference?: "auto" | "relative" | "non-relative"; 2487 /** Determines whether we import `foo/index.ts` as "foo", "foo/index", or "foo/index.js" */ 2488 readonly importModuleSpecifierEnding?: "auto" | "minimal" | "index" | "js"; 2489 readonly allowTextChangesInNewFiles?: boolean; 2490 readonly lazyConfiguredProjectsFromExternalProject?: boolean; 2491 readonly providePrefixAndSuffixTextForRename?: boolean; 2492 readonly provideRefactorNotApplicableReason?: boolean; 2493 readonly allowRenameOfImportPath?: boolean; 2494 readonly includePackageJsonAutoImports?: "auto" | "on" | "off"; 2495 } 2496 interface CompilerOptions { 2497 allowJs?: boolean; 2498 allowSyntheticDefaultImports?: boolean; 2499 allowUnreachableCode?: boolean; 2500 allowUnusedLabels?: boolean; 2501 alwaysStrict?: boolean; 2502 baseUrl?: string; 2503 charset?: string; 2504 checkJs?: boolean; 2505 declaration?: boolean; 2506 declarationDir?: string; 2507 disableSizeLimit?: boolean; 2508 downlevelIteration?: boolean; 2509 emitBOM?: boolean; 2510 emitDecoratorMetadata?: boolean; 2511 experimentalDecorators?: boolean; 2512 forceConsistentCasingInFileNames?: boolean; 2513 importHelpers?: boolean; 2514 inlineSourceMap?: boolean; 2515 inlineSources?: boolean; 2516 isolatedModules?: boolean; 2517 jsx?: JsxEmit | ts.JsxEmit; 2518 lib?: string[]; 2519 locale?: string; 2520 mapRoot?: string; 2521 maxNodeModuleJsDepth?: number; 2522 module?: ModuleKind | ts.ModuleKind; 2523 moduleResolution?: ModuleResolutionKind | ts.ModuleResolutionKind; 2524 newLine?: NewLineKind | ts.NewLineKind; 2525 noEmit?: boolean; 2526 noEmitHelpers?: boolean; 2527 noEmitOnError?: boolean; 2528 noErrorTruncation?: boolean; 2529 noFallthroughCasesInSwitch?: boolean; 2530 noImplicitAny?: boolean; 2531 noImplicitReturns?: boolean; 2532 noImplicitThis?: boolean; 2533 noUnusedLocals?: boolean; 2534 noUnusedParameters?: boolean; 2535 noImplicitUseStrict?: boolean; 2536 noLib?: boolean; 2537 noResolve?: boolean; 2538 out?: string; 2539 outDir?: string; 2540 outFile?: string; 2541 paths?: MapLike<string[]>; 2542 plugins?: PluginImport[]; 2543 preserveConstEnums?: boolean; 2544 preserveSymlinks?: boolean; 2545 project?: string; 2546 reactNamespace?: string; 2547 removeComments?: boolean; 2548 references?: ProjectReference[]; 2549 rootDir?: string; 2550 rootDirs?: string[]; 2551 skipLibCheck?: boolean; 2552 skipDefaultLibCheck?: boolean; 2553 sourceMap?: boolean; 2554 sourceRoot?: string; 2555 strict?: boolean; 2556 strictNullChecks?: boolean; 2557 suppressExcessPropertyErrors?: boolean; 2558 suppressImplicitAnyIndexErrors?: boolean; 2559 useDefineForClassFields?: boolean; 2560 target?: ScriptTarget | ts.ScriptTarget; 2561 traceResolution?: boolean; 2562 resolveJsonModule?: boolean; 2563 types?: string[]; 2564 /** Paths used to used to compute primary types search locations */ 2565 typeRoots?: string[]; 2566 [option: string]: CompilerOptionsValue | undefined; 2567 } 2568 const enum JsxEmit { 2569 None = "None", 2570 Preserve = "Preserve", 2571 ReactNative = "ReactNative", 2572 React = "React", 2573 ReactJSX = "ReactJSX", 2574 ReactJSXDev = "ReactJSXDev" 2575 } 2576 const enum ModuleKind { 2577 None = "None", 2578 CommonJS = "CommonJS", 2579 AMD = "AMD", 2580 UMD = "UMD", 2581 System = "System", 2582 ES6 = "ES6", 2583 ES2015 = "ES2015", 2584 ES2020 = "ES2020", 2585 ESNext = "ESNext" 2586 } 2587 const enum ModuleResolutionKind { 2588 Classic = "Classic", 2589 Node = "Node" 2590 } 2591 const enum NewLineKind { 2592 Crlf = "Crlf", 2593 Lf = "Lf" 2594 } 2595 const enum ScriptTarget { 2596 ES3 = "ES3", 2597 ES5 = "ES5", 2598 ES6 = "ES6", 2599 ES2015 = "ES2015", 2600 ES2016 = "ES2016", 2601 ES2017 = "ES2017", 2602 ES2018 = "ES2018", 2603 ES2019 = "ES2019", 2604 ES2020 = "ES2020", 2605 JSON = "JSON", 2606 ESNext = "ESNext" 2607 } 2608} 2609declare namespace ts.server.protocol { 2610 2611 interface TextInsertion { 2612 newText: string; 2613 /** The position in newText the caret should point to after the insertion. */ 2614 caretOffset: number; 2615 } 2616 2617 interface TodoCommentDescriptor { 2618 text: string; 2619 priority: number; 2620 } 2621 2622 interface TodoComment { 2623 descriptor: TodoCommentDescriptor; 2624 message: string; 2625 position: number; 2626 } 2627 2628 enum OutliningSpanKind { 2629 /** Single or multi-line comments */ 2630 Comment = "comment", 2631 /** Sections marked by '// #region' and '// #endregion' comments */ 2632 Region = "region", 2633 /** Declarations and expressions */ 2634 Code = "code", 2635 /** Contiguous blocks of import declarations */ 2636 Imports = "imports" 2637 } 2638 2639 enum HighlightSpanKind { 2640 none = "none", 2641 definition = "definition", 2642 reference = "reference", 2643 writtenReference = "writtenReference" 2644 } 2645 2646 enum ScriptElementKind { 2647 unknown = "", 2648 warning = "warning", 2649 /** predefined type (void) or keyword (class) */ 2650 keyword = "keyword", 2651 /** top level script node */ 2652 scriptElement = "script", 2653 /** module foo {} */ 2654 moduleElement = "module", 2655 /** class X {} */ 2656 classElement = "class", 2657 /** var x = class X {} */ 2658 localClassElement = "local class", 2659 /** interface Y {} */ 2660 interfaceElement = "interface", 2661 /** type T = ... */ 2662 typeElement = "type", 2663 /** enum E */ 2664 enumElement = "enum", 2665 enumMemberElement = "enum member", 2666 /** 2667 * Inside module and script only 2668 * const v = .. 2669 */ 2670 variableElement = "var", 2671 /** Inside function */ 2672 localVariableElement = "local var", 2673 /** 2674 * Inside module and script only 2675 * function f() { } 2676 */ 2677 functionElement = "function", 2678 /** Inside function */ 2679 localFunctionElement = "local function", 2680 /** class X { [public|private]* foo() {} } */ 2681 memberFunctionElement = "method", 2682 /** class X { [public|private]* [get|set] foo:number; } */ 2683 memberGetAccessorElement = "getter", 2684 memberSetAccessorElement = "setter", 2685 /** 2686 * class X { [public|private]* foo:number; } 2687 * interface Y { foo:number; } 2688 */ 2689 memberVariableElement = "property", 2690 /** class X { constructor() { } } */ 2691 constructorImplementationElement = "constructor", 2692 /** interface Y { ():number; } */ 2693 callSignatureElement = "call", 2694 /** interface Y { []:number; } */ 2695 indexSignatureElement = "index", 2696 /** interface Y { new():Y; } */ 2697 constructSignatureElement = "construct", 2698 /** function foo(*Y*: string) */ 2699 parameterElement = "parameter", 2700 typeParameterElement = "type parameter", 2701 primitiveType = "primitive type", 2702 label = "label", 2703 alias = "alias", 2704 constElement = "const", 2705 letElement = "let", 2706 directory = "directory", 2707 externalModuleName = "external module name", 2708 /** 2709 * <JsxTagName attribute1 attribute2={0} /> 2710 */ 2711 jsxAttribute = "JSX attribute", 2712 /** String literal */ 2713 string = "string" 2714 } 2715 2716 export interface TypeAcquisition { 2717 /** 2718 * @deprecated typingOptions.enableAutoDiscovery 2719 * Use typeAcquisition.enable instead. 2720 */ 2721 enableAutoDiscovery?: boolean; 2722 enable?: boolean; 2723 include?: string[]; 2724 exclude?: string[]; 2725 disableFilenameBasedTypeAcquisition?: boolean; 2726 [option: string]: CompilerOptionsValue | undefined; 2727 } 2728 2729 export type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike<string[]> | PluginImport[] | ProjectReference[] | null | undefined; 2730 2731 export interface FileExtensionInfo { 2732 extension: string; 2733 isMixedContent: boolean; 2734 scriptKind?: ScriptKind; 2735 } 2736 2737 interface JSDocTagInfo { 2738 name: string; 2739 text?: string; 2740 } 2741 2742 /** 2743 * Type of objects whose values are all of the same type. 2744 * The `in` and `for-in` operators can *not* be safely used, 2745 * since `Object.prototype` may be modified by outside code. 2746 */ 2747 interface MapLike<T> { 2748 [index: string]: T; 2749 } 2750 2751 export interface PluginImport { 2752 name: string; 2753 } 2754 2755 export interface ProjectReference { 2756 /** A normalized path on disk */ 2757 path: string; 2758 /** The path as the user originally wrote it */ 2759 originalPath?: string; 2760 /** True if the output of this reference should be prepended to the output of this project. Only valid for --outFile compilations */ 2761 prepend?: boolean; 2762 /** True if it is intended that this reference form a circularity */ 2763 circular?: boolean; 2764 } 2765} 2766declare namespace ts { 2767 // these types are empty stubs for types from services and should not be used directly 2768 export type ScriptKind = never; 2769 export type WatchFileKind = never; 2770 export type WatchDirectoryKind = never; 2771 export type PollingWatchKind = never; 2772 export type IndentStyle = never; 2773 export type JsxEmit = never; 2774 export type ModuleKind = never; 2775 export type ModuleResolutionKind = never; 2776 export type NewLineKind = never; 2777 export type ScriptTarget = never; 2778} 2779import protocol = ts.server.protocol; 2780export = protocol; 2781export as namespace protocol;