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