UNPKG

1.52 kBTypeScriptView Raw
1import { Disposable } from '../common/disposable';
2import { MaybePromise } from '../common/types';
3import { URI } from '../common/uri';
4import { QuickInputService } from './quick-input';
5export interface OpenWithHandler {
6 /**
7 * A unique id of this handler.
8 */
9 readonly id: string;
10 /**
11 * A human-readable name of this handler.
12 */
13 readonly label?: string;
14 /**
15 * A human-readable provider name of this handler.
16 */
17 readonly providerName?: string;
18 /**
19 * A css icon class of this handler.
20 */
21 readonly iconClass?: string;
22 /**
23 * Test whether this handler can open the given URI for given options.
24 * Return a nonzero number if this handler can open; otherwise it cannot.
25 * Never reject.
26 *
27 * A returned value indicating a priority of this handler.
28 */
29 canHandle(uri: URI): number;
30 /**
31 * Open a widget for the given URI and options.
32 * Resolve to an opened widget or undefined, e.g. if a page is opened.
33 * Never reject if `canHandle` return a positive number; otherwise should reject.
34 */
35 open(uri: URI): MaybePromise<object | undefined>;
36}
37export declare class OpenWithService {
38 protected readonly quickInputService: QuickInputService;
39 protected readonly handlers: OpenWithHandler[];
40 registerHandler(handler: OpenWithHandler): Disposable;
41 openWith(uri: URI): Promise<object | undefined>;
42 getHandlers(uri: URI): OpenWithHandler[];
43}
44//# sourceMappingURL=open-with-service.d.ts.map
\No newline at end of file