/
DocumentLinkProvider.hx
29 lines (27 loc) · 1.26 KB
/
DocumentLinkProvider.hx
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
27
28
29
package vscode;
/**
* The document link provider defines the contract between extensions and feature of showing
* links in the editor.
*/
typedef DocumentLinkProvider<T:DocumentLink> = {
/**
* Provide links for the given document. Note that the editor ships with a default provider that detects
* `http(s)` and `file` links.
*
* @param document The document in which the command was invoked.
* @param token A cancellation token.
* @return An array of {@link DocumentLink document links} or a thenable that resolves to such. The lack of a result
* can be signaled by returning `undefined`, `null`, or an empty array.
*/
function provideDocumentLinks(document:TextDocument, token:CancellationToken):ProviderResult<Array<T>>;
/**
* Given a link fill in its {@link DocumentLink.target target}. This method is called when an incomplete
* link is selected in the UI. Providers can implement this method and return incomplete links
* (without target) from the {@linkcode DocumentLinkProvider.provideDocumentLinks provideDocumentLinks} method which
* often helps to improve performance.
*
* @param link The link that is to be resolved.
* @param token A cancellation token.
*/
var ?resolveDocumentLink:(link:T, token:CancellationToken) -> ProviderResult<T>;
}