@theia/plugin 1.38.0-next.7 → 1.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/plugin",
|
|
3
|
-
"version": "1.38.0
|
|
3
|
+
"version": "1.38.0",
|
|
4
4
|
"description": "Theia - Plugin API",
|
|
5
5
|
"types": "./src/theia.d.ts",
|
|
6
6
|
"publishConfig": {
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"watch": "theiaext watch"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@theia/ext-scripts": "1.
|
|
30
|
+
"@theia/ext-scripts": "1.38.0"
|
|
31
31
|
},
|
|
32
32
|
"nyc": {
|
|
33
33
|
"extends": "../../configs/nyc.json"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "0f2020053fe59b0b9ac4417af0fff80b07e16a09"
|
|
36
36
|
}
|
package/src/theia-proposed.d.ts
CHANGED
|
@@ -613,7 +613,130 @@ export module '@theia/plugin' {
|
|
|
613
613
|
|
|
614
614
|
}
|
|
615
615
|
|
|
616
|
+
// #region DocumentPaste
|
|
617
|
+
|
|
618
|
+
// https://github.com/microsoft/vscode/issues/30066/
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* Provider invoked when the user copies and pastes code.
|
|
622
|
+
*/
|
|
623
|
+
export interface DocumentPasteEditProvider {
|
|
624
|
+
|
|
625
|
+
/**
|
|
626
|
+
* Optional method invoked after the user copies text in a file.
|
|
627
|
+
*
|
|
628
|
+
* During {@link prepareDocumentPaste}, an extension can compute metadata that is attached to
|
|
629
|
+
* a {@link DataTransfer} and is passed back to the provider in {@link provideDocumentPasteEdits}.
|
|
630
|
+
*
|
|
631
|
+
* @param document Document where the copy took place.
|
|
632
|
+
* @param ranges Ranges being copied in the `document`.
|
|
633
|
+
* @param dataTransfer The data transfer associated with the copy. You can store additional values on this for later use in {@link provideDocumentPasteEdits}.
|
|
634
|
+
* @param token A cancellation token.
|
|
635
|
+
*/
|
|
636
|
+
prepareDocumentPaste?(document: TextDocument, ranges: readonly Range[], dataTransfer: DataTransfer, token: CancellationToken): void | Thenable<void>;
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* Invoked before the user pastes into a document.
|
|
640
|
+
*
|
|
641
|
+
* In this method, extensions can return a workspace edit that replaces the standard pasting behavior.
|
|
642
|
+
*
|
|
643
|
+
* @param document Document being pasted into
|
|
644
|
+
* @param ranges Currently selected ranges in the document.
|
|
645
|
+
* @param dataTransfer The data transfer associated with the paste.
|
|
646
|
+
* @param token A cancellation token.
|
|
647
|
+
*
|
|
648
|
+
* @return Optional workspace edit that applies the paste. Return undefined to use standard pasting.
|
|
649
|
+
*/
|
|
650
|
+
provideDocumentPasteEdits(document: TextDocument, ranges: readonly Range[], dataTransfer: DataTransfer, token: CancellationToken): ProviderResult<DocumentPasteEdit>;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
|
+
* An operation applied on paste
|
|
655
|
+
*/
|
|
656
|
+
class DocumentPasteEdit {
|
|
657
|
+
/**
|
|
658
|
+
* The text or snippet to insert at the pasted locations.
|
|
659
|
+
*/
|
|
660
|
+
insertText: string | SnippetString;
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* An optional additional edit to apply on paste.
|
|
664
|
+
*/
|
|
665
|
+
additionalEdit?: WorkspaceEdit;
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* @param insertText The text or snippet to insert at the pasted locations.
|
|
669
|
+
*/
|
|
670
|
+
constructor(insertText: string | SnippetString);
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
interface DocumentPasteProviderMetadata {
|
|
674
|
+
/**
|
|
675
|
+
* Mime types that `provideDocumentPasteEdits` should be invoked for.
|
|
676
|
+
*
|
|
677
|
+
* Use the special `files` mimetype to indicate the provider should be invoked if any files are present in the `DataTransfer`.
|
|
678
|
+
*/
|
|
679
|
+
readonly pasteMimeTypes: readonly string[];
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
namespace languages {
|
|
683
|
+
export function registerDocumentPasteEditProvider(selector: DocumentSelector, provider: DocumentPasteEditProvider, metadata: DocumentPasteProviderMetadata): Disposable;
|
|
684
|
+
}
|
|
616
685
|
// #endregion
|
|
686
|
+
|
|
687
|
+
// #region ProfileContentHandler
|
|
688
|
+
|
|
689
|
+
export interface ProfileContentHandler {
|
|
690
|
+
readonly name: string;
|
|
691
|
+
saveProfile(name: string, content: string, token: CancellationToken): Thenable<Uri | null>;
|
|
692
|
+
readProfile(uri: Uri, token: CancellationToken): Thenable<string | null>;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
export namespace window {
|
|
696
|
+
export function registerProfileContentHandler(id: string, profileContentHandler: ProfileContentHandler): Disposable;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
// #endregion ProfileContentHandler
|
|
700
|
+
|
|
701
|
+
// #region TerminalQuickFixProvider
|
|
702
|
+
|
|
703
|
+
export namespace window {
|
|
704
|
+
/**
|
|
705
|
+
* @param provider A terminal quick fix provider
|
|
706
|
+
* @return A {@link Disposable} that un-registers the provider when being disposed
|
|
707
|
+
*/
|
|
708
|
+
export function registerTerminalQuickFixProvider(id: string, provider: TerminalQuickFixProvider): Disposable;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
export interface TerminalQuickFixProvider {
|
|
712
|
+
/**
|
|
713
|
+
* Provides terminal quick fixes
|
|
714
|
+
* @param commandMatchResult The command match result for which to provide quick fixes
|
|
715
|
+
* @param token A cancellation token indicating the result is no longer needed
|
|
716
|
+
* @return Terminal quick fix(es) if any
|
|
717
|
+
*/
|
|
718
|
+
provideTerminalQuickFixes(commandMatchResult: TerminalCommandMatchResult, token: CancellationToken): TerminalQuickFix[] | TerminalQuickFix | undefined;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
export interface TerminalCommandMatchResult {
|
|
722
|
+
commandLine: string;
|
|
723
|
+
commandLineMatch: RegExpMatchArray;
|
|
724
|
+
outputMatch?: {
|
|
725
|
+
regexMatch: RegExpMatchArray;
|
|
726
|
+
outputLines?: string[];
|
|
727
|
+
};
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
interface TerminalQuickFix {
|
|
731
|
+
type: TerminalQuickFixType;
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
enum TerminalQuickFixType {
|
|
735
|
+
command = 'command',
|
|
736
|
+
opener = 'opener'
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
// #endRegion TerminalQuickFixProvider
|
|
617
740
|
}
|
|
618
741
|
|
|
619
742
|
/**
|
package/src/theia.d.ts
CHANGED
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
*--------------------------------------------------------------------------------------------*/
|
|
23
23
|
import './theia-extra';
|
|
24
24
|
import './theia-proposed';
|
|
25
|
+
import './theia.proposed.externalUriOpener';
|
|
26
|
+
import './vscode.proposed.editSessionIdentityProvider';
|
|
25
27
|
|
|
26
28
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
27
29
|
/* eslint-disable max-len */
|
|
@@ -7565,6 +7567,15 @@ export module '@theia/plugin' {
|
|
|
7565
7567
|
*/
|
|
7566
7568
|
export const onDidChangeTelemetryEnabled: Event<boolean>;
|
|
7567
7569
|
|
|
7570
|
+
/**
|
|
7571
|
+
* Creates a new {@link TelemetryLogger telemetry logger}.
|
|
7572
|
+
*
|
|
7573
|
+
* @param sender The telemetry sender that is used by the telemetry logger.
|
|
7574
|
+
* @param options Options for the telemetry logger.
|
|
7575
|
+
* @returns A new telemetry logger
|
|
7576
|
+
*/
|
|
7577
|
+
export function createTelemetryLogger(sender: TelemetrySender, options?: TelemetryLoggerOptions): TelemetryLogger;
|
|
7578
|
+
|
|
7568
7579
|
/**
|
|
7569
7580
|
* The name of a remote. Defined by extensions, popular samples are `wsl` for the Windows
|
|
7570
7581
|
* Subsystem for Linux or `ssh-remote` for remotes using a secure shell.
|
|
@@ -14209,6 +14220,144 @@ export module '@theia/plugin' {
|
|
|
14209
14220
|
close(tabGroup: TabGroup | readonly TabGroup[], preserveFocus?: boolean): Thenable<boolean>;
|
|
14210
14221
|
}
|
|
14211
14222
|
|
|
14223
|
+
/**
|
|
14224
|
+
* A special value wrapper denoting a value that is safe to not clean.
|
|
14225
|
+
* This is to be used when you can guarantee no identifiable information is contained in the value and the cleaning is improperly redacting it.
|
|
14226
|
+
*/
|
|
14227
|
+
export class TelemetryTrustedValue<T = any> {
|
|
14228
|
+
readonly value: T;
|
|
14229
|
+
|
|
14230
|
+
constructor(value: T);
|
|
14231
|
+
}
|
|
14232
|
+
|
|
14233
|
+
/**
|
|
14234
|
+
* A telemetry logger which can be used by extensions to log usage and error telemetry.
|
|
14235
|
+
*
|
|
14236
|
+
* A logger wraps around a {@link TelemetrySender sender} but it guarantees that
|
|
14237
|
+
* - user settings to disable or tweak telemetry are respected, and that
|
|
14238
|
+
* - potential sensitive data is removed
|
|
14239
|
+
*
|
|
14240
|
+
* It also enables an "echo UI" that prints whatever data is send and it allows the editor
|
|
14241
|
+
* to forward unhandled errors to the respective extensions.
|
|
14242
|
+
*
|
|
14243
|
+
* To get an instance of a `TelemetryLogger`, use
|
|
14244
|
+
* {@link env.createTelemetryLogger `createTelemetryLogger`}.
|
|
14245
|
+
*/
|
|
14246
|
+
export interface TelemetryLogger {
|
|
14247
|
+
|
|
14248
|
+
/**
|
|
14249
|
+
* An {@link Event} which fires when the enablement state of usage or error telemetry changes.
|
|
14250
|
+
*/
|
|
14251
|
+
readonly onDidChangeEnableStates: Event<TelemetryLogger>;
|
|
14252
|
+
|
|
14253
|
+
/**
|
|
14254
|
+
* Whether or not usage telemetry is enabled for this logger.
|
|
14255
|
+
*/
|
|
14256
|
+
readonly isUsageEnabled: boolean;
|
|
14257
|
+
|
|
14258
|
+
/**
|
|
14259
|
+
* Whether or not error telemetry is enabled for this logger.
|
|
14260
|
+
*/
|
|
14261
|
+
readonly isErrorsEnabled: boolean;
|
|
14262
|
+
|
|
14263
|
+
/**
|
|
14264
|
+
* Log a usage event.
|
|
14265
|
+
*
|
|
14266
|
+
* After completing cleaning, telemetry setting checks, and data mix-in calls `TelemetrySender.sendEventData` to log the event.
|
|
14267
|
+
* Automatically supports echoing to extension telemetry output channel.
|
|
14268
|
+
* @param eventName The event name to log
|
|
14269
|
+
* @param data The data to log
|
|
14270
|
+
*/
|
|
14271
|
+
logUsage(eventName: string, data?: Record<string, any | TelemetryTrustedValue>): void;
|
|
14272
|
+
|
|
14273
|
+
/**
|
|
14274
|
+
* Log an error event.
|
|
14275
|
+
*
|
|
14276
|
+
* After completing cleaning, telemetry setting checks, and data mix-in calls `TelemetrySender.sendEventData` to log the event. Differs from `logUsage` in that it will log the event if the telemetry setting is Error+.
|
|
14277
|
+
* Automatically supports echoing to extension telemetry output channel.
|
|
14278
|
+
* @param eventName The event name to log
|
|
14279
|
+
* @param data The data to log
|
|
14280
|
+
*/
|
|
14281
|
+
logError(eventName: string, data?: Record<string, any | TelemetryTrustedValue>): void;
|
|
14282
|
+
|
|
14283
|
+
/**
|
|
14284
|
+
* Log an error event.
|
|
14285
|
+
*
|
|
14286
|
+
* Calls `TelemetrySender.sendErrorData`. Does cleaning, telemetry checks, and data mix-in.
|
|
14287
|
+
* Automatically supports echoing to extension telemetry output channel.
|
|
14288
|
+
* Will also automatically log any exceptions thrown within the extension host process.
|
|
14289
|
+
* @param error The error object which contains the stack trace cleaned of PII
|
|
14290
|
+
* @param data Additional data to log alongside the stack trace
|
|
14291
|
+
*/
|
|
14292
|
+
logError(error: Error, data?: Record<string, any | TelemetryTrustedValue>): void;
|
|
14293
|
+
|
|
14294
|
+
/**
|
|
14295
|
+
* Dispose this object and free resources.
|
|
14296
|
+
*/
|
|
14297
|
+
dispose(): void;
|
|
14298
|
+
}
|
|
14299
|
+
|
|
14300
|
+
/**
|
|
14301
|
+
* The telemetry sender is the contract between a telemetry logger and some telemetry service. **Note** that extensions must NOT
|
|
14302
|
+
* call the methods of their sender directly as the logger provides extra guards and cleaning.
|
|
14303
|
+
*
|
|
14304
|
+
* ```js
|
|
14305
|
+
* const sender: vscode.TelemetrySender = {...};
|
|
14306
|
+
* const logger = vscode.env.createTelemetryLogger(sender);
|
|
14307
|
+
*
|
|
14308
|
+
* // GOOD - uses the logger
|
|
14309
|
+
* logger.logUsage('myEvent', { myData: 'myValue' });
|
|
14310
|
+
*
|
|
14311
|
+
* // BAD - uses the sender directly: no data cleansing, ignores user settings, no echoing to the telemetry output channel etc
|
|
14312
|
+
* sender.logEvent('myEvent', { myData: 'myValue' });
|
|
14313
|
+
* ```
|
|
14314
|
+
*/
|
|
14315
|
+
export interface TelemetrySender {
|
|
14316
|
+
/**
|
|
14317
|
+
* Function to send event data without a stacktrace. Used within a {@link TelemetryLogger}
|
|
14318
|
+
*
|
|
14319
|
+
* @param eventName The name of the event which you are logging
|
|
14320
|
+
* @param data A serializable key value pair that is being logged
|
|
14321
|
+
*/
|
|
14322
|
+
sendEventData(eventName: string, data?: Record<string, any>): void;
|
|
14323
|
+
|
|
14324
|
+
/**
|
|
14325
|
+
* Function to send an error. Used within a {@link TelemetryLogger}
|
|
14326
|
+
*
|
|
14327
|
+
* @param error The error being logged
|
|
14328
|
+
* @param data Any additional data to be collected with the exception
|
|
14329
|
+
*/
|
|
14330
|
+
sendErrorData(error: Error, data?: Record<string, any>): void;
|
|
14331
|
+
|
|
14332
|
+
/**
|
|
14333
|
+
* Optional flush function which will give this sender a chance to send any remaining events
|
|
14334
|
+
* as its {@link TelemetryLogger} is being disposed
|
|
14335
|
+
*/
|
|
14336
|
+
flush?(): void | Thenable<void>;
|
|
14337
|
+
}
|
|
14338
|
+
|
|
14339
|
+
/**
|
|
14340
|
+
* Options for creating a {@link TelemetryLogger}
|
|
14341
|
+
*/
|
|
14342
|
+
export interface TelemetryLoggerOptions {
|
|
14343
|
+
/**
|
|
14344
|
+
* Whether or not you want to avoid having the built-in common properties such as os, extension name, etc injected into the data object.
|
|
14345
|
+
* Defaults to `false` if not defined.
|
|
14346
|
+
*/
|
|
14347
|
+
readonly ignoreBuiltInCommonProperties?: boolean;
|
|
14348
|
+
|
|
14349
|
+
/**
|
|
14350
|
+
* Whether or not unhandled errors on the extension host caused by your extension should be logged to your sender.
|
|
14351
|
+
* Defaults to `false` if not defined.
|
|
14352
|
+
*/
|
|
14353
|
+
readonly ignoreUnhandledErrors?: boolean;
|
|
14354
|
+
|
|
14355
|
+
/**
|
|
14356
|
+
* Any additional common properties which should be injected into the data object.
|
|
14357
|
+
*/
|
|
14358
|
+
readonly additionalCommonProperties?: Record<string, any>;
|
|
14359
|
+
}
|
|
14360
|
+
|
|
14212
14361
|
/**
|
|
14213
14362
|
* Represents a notebook editor that is attached to a {@link NotebookDocument notebook}.
|
|
14214
14363
|
*/
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2023 Ericsson and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
/*---------------------------------------------------------------------------------------------
|
|
18
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
19
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
20
|
+
*--------------------------------------------------------------------------------------------*/
|
|
21
|
+
// code copied and modified from https://vscode.dev/github/microsoft/vscode/blob/1.77.3/src/vscode-dts/vscode.proposed.externalUriOpener.d.ts
|
|
22
|
+
|
|
23
|
+
export module '@theia/plugin' {
|
|
24
|
+
/**
|
|
25
|
+
* Details if an `ExternalUriOpener` can open a uri.
|
|
26
|
+
*
|
|
27
|
+
* The priority is also used to rank multiple openers against each other and determine
|
|
28
|
+
* if an opener should be selected automatically or if the user should be prompted to
|
|
29
|
+
* select an opener.
|
|
30
|
+
*
|
|
31
|
+
* The editor will try to use the best available opener, as sorted by `ExternalUriOpenerPriority`.
|
|
32
|
+
* If there are multiple potential "best" openers for a URI, then the user will be prompted
|
|
33
|
+
* to select an opener.
|
|
34
|
+
*/
|
|
35
|
+
export enum ExternalUriOpenerPriority {
|
|
36
|
+
/**
|
|
37
|
+
* The opener is disabled and will never be shown to users.
|
|
38
|
+
*
|
|
39
|
+
* Note that the opener can still be used if the user specifically
|
|
40
|
+
* configures it in their settings.
|
|
41
|
+
*/
|
|
42
|
+
None = 0,
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The opener can open the uri but will not cause a prompt on its own
|
|
46
|
+
* since the editor always contributes a built-in `Default` opener.
|
|
47
|
+
*/
|
|
48
|
+
Option = 1,
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The opener can open the uri.
|
|
52
|
+
*
|
|
53
|
+
* The editor's built-in opener has `Default` priority. This means that any additional `Default`
|
|
54
|
+
* openers will cause the user to be prompted to select from a list of all potential openers.
|
|
55
|
+
*/
|
|
56
|
+
Default = 2,
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The opener can open the uri and should be automatically selected over any
|
|
60
|
+
* default openers, include the built-in one from the editor.
|
|
61
|
+
*
|
|
62
|
+
* A preferred opener will be automatically selected if no other preferred openers
|
|
63
|
+
* are available. If multiple preferred openers are available, then the user
|
|
64
|
+
* is shown a prompt with all potential openers (not just preferred openers).
|
|
65
|
+
*/
|
|
66
|
+
Preferred = 3,
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Handles opening uris to external resources, such as http(s) links.
|
|
71
|
+
*
|
|
72
|
+
* Extensions can implement an `ExternalUriOpener` to open `http` links to a webserver
|
|
73
|
+
* inside of the editor instead of having the link be opened by the web browser.
|
|
74
|
+
*
|
|
75
|
+
* Currently openers may only be registered for `http` and `https` uris.
|
|
76
|
+
*/
|
|
77
|
+
export interface ExternalUriOpener {
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Check if the opener can open a uri.
|
|
81
|
+
*
|
|
82
|
+
* @param uri The uri being opened. This is the uri that the user clicked on. It has
|
|
83
|
+
* not yet gone through port forwarding.
|
|
84
|
+
* @param token Cancellation token indicating that the result is no longer needed.
|
|
85
|
+
*
|
|
86
|
+
* @return Priority indicating if the opener can open the external uri.
|
|
87
|
+
*/
|
|
88
|
+
canOpenExternalUri(uri: Uri, token: CancellationToken): ExternalUriOpenerPriority | Thenable<ExternalUriOpenerPriority>;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Open a uri.
|
|
92
|
+
*
|
|
93
|
+
* This is invoked when:
|
|
94
|
+
*
|
|
95
|
+
* - The user clicks a link which does not have an assigned opener. In this case, first `canOpenExternalUri`
|
|
96
|
+
* is called and if the user selects this opener, then `openExternalUri` is called.
|
|
97
|
+
* - The user sets the default opener for a link in their settings and then visits a link.
|
|
98
|
+
*
|
|
99
|
+
* @param resolvedUri The uri to open. This uri may have been transformed by port forwarding, so it
|
|
100
|
+
* may not match the original uri passed to `canOpenExternalUri`. Use `ctx.originalUri` to check the
|
|
101
|
+
* original uri.
|
|
102
|
+
* @param ctx Additional information about the uri being opened.
|
|
103
|
+
* @param token Cancellation token indicating that opening has been canceled.
|
|
104
|
+
*
|
|
105
|
+
* @return Thenable indicating that the opening has completed.
|
|
106
|
+
*/
|
|
107
|
+
openExternalUri(resolvedUri: Uri, ctx: OpenExternalUriContext, token: CancellationToken): Thenable<void> | void;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Additional information about the uri being opened.
|
|
112
|
+
*/
|
|
113
|
+
export interface OpenExternalUriContext {
|
|
114
|
+
/**
|
|
115
|
+
* The uri that triggered the open.
|
|
116
|
+
*
|
|
117
|
+
* This is the original uri that the user clicked on or that was passed to `openExternal.`
|
|
118
|
+
* Due to port forwarding, this may not match the `resolvedUri` passed to `openExternalUri`.
|
|
119
|
+
*/
|
|
120
|
+
readonly sourceUri: Uri;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Additional metadata about a registered `ExternalUriOpener`.
|
|
125
|
+
*/
|
|
126
|
+
interface ExternalUriOpenerMetadata {
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* List of uri schemes the opener is triggered for.
|
|
130
|
+
*
|
|
131
|
+
* Currently only `http` and `https` are supported.
|
|
132
|
+
*/
|
|
133
|
+
readonly schemes: readonly string[];
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Text displayed to the user that explains what the opener does.
|
|
137
|
+
*
|
|
138
|
+
* For example, 'Open in browser preview'
|
|
139
|
+
*/
|
|
140
|
+
readonly label: string;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export namespace window {
|
|
144
|
+
/**
|
|
145
|
+
* Register a new `ExternalUriOpener`.
|
|
146
|
+
*
|
|
147
|
+
* When a uri is about to be opened, an `onOpenExternalUri:SCHEME` activation event is fired.
|
|
148
|
+
*
|
|
149
|
+
* @param id Unique id of the opener, such as `myExtension.browserPreview`. This is used in settings
|
|
150
|
+
* and commands to identify the opener.
|
|
151
|
+
* @param opener Opener to register.
|
|
152
|
+
* @param metadata Additional information about the opener.
|
|
153
|
+
*
|
|
154
|
+
* @returns Disposable that unregisters the opener.
|
|
155
|
+
*/
|
|
156
|
+
export function registerExternalUriOpener(id: string, opener: ExternalUriOpener, metadata: ExternalUriOpenerMetadata): Disposable;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2023 Ericsson and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
// Copied from: https://github.com/microsoft/vscode/blob/1.77.0/src/vscode-dts/vscode.proposed.editSessionIdentityProvider.d.ts
|
|
18
|
+
// and slightly adapted to work in Theia
|
|
19
|
+
|
|
20
|
+
/*---------------------------------------------------------------------------------------------
|
|
21
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
22
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
23
|
+
*--------------------------------------------------------------------------------------------*/
|
|
24
|
+
|
|
25
|
+
export module '@theia/plugin' {
|
|
26
|
+
|
|
27
|
+
// https://github.com/microsoft/vscode/issues/157734
|
|
28
|
+
|
|
29
|
+
export namespace workspace {
|
|
30
|
+
/**
|
|
31
|
+
* An event that is emitted when an edit session identity is about to be requested.
|
|
32
|
+
*/
|
|
33
|
+
export const onWillCreateEditSessionIdentity: Event<EditSessionIdentityWillCreateEvent>;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* @param scheme The URI scheme that this provider can provide edit session identities for.
|
|
38
|
+
* @param provider A provider which can convert URIs for workspace folders of scheme @param scheme to
|
|
39
|
+
* an edit session identifier which is stable across machines. This enables edit sessions to be resolved.
|
|
40
|
+
*/
|
|
41
|
+
export function registerEditSessionIdentityProvider(scheme: string, provider: EditSessionIdentityProvider): Disposable;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface EditSessionIdentityProvider {
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
* @param workspaceFolder The workspace folder to provide an edit session identity for.
|
|
48
|
+
* @param token A cancellation token for the request.
|
|
49
|
+
* @returns A string representing the edit session identity for the requested workspace folder.
|
|
50
|
+
*/
|
|
51
|
+
provideEditSessionIdentity(workspaceFolder: WorkspaceFolder, token: CancellationToken): ProviderResult<string>;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
*
|
|
55
|
+
* @param identity1 An edit session identity.
|
|
56
|
+
* @param identity2 A second edit session identity to compare to @param identity1.
|
|
57
|
+
* @param token A cancellation token for the request.
|
|
58
|
+
* @returns An {@link EditSessionIdentityMatch} representing the edit session identity match confidence for the provided identities.
|
|
59
|
+
*/
|
|
60
|
+
provideEditSessionIdentityMatch(identity1: string, identity2: string, token: CancellationToken): ProviderResult<EditSessionIdentityMatch>;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export enum EditSessionIdentityMatch {
|
|
64
|
+
Complete = 100,
|
|
65
|
+
Partial = 50,
|
|
66
|
+
None = 0
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface EditSessionIdentityWillCreateEvent {
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* A cancellation token.
|
|
73
|
+
*/
|
|
74
|
+
readonly token: CancellationToken;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The workspace folder to create an edit session identity for.
|
|
78
|
+
*/
|
|
79
|
+
readonly workspaceFolder: WorkspaceFolder;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Allows to pause the event until the provided thenable resolves.
|
|
83
|
+
*
|
|
84
|
+
* *Note:* This function can only be called during event dispatch.
|
|
85
|
+
*
|
|
86
|
+
* @param thenable A thenable that delays saving.
|
|
87
|
+
*/
|
|
88
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
89
|
+
waitUntil(thenable: Thenable<any>): void;
|
|
90
|
+
}
|
|
91
|
+
}
|