Skip to content

Commit 4536038

Browse files
committed
More jsdoc for extension API
1 parent 6293737 commit 4536038

1 file changed

Lines changed: 80 additions & 6 deletions

File tree

src/vs/vscode.d.ts

Lines changed: 80 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1662,20 +1662,94 @@ declare namespace vscode {
16621662
Reference
16631663
}
16641664

1665+
/**
1666+
* A completion item represents a text snippet that is
1667+
* proposed to complete text that is being typed.
1668+
*/
16651669
export class CompletionItem {
1670+
1671+
/**
1672+
* The label of this completion item. By default
1673+
* also the text that is inserted when selecting
1674+
* this completion.
1675+
*/
16661676
label: string;
1677+
1678+
/**
1679+
* The kind of this completion item. Based of the kind
1680+
* an icon is chosen by the editor.
1681+
*/
16671682
kind: CompletionItemKind;
1668-
detail: string; // <<< non-obvious >>>
1669-
documentation: string; // <<< non-obvious: what is the supported format? >>>
1670-
sortText: string; // <<< non-obvious: is this the 'sort key'? >>>
1671-
filterText: string; // <<< non-obvious: is this the 'filter key'? >>>
1683+
1684+
/**
1685+
* A human-readable string with additional information
1686+
* about this item, like type or symbol information.
1687+
*/
1688+
detail: string;
1689+
1690+
/**
1691+
* A human-readable string that represents a doc-comment.
1692+
*/
1693+
documentation: string;
1694+
1695+
/**
1696+
* A string that shoud be used when comparing this item
1697+
* with other items. When `falsy` the [label](#CompletionItem.label)
1698+
* is used.
1699+
*/
1700+
sortText: string;
1701+
1702+
/**
1703+
* A string that should be used when filtering a set of
1704+
* completion items. When `falsy` the [label](#CompletionItem.label)
1705+
* is used.
1706+
*/
1707+
filterText: string;
1708+
1709+
/**
1710+
* A string that should be inserted a document when selecting
1711+
* this completion. When `falsy` the [label](#CompletionItem.label)
1712+
* is used.
1713+
*/
16721714
insertText: string;
1673-
textEdit: TextEdit; // <<< non-obvious: what is the relation between insertText and textEdit? >>>
1715+
1716+
/**
1717+
* An [edit](#TextEdit) which is applied to a document when selecting
1718+
* this completion. When an edit is provided the value of
1719+
* [insertText](#CompletionItem.insertText) is ignored.
1720+
*/
1721+
textEdit: TextEdit;
1722+
1723+
/**
1724+
* Creates a new completion item.
1725+
*
1726+
* Completion items must have at least a [label](#CompletionItem.label) which then
1727+
* will be used as insert text as well as for sorting and filtering.
1728+
*
1729+
* @param label The label of the completion.
1730+
*/
16741731
constructor(label: string);
16751732
}
16761733

1734+
/**
1735+
* The completion item provider interface defines the contract between extensions and
1736+
* the [IntelliSense](https://code.visualstudio.com/docs/editor/editingevolved#_intellisense).
1737+
*/
16771738
export interface CompletionItemProvider {
1739+
1740+
/**
1741+
*
1742+
* @param document The document in which the command was invoked.
1743+
* @param position The position at which the command was invoked.
1744+
* @param token A cancellation token.
1745+
* @return An array of completions or a thenable that resolves to such. The lack of a result can be
1746+
* signaled by returing `undefined`, `null`, an empty array.
1747+
*/
16781748
provideCompletionItems(document: TextDocument, position: Position, token: CancellationToken): CompletionItem[] | Thenable<CompletionItem[]>;
1749+
1750+
/**
1751+
*
1752+
*/
16791753
resolveCompletionItem?(item: CompletionItem, token: CancellationToken): CompletionItem | Thenable<CompletionItem>;
16801754
}
16811755

@@ -2591,7 +2665,7 @@ declare namespace vscode {
25912665
* Register a completion provider.
25922666
*
25932667
* Multiple providers can be registered for a language. In that case providers are sorted
2594-
* by their [score](#language.match) and groups of equal score are sequentially asked for
2668+
* by their [score](#languages.match) and groups of equal score are sequentially asked for
25952669
* completion items. The process stops when one or many providers of a group return a
25962670
* result.
25972671
*

0 commit comments

Comments
 (0)