UNPKG

2.2 kBTypeScriptView Raw
1import { HandlerResult, RequestHandler } from 'vscode-jsonrpc';
2import { Range, URI } from 'vscode-languageserver-types';
3import { MessageDirection, ProtocolRequestType } from './messages';
4/**
5 * Client capabilities for the showDocument request.
6 *
7 * @since 3.16.0
8 */
9export interface ShowDocumentClientCapabilities {
10 /**
11 * The client has support for the showDocument
12 * request.
13 */
14 support: boolean;
15}
16/**
17 * Params to show a resource in the UI.
18 *
19 * @since 3.16.0
20 */
21export interface ShowDocumentParams {
22 /**
23 * The uri to show.
24 */
25 uri: URI;
26 /**
27 * Indicates to show the resource in an external program.
28 * To show, for example, `https://code.visualstudio.com/`
29 * in the default WEB browser set `external` to `true`.
30 */
31 external?: boolean;
32 /**
33 * An optional property to indicate whether the editor
34 * showing the document should take focus or not.
35 * Clients might ignore this property if an external
36 * program is started.
37 */
38 takeFocus?: boolean;
39 /**
40 * An optional selection range if the document is a text
41 * document. Clients might ignore the property if an
42 * external program is started or the file is not a text
43 * file.
44 */
45 selection?: Range;
46}
47/**
48 * The result of a showDocument request.
49 *
50 * @since 3.16.0
51 */
52export interface ShowDocumentResult {
53 /**
54 * A boolean indicating if the show was successful.
55 */
56 success: boolean;
57}
58/**
59 * A request to show a document. This request might open an
60 * external program depending on the value of the URI to open.
61 * For example a request to open `https://code.visualstudio.com/`
62 * will very likely open the URI in a WEB browser.
63 *
64 * @since 3.16.0
65*/
66export declare namespace ShowDocumentRequest {
67 const method: 'window/showDocument';
68 const messageDirection: MessageDirection;
69 const type: ProtocolRequestType<ShowDocumentParams, ShowDocumentResult, void, void, void>;
70 type HandlerSignature = RequestHandler<ShowDocumentParams, ShowDocumentResult, void>;
71 type MiddlewareSignature = (params: ShowDocumentParams, next: HandlerSignature) => HandlerResult<ShowDocumentResult, void>;
72}