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