My dotfiles
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 

1927 líneas
62 KiB

  1. /**
  2. * A tagging type for string properties that are actually URIs.
  3. */
  4. export declare type DocumentUri = string;
  5. /**
  6. * Position in a text document expressed as zero-based line and character offset.
  7. * The offsets are based on a UTF-16 string representation. So a string of the form
  8. * `a𐐀b` the character offset of the character `a` is 0, the character offset of `𐐀`
  9. * is 1 and the character offset of b is 3 since `𐐀` is represented using two code
  10. * units in UTF-16.
  11. *
  12. * Positions are line end character agnostic. So you can not specify a position that
  13. * denotes `\r|\n` or `\n|` where `|` represents the character offset.
  14. */
  15. export interface Position {
  16. /**
  17. * Line position in a document (zero-based).
  18. * If a line number is greater than the number of lines in a document, it defaults back to the number of lines in the document.
  19. * If a line number is negative, it defaults to 0.
  20. */
  21. line: number;
  22. /**
  23. * Character offset on a line in a document (zero-based). Assuming that the line is
  24. * represented as a string, the `character` value represents the gap between the
  25. * `character` and `character + 1`.
  26. *
  27. * If the character value is greater than the line length it defaults back to the
  28. * line length.
  29. * If a line number is negative, it defaults to 0.
  30. */
  31. character: number;
  32. }
  33. /**
  34. * The Position namespace provides helper functions to work with
  35. * [Position](#Position) literals.
  36. */
  37. export declare namespace Position {
  38. /**
  39. * Creates a new Position literal from the given line and character.
  40. * @param line The position's line.
  41. * @param character The position's character.
  42. */
  43. function create(line: number, character: number): Position;
  44. /**
  45. * Checks whether the given liternal conforms to the [Position](#Position) interface.
  46. */
  47. function is(value: any): value is Position;
  48. }
  49. /**
  50. * A range in a text document expressed as (zero-based) start and end positions.
  51. *
  52. * If you want to specify a range that contains a line including the line ending
  53. * character(s) then use an end position denoting the start of the next line.
  54. * For example:
  55. * ```ts
  56. * {
  57. * start: { line: 5, character: 23 }
  58. * end : { line 6, character : 0 }
  59. * }
  60. * ```
  61. */
  62. export interface Range {
  63. /**
  64. * The range's start position
  65. */
  66. start: Position;
  67. /**
  68. * The range's end position.
  69. */
  70. end: Position;
  71. }
  72. /**
  73. * The Range namespace provides helper functions to work with
  74. * [Range](#Range) literals.
  75. */
  76. export declare namespace Range {
  77. /**
  78. * Create a new Range liternal.
  79. * @param start The range's start position.
  80. * @param end The range's end position.
  81. */
  82. function create(start: Position, end: Position): Range;
  83. /**
  84. * Create a new Range liternal.
  85. * @param startLine The start line number.
  86. * @param startCharacter The start character.
  87. * @param endLine The end line number.
  88. * @param endCharacter The end character.
  89. */
  90. function create(startLine: number, startCharacter: number, endLine: number, endCharacter: number): Range;
  91. /**
  92. * Checks whether the given literal conforms to the [Range](#Range) interface.
  93. */
  94. function is(value: any): value is Range;
  95. }
  96. /**
  97. * Represents a location inside a resource, such as a line
  98. * inside a text file.
  99. */
  100. export interface Location {
  101. uri: DocumentUri;
  102. range: Range;
  103. }
  104. /**
  105. * The Location namespace provides helper functions to work with
  106. * [Location](#Location) literals.
  107. */
  108. export declare namespace Location {
  109. /**
  110. * Creates a Location literal.
  111. * @param uri The location's uri.
  112. * @param range The location's range.
  113. */
  114. function create(uri: DocumentUri, range: Range): Location;
  115. /**
  116. * Checks whether the given literal conforms to the [Location](#Location) interface.
  117. */
  118. function is(value: any): value is Location;
  119. }
  120. /**
  121. * Represents the connection of two locations. Provides additional metadata over normal [locations](#Location),
  122. * including an origin range.
  123. */
  124. export interface LocationLink {
  125. /**
  126. * Span of the origin of this link.
  127. *
  128. * Used as the underlined span for mouse definition hover. Defaults to the word range at
  129. * the definition position.
  130. */
  131. originSelectionRange?: Range;
  132. /**
  133. * The target resource identifier of this link.
  134. */
  135. targetUri: DocumentUri;
  136. /**
  137. * The full target range of this link. If the target for example is a symbol then target range is the
  138. * range enclosing this symbol not including leading/trailing whitespace but everything else
  139. * like comments. This information is typically used to highlight the range in the editor.
  140. */
  141. targetRange: Range;
  142. /**
  143. * The range that should be selected and revealed when this link is being followed, e.g the name of a function.
  144. * Must be contained by the the `targetRange`. See also `DocumentSymbol#range`
  145. */
  146. targetSelectionRange: Range;
  147. }
  148. /**
  149. * The LocationLink namespace provides helper functions to work with
  150. * [LocationLink](#LocationLink) literals.
  151. */
  152. export declare namespace LocationLink {
  153. /**
  154. * Creates a LocationLink literal.
  155. * @param targetUri The definition's uri.
  156. * @param targetRange The full range of the definition.
  157. * @param targetSelectionRange The span of the symbol definition at the target.
  158. * @param originSelectionRange The span of the symbol being defined in the originating source file.
  159. */
  160. function create(targetUri: DocumentUri, targetRange: Range, targetSelectionRange: Range, originSelectionRange?: Range): LocationLink;
  161. /**
  162. * Checks whether the given literal conforms to the [LocationLink](#LocationLink) interface.
  163. */
  164. function is(value: any): value is LocationLink;
  165. }
  166. /**
  167. * Represents a color in RGBA space.
  168. */
  169. export interface Color {
  170. /**
  171. * The red component of this color in the range [0-1].
  172. */
  173. readonly red: number;
  174. /**
  175. * The green component of this color in the range [0-1].
  176. */
  177. readonly green: number;
  178. /**
  179. * The blue component of this color in the range [0-1].
  180. */
  181. readonly blue: number;
  182. /**
  183. * The alpha component of this color in the range [0-1].
  184. */
  185. readonly alpha: number;
  186. }
  187. /**
  188. * The Color namespace provides helper functions to work with
  189. * [Color](#Color) literals.
  190. */
  191. export declare namespace Color {
  192. /**
  193. * Creates a new Color literal.
  194. */
  195. function create(red: number, green: number, blue: number, alpha: number): Color;
  196. /**
  197. * Checks whether the given literal conforms to the [Color](#Color) interface.
  198. */
  199. function is(value: any): value is Color;
  200. }
  201. /**
  202. * Represents a color range from a document.
  203. */
  204. export interface ColorInformation {
  205. /**
  206. * The range in the document where this color appers.
  207. */
  208. range: Range;
  209. /**
  210. * The actual color value for this color range.
  211. */
  212. color: Color;
  213. }
  214. /**
  215. * The ColorInformation namespace provides helper functions to work with
  216. * [ColorInformation](#ColorInformation) literals.
  217. */
  218. export declare namespace ColorInformation {
  219. /**
  220. * Creates a new ColorInformation literal.
  221. */
  222. function create(range: Range, color: Color): ColorInformation;
  223. /**
  224. * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.
  225. */
  226. function is(value: any): value is ColorInformation;
  227. }
  228. export interface ColorPresentation {
  229. /**
  230. * The label of this color presentation. It will be shown on the color
  231. * picker header. By default this is also the text that is inserted when selecting
  232. * this color presentation.
  233. */
  234. label: string;
  235. /**
  236. * An [edit](#TextEdit) which is applied to a document when selecting
  237. * this presentation for the color. When `falsy` the [label](#ColorPresentation.label)
  238. * is used.
  239. */
  240. textEdit?: TextEdit;
  241. /**
  242. * An optional array of additional [text edits](#TextEdit) that are applied when
  243. * selecting this color presentation. Edits must not overlap with the main [edit](#ColorPresentation.textEdit) nor with themselves.
  244. */
  245. additionalTextEdits?: TextEdit[];
  246. }
  247. /**
  248. * The Color namespace provides helper functions to work with
  249. * [ColorPresentation](#ColorPresentation) literals.
  250. */
  251. export declare namespace ColorPresentation {
  252. /**
  253. * Creates a new ColorInformation literal.
  254. */
  255. function create(label: string, textEdit?: TextEdit, additionalTextEdits?: TextEdit[]): ColorPresentation;
  256. /**
  257. * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.
  258. */
  259. function is(value: any): value is ColorPresentation;
  260. }
  261. /**
  262. * Enum of known range kinds
  263. */
  264. export declare enum FoldingRangeKind {
  265. /**
  266. * Folding range for a comment
  267. */
  268. Comment = "comment",
  269. /**
  270. * Folding range for a imports or includes
  271. */
  272. Imports = "imports",
  273. /**
  274. * Folding range for a region (e.g. `#region`)
  275. */
  276. Region = "region"
  277. }
  278. /**
  279. * Represents a folding range.
  280. */
  281. export interface FoldingRange {
  282. /**
  283. * The zero-based line number from where the folded range starts.
  284. */
  285. startLine: number;
  286. /**
  287. * The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line.
  288. */
  289. startCharacter?: number;
  290. /**
  291. * The zero-based line number where the folded range ends.
  292. */
  293. endLine: number;
  294. /**
  295. * The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line.
  296. */
  297. endCharacter?: number;
  298. /**
  299. * Describes the kind of the folding range such as `comment' or 'region'. The kind
  300. * is used to categorize folding ranges and used by commands like 'Fold all comments'. See
  301. * [FoldingRangeKind](#FoldingRangeKind) for an enumeration of standardized kinds.
  302. */
  303. kind?: string;
  304. }
  305. /**
  306. * The folding range namespace provides helper functions to work with
  307. * [FoldingRange](#FoldingRange) literals.
  308. */
  309. export declare namespace FoldingRange {
  310. /**
  311. * Creates a new FoldingRange literal.
  312. */
  313. function create(startLine: number, endLine: number, startCharacter?: number, endCharacter?: number, kind?: string): FoldingRange;
  314. /**
  315. * Checks whether the given literal conforms to the [FoldingRange](#FoldingRange) interface.
  316. */
  317. function is(value: any): value is FoldingRange;
  318. }
  319. /**
  320. * Represents a related message and source code location for a diagnostic. This should be
  321. * used to point to code locations that cause or related to a diagnostics, e.g when duplicating
  322. * a symbol in a scope.
  323. */
  324. export interface DiagnosticRelatedInformation {
  325. /**
  326. * The location of this related diagnostic information.
  327. */
  328. location: Location;
  329. /**
  330. * The message of this related diagnostic information.
  331. */
  332. message: string;
  333. }
  334. /**
  335. * The DiagnosticRelatedInformation namespace provides helper functions to work with
  336. * [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) literals.
  337. */
  338. export declare namespace DiagnosticRelatedInformation {
  339. /**
  340. * Creates a new DiagnosticRelatedInformation literal.
  341. */
  342. function create(location: Location, message: string): DiagnosticRelatedInformation;
  343. /**
  344. * Checks whether the given literal conforms to the [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) interface.
  345. */
  346. function is(value: any): value is DiagnosticRelatedInformation;
  347. }
  348. /**
  349. * The diagnostic's severity.
  350. */
  351. export declare namespace DiagnosticSeverity {
  352. /**
  353. * Reports an error.
  354. */
  355. const Error: 1;
  356. /**
  357. * Reports a warning.
  358. */
  359. const Warning: 2;
  360. /**
  361. * Reports an information.
  362. */
  363. const Information: 3;
  364. /**
  365. * Reports a hint.
  366. */
  367. const Hint: 4;
  368. }
  369. export declare type DiagnosticSeverity = 1 | 2 | 3 | 4;
  370. /**
  371. * The diagnostic tags.
  372. *
  373. * @since 3.15.0
  374. */
  375. export declare namespace DiagnosticTag {
  376. /**
  377. * Unused or unnecessary code.
  378. *
  379. * Clients are allowed to render diagnostics with this tag faded out instead of having
  380. * an error squiggle.
  381. */
  382. const Unnecessary: 1;
  383. /**
  384. * Deprecated or obsolete code.
  385. *
  386. * Clients are allowed to rendered diagnostics with this tag strike through.
  387. */
  388. const Deprecated: 2;
  389. }
  390. export declare type DiagnosticTag = 1 | 2;
  391. /**
  392. * Represents a diagnostic, such as a compiler error or warning. Diagnostic objects
  393. * are only valid in the scope of a resource.
  394. */
  395. export interface Diagnostic {
  396. /**
  397. * The range at which the message applies
  398. */
  399. range: Range;
  400. /**
  401. * The diagnostic's severity. Can be omitted. If omitted it is up to the
  402. * client to interpret diagnostics as error, warning, info or hint.
  403. */
  404. severity?: DiagnosticSeverity;
  405. /**
  406. * The diagnostic's code, which usually appear in the user interface.
  407. */
  408. code?: number | string;
  409. /**
  410. * A human-readable string describing the source of this
  411. * diagnostic, e.g. 'typescript' or 'super lint'. It usually
  412. * appears in the user interface.
  413. */
  414. source?: string;
  415. /**
  416. * The diagnostic's message. It usually appears in the user interface
  417. */
  418. message: string;
  419. /**
  420. * Additional metadata about the diagnostic.
  421. */
  422. tags?: DiagnosticTag[];
  423. /**
  424. * An array of related diagnostic information, e.g. when symbol-names within
  425. * a scope collide all definitions can be marked via this property.
  426. */
  427. relatedInformation?: DiagnosticRelatedInformation[];
  428. }
  429. /**
  430. * The Diagnostic namespace provides helper functions to work with
  431. * [Diagnostic](#Diagnostic) literals.
  432. */
  433. export declare namespace Diagnostic {
  434. /**
  435. * Creates a new Diagnostic literal.
  436. */
  437. function create(range: Range, message: string, severity?: DiagnosticSeverity, code?: number | string, source?: string, relatedInformation?: DiagnosticRelatedInformation[]): Diagnostic;
  438. /**
  439. * Checks whether the given literal conforms to the [Diagnostic](#Diagnostic) interface.
  440. */
  441. function is(value: any): value is Diagnostic;
  442. }
  443. /**
  444. * Represents a reference to a command. Provides a title which
  445. * will be used to represent a command in the UI and, optionally,
  446. * an array of arguments which will be passed to the command handler
  447. * function when invoked.
  448. */
  449. export interface Command {
  450. /**
  451. * Title of the command, like `save`.
  452. */
  453. title: string;
  454. /**
  455. * The identifier of the actual command handler.
  456. */
  457. command: string;
  458. /**
  459. * Arguments that the command handler should be
  460. * invoked with.
  461. */
  462. arguments?: any[];
  463. }
  464. /**
  465. * The Command namespace provides helper functions to work with
  466. * [Command](#Command) literals.
  467. */
  468. export declare namespace Command {
  469. /**
  470. * Creates a new Command literal.
  471. */
  472. function create(title: string, command: string, ...args: any[]): Command;
  473. /**
  474. * Checks whether the given literal conforms to the [Command](#Command) interface.
  475. */
  476. function is(value: any): value is Command;
  477. }
  478. /**
  479. * A text edit applicable to a text document.
  480. */
  481. export interface TextEdit {
  482. /**
  483. * The range of the text document to be manipulated. To insert
  484. * text into a document create a range where start === end.
  485. */
  486. range: Range;
  487. /**
  488. * The string to be inserted. For delete operations use an
  489. * empty string.
  490. */
  491. newText: string;
  492. }
  493. /**
  494. * The TextEdit namespace provides helper function to create replace,
  495. * insert and delete edits more easily.
  496. */
  497. export declare namespace TextEdit {
  498. /**
  499. * Creates a replace text edit.
  500. * @param range The range of text to be replaced.
  501. * @param newText The new text.
  502. */
  503. function replace(range: Range, newText: string): TextEdit;
  504. /**
  505. * Creates a insert text edit.
  506. * @param position The position to insert the text at.
  507. * @param newText The text to be inserted.
  508. */
  509. function insert(position: Position, newText: string): TextEdit;
  510. /**
  511. * Creates a delete text edit.
  512. * @param range The range of text to be deleted.
  513. */
  514. function del(range: Range): TextEdit;
  515. function is(value: any): value is TextEdit;
  516. }
  517. /**
  518. * Describes textual changes on a text document. A TextDocumentEdit describes all changes
  519. * on a document version Si and after they are applied move the document to version Si+1.
  520. * So the creator of a TextDocumentEdit doesn't need to sort the array of edits or do any
  521. * kind of ordering. However the edits must be non overlapping.
  522. */
  523. export interface TextDocumentEdit {
  524. /**
  525. * The text document to change.
  526. */
  527. textDocument: VersionedTextDocumentIdentifier;
  528. /**
  529. * The edits to be applied.
  530. */
  531. edits: TextEdit[];
  532. }
  533. /**
  534. * The TextDocumentEdit namespace provides helper function to create
  535. * an edit that manipulates a text document.
  536. */
  537. export declare namespace TextDocumentEdit {
  538. /**
  539. * Creates a new `TextDocumentEdit`
  540. */
  541. function create(textDocument: VersionedTextDocumentIdentifier, edits: TextEdit[]): TextDocumentEdit;
  542. function is(value: any): value is TextDocumentEdit;
  543. }
  544. interface ResourceOperation {
  545. kind: string;
  546. }
  547. /**
  548. * Options to create a file.
  549. */
  550. export interface CreateFileOptions {
  551. /**
  552. * Overwrite existing file. Overwrite wins over `ignoreIfExists`
  553. */
  554. overwrite?: boolean;
  555. /**
  556. * Ignore if exists.
  557. */
  558. ignoreIfExists?: boolean;
  559. }
  560. /**
  561. * Create file operation.
  562. */
  563. export interface CreateFile extends ResourceOperation {
  564. /**
  565. * A create
  566. */
  567. kind: 'create';
  568. /**
  569. * The resource to create.
  570. */
  571. uri: DocumentUri;
  572. /**
  573. * Additional options
  574. */
  575. options?: CreateFileOptions;
  576. }
  577. export declare namespace CreateFile {
  578. function create(uri: DocumentUri, options?: CreateFileOptions): CreateFile;
  579. function is(value: any): value is CreateFile;
  580. }
  581. /**
  582. * Rename file options
  583. */
  584. export interface RenameFileOptions {
  585. /**
  586. * Overwrite target if existing. Overwrite wins over `ignoreIfExists`
  587. */
  588. overwrite?: boolean;
  589. /**
  590. * Ignores if target exists.
  591. */
  592. ignoreIfExists?: boolean;
  593. }
  594. /**
  595. * Rename file operation
  596. */
  597. export interface RenameFile extends ResourceOperation {
  598. /**
  599. * A rename
  600. */
  601. kind: 'rename';
  602. /**
  603. * The old (existing) location.
  604. */
  605. oldUri: DocumentUri;
  606. /**
  607. * The new location.
  608. */
  609. newUri: DocumentUri;
  610. /**
  611. * Rename options.
  612. */
  613. options?: RenameFileOptions;
  614. }
  615. export declare namespace RenameFile {
  616. function create(oldUri: DocumentUri, newUri: DocumentUri, options?: RenameFileOptions): RenameFile;
  617. function is(value: any): value is RenameFile;
  618. }
  619. /**
  620. * Delete file options
  621. */
  622. export interface DeleteFileOptions {
  623. /**
  624. * Delete the content recursively if a folder is denoted.
  625. */
  626. recursive?: boolean;
  627. /**
  628. * Ignore the operation if the file doesn't exist.
  629. */
  630. ignoreIfNotExists?: boolean;
  631. }
  632. /**
  633. * Delete file operation
  634. */
  635. export interface DeleteFile extends ResourceOperation {
  636. /**
  637. * A delete
  638. */
  639. kind: 'delete';
  640. /**
  641. * The file to delete.
  642. */
  643. uri: DocumentUri;
  644. /**
  645. * Delete options.
  646. */
  647. options?: DeleteFileOptions;
  648. }
  649. export declare namespace DeleteFile {
  650. function create(uri: DocumentUri, options?: DeleteFileOptions): DeleteFile;
  651. function is(value: any): value is DeleteFile;
  652. }
  653. /**
  654. * A workspace edit represents changes to many resources managed in the workspace. The edit
  655. * should either provide `changes` or `documentChanges`. If documentChanges are present
  656. * they are preferred over `changes` if the client can handle versioned document edits.
  657. */
  658. export interface WorkspaceEdit {
  659. /**
  660. * Holds changes to existing resources.
  661. */
  662. changes?: {
  663. [uri: string]: TextEdit[];
  664. };
  665. /**
  666. * Depending on the client capability `workspace.workspaceEdit.resourceOperations` document changes
  667. * are either an array of `TextDocumentEdit`s to express changes to n different text documents
  668. * where each text document edit addresses a specific version of a text document. Or it can contain
  669. * above `TextDocumentEdit`s mixed with create, rename and delete file / folder operations.
  670. *
  671. * Whether a client supports versioned document edits is expressed via
  672. * `workspace.workspaceEdit.documentChanges` client capability.
  673. *
  674. * If a client neither supports `documentChanges` nor `workspace.workspaceEdit.resourceOperations` then
  675. * only plain `TextEdit`s using the `changes` property are supported.
  676. */
  677. documentChanges?: (TextDocumentEdit | CreateFile | RenameFile | DeleteFile)[];
  678. }
  679. export declare namespace WorkspaceEdit {
  680. function is(value: any): value is WorkspaceEdit;
  681. }
  682. /**
  683. * A change to capture text edits for existing resources.
  684. */
  685. export interface TextEditChange {
  686. /**
  687. * Gets all text edits for this change.
  688. *
  689. * @return An array of text edits.
  690. */
  691. all(): TextEdit[];
  692. /**
  693. * Clears the edits for this change.
  694. */
  695. clear(): void;
  696. /**
  697. * Adds a text edit.
  698. * @param edit the text edit to add.
  699. */
  700. add(edit: TextEdit): void;
  701. /**
  702. * Insert the given text at the given position.
  703. *
  704. * @param position A position.
  705. * @param newText A string.
  706. */
  707. insert(position: Position, newText: string): void;
  708. /**
  709. * Replace the given range with given text for the given resource.
  710. *
  711. * @param range A range.
  712. * @param newText A string.
  713. */
  714. replace(range: Range, newText: string): void;
  715. /**
  716. * Delete the text at the given range.
  717. *
  718. * @param range A range.
  719. */
  720. delete(range: Range): void;
  721. }
  722. /**
  723. * A workspace change helps constructing changes to a workspace.
  724. */
  725. export declare class WorkspaceChange {
  726. private _workspaceEdit;
  727. private _textEditChanges;
  728. constructor(workspaceEdit?: WorkspaceEdit);
  729. /**
  730. * Returns the underlying [WorkspaceEdit](#WorkspaceEdit) literal
  731. * use to be returned from a workspace edit operation like rename.
  732. */
  733. get edit(): WorkspaceEdit;
  734. /**
  735. * Returns the [TextEditChange](#TextEditChange) to manage text edits
  736. * for resources.
  737. */
  738. getTextEditChange(textDocument: VersionedTextDocumentIdentifier): TextEditChange;
  739. getTextEditChange(uri: DocumentUri): TextEditChange;
  740. createFile(uri: DocumentUri, options?: CreateFileOptions): void;
  741. renameFile(oldUri: DocumentUri, newUri: DocumentUri, options?: RenameFileOptions): void;
  742. deleteFile(uri: DocumentUri, options?: DeleteFileOptions): void;
  743. private checkDocumentChanges;
  744. }
  745. /**
  746. * A literal to identify a text document in the client.
  747. */
  748. export interface TextDocumentIdentifier {
  749. /**
  750. * The text document's uri.
  751. */
  752. uri: DocumentUri;
  753. }
  754. /**
  755. * The TextDocumentIdentifier namespace provides helper functions to work with
  756. * [TextDocumentIdentifier](#TextDocumentIdentifier) literals.
  757. */
  758. export declare namespace TextDocumentIdentifier {
  759. /**
  760. * Creates a new TextDocumentIdentifier literal.
  761. * @param uri The document's uri.
  762. */
  763. function create(uri: DocumentUri): TextDocumentIdentifier;
  764. /**
  765. * Checks whether the given literal conforms to the [TextDocumentIdentifier](#TextDocumentIdentifier) interface.
  766. */
  767. function is(value: any): value is TextDocumentIdentifier;
  768. }
  769. /**
  770. * An identifier to denote a specific version of a text document.
  771. */
  772. export interface VersionedTextDocumentIdentifier extends TextDocumentIdentifier {
  773. /**
  774. * The version number of this document. If a versioned text document identifier
  775. * is sent from the server to the client and the file is not open in the editor
  776. * (the server has not received an open notification before) the server can send
  777. * `null` to indicate that the version is unknown and the content on disk is the
  778. * truth (as speced with document content ownership).
  779. */
  780. version: number | null;
  781. }
  782. /**
  783. * The VersionedTextDocumentIdentifier namespace provides helper functions to work with
  784. * [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) literals.
  785. */
  786. export declare namespace VersionedTextDocumentIdentifier {
  787. /**
  788. * Creates a new VersionedTextDocumentIdentifier literal.
  789. * @param uri The document's uri.
  790. * @param uri The document's text.
  791. */
  792. function create(uri: DocumentUri, version: number | null): VersionedTextDocumentIdentifier;
  793. /**
  794. * Checks whether the given literal conforms to the [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) interface.
  795. */
  796. function is(value: any): value is VersionedTextDocumentIdentifier;
  797. }
  798. /**
  799. * An item to transfer a text document from the client to the
  800. * server.
  801. */
  802. export interface TextDocumentItem {
  803. /**
  804. * The text document's uri.
  805. */
  806. uri: DocumentUri;
  807. /**
  808. * The text document's language identifier
  809. */
  810. languageId: string;
  811. /**
  812. * The version number of this document (it will increase after each
  813. * change, including undo/redo).
  814. */
  815. version: number;
  816. /**
  817. * The content of the opened text document.
  818. */
  819. text: string;
  820. }
  821. /**
  822. * The TextDocumentItem namespace provides helper functions to work with
  823. * [TextDocumentItem](#TextDocumentItem) literals.
  824. */
  825. export declare namespace TextDocumentItem {
  826. /**
  827. * Creates a new TextDocumentItem literal.
  828. * @param uri The document's uri.
  829. * @param languageId The document's language identifier.
  830. * @param version The document's version number.
  831. * @param text The document's text.
  832. */
  833. function create(uri: DocumentUri, languageId: string, version: number, text: string): TextDocumentItem;
  834. /**
  835. * Checks whether the given literal conforms to the [TextDocumentItem](#TextDocumentItem) interface.
  836. */
  837. function is(value: any): value is TextDocumentItem;
  838. }
  839. /**
  840. * Describes the content type that a client supports in various
  841. * result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
  842. *
  843. * Please note that `MarkupKinds` must not start with a `$`. This kinds
  844. * are reserved for internal usage.
  845. */
  846. export declare namespace MarkupKind {
  847. /**
  848. * Plain text is supported as a content format
  849. */
  850. const PlainText: 'plaintext';
  851. /**
  852. * Markdown is supported as a content format
  853. */
  854. const Markdown: 'markdown';
  855. }
  856. export declare type MarkupKind = 'plaintext' | 'markdown';
  857. export declare namespace MarkupKind {
  858. /**
  859. * Checks whether the given value is a value of the [MarkupKind](#MarkupKind) type.
  860. */
  861. function is(value: any): value is MarkupKind;
  862. }
  863. /**
  864. * A `MarkupContent` literal represents a string value which content is interpreted base on its
  865. * kind flag. Currently the protocol supports `plaintext` and `markdown` as markup kinds.
  866. *
  867. * If the kind is `markdown` then the value can contain fenced code blocks like in GitHub issues.
  868. * See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting
  869. *
  870. * Here is an example how such a string can be constructed using JavaScript / TypeScript:
  871. * ```ts
  872. * let markdown: MarkdownContent = {
  873. * kind: MarkupKind.Markdown,
  874. * value: [
  875. * '# Header',
  876. * 'Some text',
  877. * '```typescript',
  878. * 'someCode();',
  879. * '```'
  880. * ].join('\n')
  881. * };
  882. * ```
  883. *
  884. * *Please Note* that clients might sanitize the return markdown. A client could decide to
  885. * remove HTML from the markdown to avoid script execution.
  886. */
  887. export interface MarkupContent {
  888. /**
  889. * The type of the Markup
  890. */
  891. kind: MarkupKind;
  892. /**
  893. * The content itself
  894. */
  895. value: string;
  896. }
  897. export declare namespace MarkupContent {
  898. /**
  899. * Checks whether the given value conforms to the [MarkupContent](#MarkupContent) interface.
  900. */
  901. function is(value: any): value is MarkupContent;
  902. }
  903. /**
  904. * The kind of a completion entry.
  905. */
  906. export declare namespace CompletionItemKind {
  907. const Text: 1;
  908. const Method: 2;
  909. const Function: 3;
  910. const Constructor: 4;
  911. const Field: 5;
  912. const Variable: 6;
  913. const Class: 7;
  914. const Interface: 8;
  915. const Module: 9;
  916. const Property: 10;
  917. const Unit: 11;
  918. const Value: 12;
  919. const Enum: 13;
  920. const Keyword: 14;
  921. const Snippet: 15;
  922. const Color: 16;
  923. const File: 17;
  924. const Reference: 18;
  925. const Folder: 19;
  926. const EnumMember: 20;
  927. const Constant: 21;
  928. const Struct: 22;
  929. const Event: 23;
  930. const Operator: 24;
  931. const TypeParameter: 25;
  932. }
  933. export declare type CompletionItemKind = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25;
  934. /**
  935. * Defines whether the insert text in a completion item should be interpreted as
  936. * plain text or a snippet.
  937. */
  938. export declare namespace InsertTextFormat {
  939. /**
  940. * The primary text to be inserted is treated as a plain string.
  941. */
  942. const PlainText: 1;
  943. /**
  944. * The primary text to be inserted is treated as a snippet.
  945. *
  946. * A snippet can define tab stops and placeholders with `$1`, `$2`
  947. * and `${3:foo}`. `$0` defines the final tab stop, it defaults to
  948. * the end of the snippet. Placeholders with equal identifiers are linked,
  949. * that is typing in one will update others too.
  950. *
  951. * See also: https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md
  952. */
  953. const Snippet: 2;
  954. }
  955. export declare type InsertTextFormat = 1 | 2;
  956. /**
  957. * Completion item tags are extra annotations that tweak the rendering of a completion
  958. * item.
  959. *
  960. * @since 3.15.0
  961. */
  962. export declare namespace CompletionItemTag {
  963. /**
  964. * Render a completion as obsolete, usually using a strike-out.
  965. */
  966. const Deprecated = 1;
  967. }
  968. export declare type CompletionItemTag = 1;
  969. /**
  970. * A completion item represents a text snippet that is
  971. * proposed to complete text that is being typed.
  972. */
  973. export interface CompletionItem {
  974. /**
  975. * The label of this completion item. By default
  976. * also the text that is inserted when selecting
  977. * this completion.
  978. */
  979. label: string;
  980. /**
  981. * The kind of this completion item. Based of the kind
  982. * an icon is chosen by the editor.
  983. */
  984. kind?: CompletionItemKind;
  985. /**
  986. * Tags for this completion item.
  987. *
  988. * @since 3.15.0
  989. */
  990. tags?: CompletionItemTag[];
  991. /**
  992. * A human-readable string with additional information
  993. * about this item, like type or symbol information.
  994. */
  995. detail?: string;
  996. /**
  997. * A human-readable string that represents a doc-comment.
  998. */
  999. documentation?: string | MarkupContent;
  1000. /**
  1001. * Indicates if this item is deprecated.
  1002. * @deprecated Use `tags` instead.
  1003. */
  1004. deprecated?: boolean;
  1005. /**
  1006. * Select this item when showing.
  1007. *
  1008. * *Note* that only one completion item can be selected and that the
  1009. * tool / client decides which item that is. The rule is that the *first*
  1010. * item of those that match best is selected.
  1011. */
  1012. preselect?: boolean;
  1013. /**
  1014. * A string that should be used when comparing this item
  1015. * with other items. When `falsy` the [label](#CompletionItem.label)
  1016. * is used.
  1017. */
  1018. sortText?: string;
  1019. /**
  1020. * A string that should be used when filtering a set of
  1021. * completion items. When `falsy` the [label](#CompletionItem.label)
  1022. * is used.
  1023. */
  1024. filterText?: string;
  1025. /**
  1026. * A string that should be inserted into a document when selecting
  1027. * this completion. When `falsy` the [label](#CompletionItem.label)
  1028. * is used.
  1029. *
  1030. * The `insertText` is subject to interpretation by the client side.
  1031. * Some tools might not take the string literally. For example
  1032. * VS Code when code complete is requested in this example `con<cursor position>`
  1033. * and a completion item with an `insertText` of `console` is provided it
  1034. * will only insert `sole`. Therefore it is recommended to use `textEdit` instead
  1035. * since it avoids additional client side interpretation.
  1036. */
  1037. insertText?: string;
  1038. /**
  1039. * The format of the insert text. The format applies to both the `insertText` property
  1040. * and the `newText` property of a provided `textEdit`. If ommitted defaults to
  1041. * `InsertTextFormat.PlainText`.
  1042. */
  1043. insertTextFormat?: InsertTextFormat;
  1044. /**
  1045. * An [edit](#TextEdit) which is applied to a document when selecting
  1046. * this completion. When an edit is provided the value of
  1047. * [insertText](#CompletionItem.insertText) is ignored.
  1048. *
  1049. * *Note:* The text edit's range must be a [single line] and it must contain the position
  1050. * at which completion has been requested.
  1051. */
  1052. textEdit?: TextEdit;
  1053. /**
  1054. * An optional array of additional [text edits](#TextEdit) that are applied when
  1055. * selecting this completion. Edits must not overlap (including the same insert position)
  1056. * with the main [edit](#CompletionItem.textEdit) nor with themselves.
  1057. *
  1058. * Additional text edits should be used to change text unrelated to the current cursor position
  1059. * (for example adding an import statement at the top of the file if the completion item will
  1060. * insert an unqualified type).
  1061. */
  1062. additionalTextEdits?: TextEdit[];
  1063. /**
  1064. * An optional set of characters that when pressed while this completion is active will accept it first and
  1065. * then type that character. *Note* that all commit characters should have `length=1` and that superfluous
  1066. * characters will be ignored.
  1067. */
  1068. commitCharacters?: string[];
  1069. /**
  1070. * An optional [command](#Command) that is executed *after* inserting this completion. *Note* that
  1071. * additional modifications to the current document should be described with the
  1072. * [additionalTextEdits](#CompletionItem.additionalTextEdits)-property.
  1073. */
  1074. command?: Command;
  1075. /**
  1076. * An data entry field that is preserved on a completion item between
  1077. * a [CompletionRequest](#CompletionRequest) and a [CompletionResolveRequest]
  1078. * (#CompletionResolveRequest)
  1079. */
  1080. data?: any;
  1081. }
  1082. /**
  1083. * The CompletionItem namespace provides functions to deal with
  1084. * completion items.
  1085. */
  1086. export declare namespace CompletionItem {
  1087. /**
  1088. * Create a completion item and seed it with a label.
  1089. * @param label The completion item's label
  1090. */
  1091. function create(label: string): CompletionItem;
  1092. }
  1093. /**
  1094. * Represents a collection of [completion items](#CompletionItem) to be presented
  1095. * in the editor.
  1096. */
  1097. export interface CompletionList {
  1098. /**
  1099. * This list it not complete. Further typing results in recomputing this list.
  1100. */
  1101. isIncomplete: boolean;
  1102. /**
  1103. * The completion items.
  1104. */
  1105. items: CompletionItem[];
  1106. }
  1107. /**
  1108. * The CompletionList namespace provides functions to deal with
  1109. * completion lists.
  1110. */
  1111. export declare namespace CompletionList {
  1112. /**
  1113. * Creates a new completion list.
  1114. *
  1115. * @param items The completion items.
  1116. * @param isIncomplete The list is not complete.
  1117. */
  1118. function create(items?: CompletionItem[], isIncomplete?: boolean): CompletionList;
  1119. }
  1120. /**
  1121. * MarkedString can be used to render human readable text. It is either a markdown string
  1122. * or a code-block that provides a language and a code snippet. The language identifier
  1123. * is semantically equal to the optional language identifier in fenced code blocks in GitHub
  1124. * issues. See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting
  1125. *
  1126. * The pair of a language and a value is an equivalent to markdown:
  1127. * ```${language}
  1128. * ${value}
  1129. * ```
  1130. *
  1131. * Note that markdown strings will be sanitized - that means html will be escaped.
  1132. * @deprecated use MarkupContent instead.
  1133. */
  1134. export declare type MarkedString = string | {
  1135. language: string;
  1136. value: string;
  1137. };
  1138. export declare namespace MarkedString {
  1139. /**
  1140. * Creates a marked string from plain text.
  1141. *
  1142. * @param plainText The plain text.
  1143. */
  1144. function fromPlainText(plainText: string): string;
  1145. /**
  1146. * Checks whether the given value conforms to the [MarkedString](#MarkedString) type.
  1147. */
  1148. function is(value: any): value is MarkedString;
  1149. }
  1150. /**
  1151. * The result of a hover request.
  1152. */
  1153. export interface Hover {
  1154. /**
  1155. * The hover's content
  1156. */
  1157. contents: MarkupContent | MarkedString | MarkedString[];
  1158. /**
  1159. * An optional range
  1160. */
  1161. range?: Range;
  1162. }
  1163. export declare namespace Hover {
  1164. /**
  1165. * Checks whether the given value conforms to the [Hover](#Hover) interface.
  1166. */
  1167. function is(value: any): value is Hover;
  1168. }
  1169. /**
  1170. * Represents a parameter of a callable-signature. A parameter can
  1171. * have a label and a doc-comment.
  1172. */
  1173. export interface ParameterInformation {
  1174. /**
  1175. * The label of this parameter information.
  1176. *
  1177. * Either a string or an inclusive start and exclusive end offsets within its containing
  1178. * signature label. (see SignatureInformation.label). The offsets are based on a UTF-16
  1179. * string representation as `Position` and `Range` does.
  1180. *
  1181. * *Note*: a label of type string should be a substring of its containing signature label.
  1182. * Its intended use case is to highlight the parameter label part in the `SignatureInformation.label`.
  1183. */
  1184. label: string | [number, number];
  1185. /**
  1186. * The human-readable doc-comment of this signature. Will be shown
  1187. * in the UI but can be omitted.
  1188. */
  1189. documentation?: string | MarkupContent;
  1190. }
  1191. /**
  1192. * The ParameterInformation namespace provides helper functions to work with
  1193. * [ParameterInformation](#ParameterInformation) literals.
  1194. */
  1195. export declare namespace ParameterInformation {
  1196. /**
  1197. * Creates a new parameter information literal.
  1198. *
  1199. * @param label A label string.
  1200. * @param documentation A doc string.
  1201. */
  1202. function create(label: string | [number, number], documentation?: string): ParameterInformation;
  1203. }
  1204. /**
  1205. * Represents the signature of something callable. A signature
  1206. * can have a label, like a function-name, a doc-comment, and
  1207. * a set of parameters.
  1208. */
  1209. export interface SignatureInformation {
  1210. /**
  1211. * The label of this signature. Will be shown in
  1212. * the UI.
  1213. */
  1214. label: string;
  1215. /**
  1216. * The human-readable doc-comment of this signature. Will be shown
  1217. * in the UI but can be omitted.
  1218. */
  1219. documentation?: string | MarkupContent;
  1220. /**
  1221. * The parameters of this signature.
  1222. */
  1223. parameters?: ParameterInformation[];
  1224. }
  1225. /**
  1226. * The SignatureInformation namespace provides helper functions to work with
  1227. * [SignatureInformation](#SignatureInformation) literals.
  1228. */
  1229. export declare namespace SignatureInformation {
  1230. function create(label: string, documentation?: string, ...parameters: ParameterInformation[]): SignatureInformation;
  1231. }
  1232. /**
  1233. * Signature help represents the signature of something
  1234. * callable. There can be multiple signature but only one
  1235. * active and only one active parameter.
  1236. */
  1237. export interface SignatureHelp {
  1238. /**
  1239. * One or more signatures.
  1240. */
  1241. signatures: SignatureInformation[];
  1242. /**
  1243. * The active signature. Set to `null` if no
  1244. * signatures exist.
  1245. */
  1246. activeSignature: number | null;
  1247. /**
  1248. * The active parameter of the active signature. Set to `null`
  1249. * if the active signature has no parameters.
  1250. */
  1251. activeParameter: number | null;
  1252. }
  1253. /**
  1254. * The definition of a symbol represented as one or many [locations](#Location).
  1255. * For most programming languages there is only one location at which a symbol is
  1256. * defined.
  1257. *
  1258. * Servers should prefer returning `DefinitionLink` over `Definition` if supported
  1259. * by the client.
  1260. */
  1261. export declare type Definition = Location | Location[];
  1262. /**
  1263. * Information about where a symbol is defined.
  1264. *
  1265. * Provides additional metadata over normal [location](#Location) definitions, including the range of
  1266. * the defining symbol
  1267. */
  1268. export declare type DefinitionLink = LocationLink;
  1269. /**
  1270. * The declaration of a symbol representation as one or many [locations](#Location).
  1271. */
  1272. export declare type Declaration = Location | Location[];
  1273. /**
  1274. * Information about where a symbol is declared.
  1275. *
  1276. * Provides additional metadata over normal [location](#Location) declarations, including the range of
  1277. * the declaring symbol.
  1278. *
  1279. * Servers should prefer returning `DeclarationLink` over `Declaration` if supported
  1280. * by the client.
  1281. */
  1282. export declare type DeclarationLink = LocationLink;
  1283. /**
  1284. * Value-object that contains additional information when
  1285. * requesting references.
  1286. */
  1287. export interface ReferenceContext {
  1288. /**
  1289. * Include the declaration of the current symbol.
  1290. */
  1291. includeDeclaration: boolean;
  1292. }
  1293. /**
  1294. * A document highlight kind.
  1295. */
  1296. export declare namespace DocumentHighlightKind {
  1297. /**
  1298. * A textual occurrence.
  1299. */
  1300. const Text: 1;
  1301. /**
  1302. * Read-access of a symbol, like reading a variable.
  1303. */
  1304. const Read: 2;
  1305. /**
  1306. * Write-access of a symbol, like writing to a variable.
  1307. */
  1308. const Write: 3;
  1309. }
  1310. export declare type DocumentHighlightKind = 1 | 2 | 3;
  1311. /**
  1312. * A document highlight is a range inside a text document which deserves
  1313. * special attention. Usually a document highlight is visualized by changing
  1314. * the background color of its range.
  1315. */
  1316. export interface DocumentHighlight {
  1317. /**
  1318. * The range this highlight applies to.
  1319. */
  1320. range: Range;
  1321. /**
  1322. * The highlight kind, default is [text](#DocumentHighlightKind.Text).
  1323. */
  1324. kind?: DocumentHighlightKind;
  1325. }
  1326. /**
  1327. * DocumentHighlight namespace to provide helper functions to work with
  1328. * [DocumentHighlight](#DocumentHighlight) literals.
  1329. */
  1330. export declare namespace DocumentHighlight {
  1331. /**
  1332. * Create a DocumentHighlight object.
  1333. * @param range The range the highlight applies to.
  1334. */
  1335. function create(range: Range, kind?: DocumentHighlightKind): DocumentHighlight;
  1336. }
  1337. /**
  1338. * A symbol kind.
  1339. */
  1340. export declare namespace SymbolKind {
  1341. const File: 1;
  1342. const Module: 2;
  1343. const Namespace: 3;
  1344. const Package: 4;
  1345. const Class: 5;
  1346. const Method: 6;
  1347. const Property: 7;
  1348. const Field: 8;
  1349. const Constructor: 9;
  1350. const Enum: 10;
  1351. const Interface: 11;
  1352. const Function: 12;
  1353. const Variable: 13;
  1354. const Constant: 14;
  1355. const String: 15;
  1356. const Number: 16;
  1357. const Boolean: 17;
  1358. const Array: 18;
  1359. const Object: 19;
  1360. const Key: 20;
  1361. const Null: 21;
  1362. const EnumMember: 22;
  1363. const Struct: 23;
  1364. const Event: 24;
  1365. const Operator: 25;
  1366. const TypeParameter: 26;
  1367. }
  1368. export declare type SymbolKind = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26;
  1369. /**
  1370. * Symbol tags are extra annotations that tweak the rendering of a symbol.
  1371. * @since 3.15
  1372. */
  1373. export declare namespace SymbolTag {
  1374. /**
  1375. * Render a symbol as obsolete, usually using a strike-out.
  1376. */
  1377. const Deprecated: 1;
  1378. }
  1379. export declare type SymbolTag = 1;
  1380. /**
  1381. * Represents information about programming constructs like variables, classes,
  1382. * interfaces etc.
  1383. */
  1384. export interface SymbolInformation {
  1385. /**
  1386. * The name of this symbol.
  1387. */
  1388. name: string;
  1389. /**
  1390. * The kind of this symbol.
  1391. */
  1392. kind: SymbolKind;
  1393. /**
  1394. * Indicates if this symbol is deprecated.
  1395. */
  1396. deprecated?: boolean;
  1397. /**
  1398. * The location of this symbol. The location's range is used by a tool
  1399. * to reveal the location in the editor. If the symbol is selected in the
  1400. * tool the range's start information is used to position the cursor. So
  1401. * the range usually spans more than the actual symbol's name and does
  1402. * normally include thinks like visibility modifiers.
  1403. *
  1404. * The range doesn't have to denote a node range in the sense of a abstract
  1405. * syntax tree. It can therefore not be used to re-construct a hierarchy of
  1406. * the symbols.
  1407. */
  1408. location: Location;
  1409. /**
  1410. * The name of the symbol containing this symbol. This information is for
  1411. * user interface purposes (e.g. to render a qualifier in the user interface
  1412. * if necessary). It can't be used to re-infer a hierarchy for the document
  1413. * symbols.
  1414. */
  1415. containerName?: string;
  1416. }
  1417. export declare namespace SymbolInformation {
  1418. /**
  1419. * Creates a new symbol information literal.
  1420. *
  1421. * @param name The name of the symbol.
  1422. * @param kind The kind of the symbol.
  1423. * @param range The range of the location of the symbol.
  1424. * @param uri The resource of the location of symbol, defaults to the current document.
  1425. * @param containerName The name of the symbol containing the symbol.
  1426. */
  1427. function create(name: string, kind: SymbolKind, range: Range, uri?: string, containerName?: string): SymbolInformation;
  1428. }
  1429. /**
  1430. * Represents programming constructs like variables, classes, interfaces etc.
  1431. * that appear in a document. Document symbols can be hierarchical and they
  1432. * have two ranges: one that encloses its definition and one that points to
  1433. * its most interesting range, e.g. the range of an identifier.
  1434. */
  1435. export interface DocumentSymbol {
  1436. /**
  1437. * The name of this symbol. Will be displayed in the user interface and therefore must not be
  1438. * an empty string or a string only consisting of white spaces.
  1439. */
  1440. name: string;
  1441. /**
  1442. * More detail for this symbol, e.g the signature of a function.
  1443. */
  1444. detail?: string;
  1445. /**
  1446. * The kind of this symbol.
  1447. */
  1448. kind: SymbolKind;
  1449. /**
  1450. * Indicates if this symbol is deprecated.
  1451. */
  1452. deprecated?: boolean;
  1453. /**
  1454. * The range enclosing this symbol not including leading/trailing whitespace but everything else
  1455. * like comments. This information is typically used to determine if the the clients cursor is
  1456. * inside the symbol to reveal in the symbol in the UI.
  1457. */
  1458. range: Range;
  1459. /**
  1460. * The range that should be selected and revealed when this symbol is being picked, e.g the name of a function.
  1461. * Must be contained by the the `range`.
  1462. */
  1463. selectionRange: Range;
  1464. /**
  1465. * Children of this symbol, e.g. properties of a class.
  1466. */
  1467. children?: DocumentSymbol[];
  1468. }
  1469. export declare namespace DocumentSymbol {
  1470. /**
  1471. * Creates a new symbol information literal.
  1472. *
  1473. * @param name The name of the symbol.
  1474. * @param detail The detail of the symbol.
  1475. * @param kind The kind of the symbol.
  1476. * @param range The range of the symbol.
  1477. * @param selectionRange The selectionRange of the symbol.
  1478. * @param children Children of the symbol.
  1479. */
  1480. function create(name: string, detail: string | undefined, kind: SymbolKind, range: Range, selectionRange: Range, children?: DocumentSymbol[]): DocumentSymbol;
  1481. /**
  1482. * Checks whether the given literal conforms to the [DocumentSymbol](#DocumentSymbol) interface.
  1483. */
  1484. function is(value: any): value is DocumentSymbol;
  1485. }
  1486. /**
  1487. * The kind of a code action.
  1488. *
  1489. * Kinds are a hierarchical list of identifiers separated by `.`, e.g. `"refactor.extract.function"`.
  1490. *
  1491. * The set of kinds is open and client needs to announce the kinds it supports to the server during
  1492. * initialization.
  1493. */
  1494. export declare type CodeActionKind = string;
  1495. /**
  1496. * A set of predefined code action kinds
  1497. */
  1498. export declare namespace CodeActionKind {
  1499. /**
  1500. * Empty kind.
  1501. */
  1502. const Empty: CodeActionKind;
  1503. /**
  1504. * Base kind for quickfix actions: 'quickfix'
  1505. */
  1506. const QuickFix: CodeActionKind;
  1507. /**
  1508. * Base kind for refactoring actions: 'refactor'
  1509. */
  1510. const Refactor: CodeActionKind;
  1511. /**
  1512. * Base kind for refactoring extraction actions: 'refactor.extract'
  1513. *
  1514. * Example extract actions:
  1515. *
  1516. * - Extract method
  1517. * - Extract function
  1518. * - Extract variable
  1519. * - Extract interface from class
  1520. * - ...
  1521. */
  1522. const RefactorExtract: CodeActionKind;
  1523. /**
  1524. * Base kind for refactoring inline actions: 'refactor.inline'
  1525. *
  1526. * Example inline actions:
  1527. *
  1528. * - Inline function
  1529. * - Inline variable
  1530. * - Inline constant
  1531. * - ...
  1532. */
  1533. const RefactorInline: CodeActionKind;
  1534. /**
  1535. * Base kind for refactoring rewrite actions: 'refactor.rewrite'
  1536. *
  1537. * Example rewrite actions:
  1538. *
  1539. * - Convert JavaScript function to class
  1540. * - Add or remove parameter
  1541. * - Encapsulate field
  1542. * - Make method static
  1543. * - Move method to base class
  1544. * - ...
  1545. */
  1546. const RefactorRewrite: CodeActionKind;
  1547. /**
  1548. * Base kind for source actions: `source`
  1549. *
  1550. * Source code actions apply to the entire file.
  1551. */
  1552. const Source: CodeActionKind;
  1553. /**
  1554. * Base kind for an organize imports source action: `source.organizeImports`
  1555. */
  1556. const SourceOrganizeImports: CodeActionKind;
  1557. /**
  1558. * Base kind for auto-fix source actions: `source.fixAll`.
  1559. *
  1560. * Fix all actions automatically fix errors that have a clear fix that do not require user input.
  1561. * They should not suppress errors or perform unsafe fixes such as generating new types or classes.
  1562. *
  1563. * @since 3.15.0
  1564. */
  1565. const SourceFixAll: CodeActionKind;
  1566. }
  1567. /**
  1568. * Contains additional diagnostic information about the context in which
  1569. * a [code action](#CodeActionProvider.provideCodeActions) is run.
  1570. */
  1571. export interface CodeActionContext {
  1572. /**
  1573. * An array of diagnostics known on the client side overlapping the range provided to the
  1574. * `textDocument/codeAction` request. They are provied so that the server knows which
  1575. * errors are currently presented to the user for the given range. There is no guarantee
  1576. * that these accurately reflect the error state of the resource. The primary parameter
  1577. * to compute code actions is the provided range.
  1578. */
  1579. diagnostics: Diagnostic[];
  1580. /**
  1581. * Requested kind of actions to return.
  1582. *
  1583. * Actions not of this kind are filtered out by the client before being shown. So servers
  1584. * can omit computing them.
  1585. */
  1586. only?: CodeActionKind[];
  1587. }
  1588. /**
  1589. * The CodeActionContext namespace provides helper functions to work with
  1590. * [CodeActionContext](#CodeActionContext) literals.
  1591. */
  1592. export declare namespace CodeActionContext {
  1593. /**
  1594. * Creates a new CodeActionContext literal.
  1595. */
  1596. function create(diagnostics: Diagnostic[], only?: CodeActionKind[]): CodeActionContext;
  1597. /**
  1598. * Checks whether the given literal conforms to the [CodeActionContext](#CodeActionContext) interface.
  1599. */
  1600. function is(value: any): value is CodeActionContext;
  1601. }
  1602. /**
  1603. * A code action represents a change that can be performed in code, e.g. to fix a problem or
  1604. * to refactor code.
  1605. *
  1606. * A CodeAction must set either `edit` and/or a `command`. If both are supplied, the `edit` is applied first, then the `command` is executed.
  1607. */
  1608. export interface CodeAction {
  1609. /**
  1610. * A short, human-readable, title for this code action.
  1611. */
  1612. title: string;
  1613. /**
  1614. * The kind of the code action.
  1615. *
  1616. * Used to filter code actions.
  1617. */
  1618. kind?: CodeActionKind;
  1619. /**
  1620. * The diagnostics that this code action resolves.
  1621. */
  1622. diagnostics?: Diagnostic[];
  1623. /**
  1624. * Marks this as a preferred action. Preferred actions are used by the `auto fix` command and can be targeted
  1625. * by keybindings.
  1626. *
  1627. * A quick fix should be marked preferred if it properly addresses the underlying error.
  1628. * A refactoring should be marked preferred if it is the most reasonable choice of actions to take.
  1629. *
  1630. * @since 3.15.0
  1631. */
  1632. isPreferred?: boolean;
  1633. /**
  1634. * The workspace edit this code action performs.
  1635. */
  1636. edit?: WorkspaceEdit;
  1637. /**
  1638. * A command this code action executes. If a code action
  1639. * provides a edit and a command, first the edit is
  1640. * executed and then the command.
  1641. */
  1642. command?: Command;
  1643. }
  1644. export declare namespace CodeAction {
  1645. /**
  1646. * Creates a new code action.
  1647. *
  1648. * @param title The title of the code action.
  1649. * @param command The command to execute.
  1650. * @param kind The kind of the code action.
  1651. */
  1652. function create(title: string, command: Command, kind?: CodeActionKind): CodeAction;
  1653. /**
  1654. * Creates a new code action.
  1655. *
  1656. * @param title The title of the code action.
  1657. * @param command The command to execute.
  1658. * @param kind The kind of the code action.
  1659. */
  1660. function create(title: string, edit: WorkspaceEdit, kind?: CodeActionKind): CodeAction;
  1661. function is(value: any): value is CodeAction;
  1662. }
  1663. /**
  1664. * A code lens represents a [command](#Command) that should be shown along with
  1665. * source text, like the number of references, a way to run tests, etc.
  1666. *
  1667. * A code lens is _unresolved_ when no command is associated to it. For performance
  1668. * reasons the creation of a code lens and resolving should be done to two stages.
  1669. */
  1670. export interface CodeLens {
  1671. /**
  1672. * The range in which this code lens is valid. Should only span a single line.
  1673. */
  1674. range: Range;
  1675. /**
  1676. * The command this code lens represents.
  1677. */
  1678. command?: Command;
  1679. /**
  1680. * An data entry field that is preserved on a code lens item between
  1681. * a [CodeLensRequest](#CodeLensRequest) and a [CodeLensResolveRequest]
  1682. * (#CodeLensResolveRequest)
  1683. */
  1684. data?: any;
  1685. }
  1686. /**
  1687. * The CodeLens namespace provides helper functions to work with
  1688. * [CodeLens](#CodeLens) literals.
  1689. */
  1690. export declare namespace CodeLens {
  1691. /**
  1692. * Creates a new CodeLens literal.
  1693. */
  1694. function create(range: Range, data?: any): CodeLens;
  1695. /**
  1696. * Checks whether the given literal conforms to the [CodeLens](#CodeLens) interface.
  1697. */
  1698. function is(value: any): value is CodeLens;
  1699. }
  1700. /**
  1701. * Value-object describing what options formatting should use.
  1702. */
  1703. export interface FormattingOptions {
  1704. /**
  1705. * Size of a tab in spaces.
  1706. */
  1707. tabSize: number;
  1708. /**
  1709. * Prefer spaces over tabs.
  1710. */
  1711. insertSpaces: boolean;
  1712. /**
  1713. * Trim trailing whitespaces on a line.
  1714. *
  1715. * @since 3.15.0
  1716. */
  1717. trimTrailingWhitespace?: boolean;
  1718. /**
  1719. * Insert a newline character at the end of the file if one does not exist.
  1720. *
  1721. * @since 3.15.0
  1722. */
  1723. insertFinalNewline?: boolean;
  1724. /**
  1725. * Trim all newlines after the final newline at the end of the file.
  1726. *
  1727. * @since 3.15.0
  1728. */
  1729. trimFinalNewlines?: boolean;
  1730. /**
  1731. * Signature for further properties.
  1732. */
  1733. [key: string]: boolean | number | string | undefined;
  1734. }
  1735. /**
  1736. * The FormattingOptions namespace provides helper functions to work with
  1737. * [FormattingOptions](#FormattingOptions) literals.
  1738. */
  1739. export declare namespace FormattingOptions {
  1740. /**
  1741. * Creates a new FormattingOptions literal.
  1742. */
  1743. function create(tabSize: number, insertSpaces: boolean): FormattingOptions;
  1744. /**
  1745. * Checks whether the given literal conforms to the [FormattingOptions](#FormattingOptions) interface.
  1746. */
  1747. function is(value: any): value is FormattingOptions;
  1748. }
  1749. /**
  1750. * A document link is a range in a text document that links to an internal or external resource, like another
  1751. * text document or a web site.
  1752. */
  1753. export interface DocumentLink {
  1754. /**
  1755. * The range this link applies to.
  1756. */
  1757. range: Range;
  1758. /**
  1759. * The uri this link points to.
  1760. */
  1761. target?: string;
  1762. /**
  1763. * The tooltip text when you hover over this link.
  1764. *
  1765. * If a tooltip is provided, is will be displayed in a string that includes instructions on how to
  1766. * trigger the link, such as `{0} (ctrl + click)`. The specific instructions vary depending on OS,
  1767. * user settings, and localization.
  1768. *
  1769. * @since 3.15.0
  1770. */
  1771. tooltip?: string;
  1772. /**
  1773. * A data entry field that is preserved on a document link between a
  1774. * DocumentLinkRequest and a DocumentLinkResolveRequest.
  1775. */
  1776. data?: any;
  1777. }
  1778. /**
  1779. * The DocumentLink namespace provides helper functions to work with
  1780. * [DocumentLink](#DocumentLink) literals.
  1781. */
  1782. export declare namespace DocumentLink {
  1783. /**
  1784. * Creates a new DocumentLink literal.
  1785. */
  1786. function create(range: Range, target?: string, data?: any): DocumentLink;
  1787. /**
  1788. * Checks whether the given literal conforms to the [DocumentLink](#DocumentLink) interface.
  1789. */
  1790. function is(value: any): value is DocumentLink;
  1791. }
  1792. /**
  1793. * A selection range represents a part of a selection hierarchy. A selection range
  1794. * may have a parent selection range that contains it.
  1795. */
  1796. export interface SelectionRange {
  1797. /**
  1798. * The [range](#Range) of this selection range.
  1799. */
  1800. range: Range;
  1801. /**
  1802. * The parent selection range containing this range. Therefore `parent.range` must contain `this.range`.
  1803. */
  1804. parent?: SelectionRange;
  1805. }
  1806. /**
  1807. * The SelectionRange namespace provides helper function to work with
  1808. * SelectionRange literals.
  1809. */
  1810. export declare namespace SelectionRange {
  1811. /**
  1812. * Creates a new SelectionRange
  1813. * @param range the range.
  1814. * @param parent an optional parent.
  1815. */
  1816. function create(range: Range, parent?: SelectionRange): SelectionRange;
  1817. function is(value: any): value is SelectionRange;
  1818. }
  1819. export declare const EOL: string[];
  1820. /**
  1821. * A simple text document. Not to be implemented. The document keeps the content
  1822. * as string.
  1823. *
  1824. * @deprecated Use the text document from the new vscode-languageserver-textdocument package.
  1825. */
  1826. export interface TextDocument {
  1827. /**
  1828. * The associated URI for this document. Most documents have the __file__-scheme, indicating that they
  1829. * represent files on disk. However, some documents may have other schemes indicating that they are not
  1830. * available on disk.
  1831. *
  1832. * @readonly
  1833. */
  1834. readonly uri: DocumentUri;
  1835. /**
  1836. * The identifier of the language associated with this document.
  1837. *
  1838. * @readonly
  1839. */
  1840. readonly languageId: string;
  1841. /**
  1842. * The version number of this document (it will increase after each
  1843. * change, including undo/redo).
  1844. *
  1845. * @readonly
  1846. */
  1847. readonly version: number;
  1848. /**
  1849. * Get the text of this document. A substring can be retrieved by
  1850. * providing a range.
  1851. *
  1852. * @param range (optional) An range within the document to return.
  1853. * If no range is passed, the full content is returned.
  1854. * Invalid range positions are adjusted as described in [Position.line](#Position.line)
  1855. * and [Position.character](#Position.character).
  1856. * If the start range position is greater than the end range position,
  1857. * then the effect of getText is as if the two positions were swapped.
  1858. * @return The text of this document or a substring of the text if a
  1859. * range is provided.
  1860. */
  1861. getText(range?: Range): string;
  1862. /**
  1863. * Converts a zero-based offset to a position.
  1864. *
  1865. * @param offset A zero-based offset.
  1866. * @return A valid [position](#Position).
  1867. */
  1868. positionAt(offset: number): Position;
  1869. /**
  1870. * Converts the position to a zero-based offset.
  1871. * Invalid positions are adjusted as described in [Position.line](#Position.line)
  1872. * and [Position.character](#Position.character).
  1873. *
  1874. * @param position A position.
  1875. * @return A valid zero-based offset.
  1876. */
  1877. offsetAt(position: Position): number;
  1878. /**
  1879. * The number of lines in this document.
  1880. *
  1881. * @readonly
  1882. */
  1883. readonly lineCount: number;
  1884. }
  1885. /**
  1886. * @deprecated Use the text document from the new vscode-languageserver-textdocument package.
  1887. */
  1888. export declare namespace TextDocument {
  1889. /**
  1890. * Creates a new ITextDocument literal from the given uri and content.
  1891. * @param uri The document's uri.
  1892. * @param languageId The document's language Id.
  1893. * @param content The document's content.
  1894. */
  1895. function create(uri: DocumentUri, languageId: string, version: number, content: string): TextDocument;
  1896. /**
  1897. * Checks whether the given literal conforms to the [ITextDocument](#ITextDocument) interface.
  1898. */
  1899. function is(value: any): value is TextDocument;
  1900. function applyEdits(document: TextDocument, edits: TextEdit[]): string;
  1901. }
  1902. /**
  1903. * @deprecated No longer used, use TextDocumentChangeEvent<TextDocument> from vscode-languageserver instead.
  1904. */
  1905. export interface TextDocumentChangeEvent {
  1906. /**
  1907. * The document that has changed.
  1908. */
  1909. document: TextDocument;
  1910. }
  1911. /**
  1912. * Represents reasons why a text document is saved.
  1913. * @deprecated No longer used, use TextDocumentWillSaveEvent<TextDocument> from vscode-languageserver instead.
  1914. */
  1915. export interface TextDocumentWillSaveEvent {
  1916. /**
  1917. * The document that will be saved
  1918. */
  1919. document: TextDocument;
  1920. /**
  1921. * The reason why save was triggered.
  1922. */
  1923. reason: 1 | 2 | 3;
  1924. }
  1925. export {};