@codingame/monaco-vscode-share-service-override 11.1.2 → 12.0.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/index.d.ts +2 -1
- package/index.js +14 -1
- package/package.json +14 -7
- package/vscode/src/vs/workbench/contrib/share/browser/share.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/share/browser/share.contribution.js +29 -26
- package/vscode/src/vs/workbench/contrib/share/browser/share.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/share/browser/shareService.d.ts +27 -0
- package/vscode/src/vs/workbench/contrib/share/browser/shareService.js +14 -13
- package/share.js +0 -12
package/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { type IEditorOverrideServices } from "vscode/vscode/vs/editor/standalone/browser/standaloneServices";
|
|
2
|
+
export default function getServiceOverride(): IEditorOverrideServices;
|
package/index.js
CHANGED
|
@@ -1 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import 'vscode/vscode/vs/editor/standalone/browser/standaloneServices';
|
|
3
|
+
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
4
|
+
import { ShareService } from './vscode/src/vs/workbench/contrib/share/browser/shareService.js';
|
|
5
|
+
import { IShareService } from 'vscode/vscode/vs/workbench/contrib/share/common/share.service';
|
|
6
|
+
import './vscode/src/vs/workbench/contrib/share/browser/share.contribution.js';
|
|
7
|
+
|
|
8
|
+
function getServiceOverride() {
|
|
9
|
+
return {
|
|
10
|
+
[IShareService.toString()]: new SyncDescriptor(ShareService, [], true)
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { getServiceOverride as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-share-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "VSCode public API plugged on the monaco editor - share service-override",
|
|
4
6
|
"keywords": [],
|
|
5
7
|
"author": {
|
|
6
8
|
"name": "CodinGame",
|
|
@@ -12,8 +14,11 @@
|
|
|
12
14
|
"url": "git+ssh://git@github.com/CodinGame/monaco-vscode-api.git"
|
|
13
15
|
},
|
|
14
16
|
"type": "module",
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"vscode": "npm:@codingame/monaco-vscode-api@12.0.0"
|
|
19
|
+
},
|
|
20
|
+
"peerDependencies": {},
|
|
21
|
+
"peerDependenciesMeta": {},
|
|
17
22
|
"main": "index.js",
|
|
18
23
|
"module": "index.js",
|
|
19
24
|
"types": "index.d.ts",
|
|
@@ -22,10 +27,12 @@
|
|
|
22
27
|
"default": "./index.js"
|
|
23
28
|
},
|
|
24
29
|
"./vscode/*": {
|
|
25
|
-
"default": "./vscode/src/*.js"
|
|
30
|
+
"default": "./vscode/src/*.js",
|
|
31
|
+
"types": "./vscode/src/*.d.ts"
|
|
32
|
+
},
|
|
33
|
+
"./*": {
|
|
34
|
+
"default": "./*.js",
|
|
35
|
+
"types": "./*.d.ts"
|
|
26
36
|
}
|
|
27
|
-
},
|
|
28
|
-
"dependencies": {
|
|
29
|
-
"vscode": "npm:@codingame/monaco-vscode-api@11.1.2"
|
|
30
37
|
}
|
|
31
38
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
|
|
2
3
|
import './share.css.js';
|
|
3
4
|
import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
|
|
4
5
|
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
5
6
|
import { MarkdownString } from 'vscode/vscode/vs/base/common/htmlContent';
|
|
7
|
+
import { KeyMod, KeyCode } from 'vscode/vscode/vs/base/common/keyCodes';
|
|
6
8
|
import { localize2, localize } from 'vscode/vscode/vs/nls';
|
|
7
9
|
import { MenuId, registerAction2, Action2, MenuRegistry } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
8
10
|
import { IClipboardService } from 'vscode/vscode/vs/platform/clipboard/common/clipboardService.service';
|
|
@@ -10,6 +12,8 @@ import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/c
|
|
|
10
12
|
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
11
13
|
import { EditorResourceAccessor, SideBySideEditor } from 'vscode/vscode/vs/workbench/common/editor';
|
|
12
14
|
import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
15
|
+
import 'vscode/vscode/vs/platform/instantiation/common/extensions';
|
|
16
|
+
import { KeybindingWeight } from 'vscode/vscode/vs/platform/keybinding/common/keybindingsRegistry';
|
|
13
17
|
import 'vscode/vscode/vs/platform/notification/common/notification';
|
|
14
18
|
import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener.service';
|
|
15
19
|
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
@@ -18,13 +22,15 @@ import { WorkspaceFolderCountContext } from 'vscode/vscode/vs/workbench/common/c
|
|
|
18
22
|
import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
19
23
|
import { ShareProviderCountContext } from './shareService.js';
|
|
20
24
|
import { IShareService } from 'vscode/vscode/vs/workbench/contrib/share/common/share.service';
|
|
25
|
+
import { LifecyclePhase } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
|
|
21
26
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
27
|
+
import { ProgressLocation } from 'vscode/vscode/vs/platform/progress/common/progress';
|
|
22
28
|
import { IProgressService } from 'vscode/vscode/vs/platform/progress/common/progress.service';
|
|
23
29
|
import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
|
|
24
30
|
import { Extensions as Extensions$1 } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
|
|
25
31
|
import { workbenchConfigurationNodeBase } from 'vscode/vscode/vs/workbench/common/configuration';
|
|
26
32
|
import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
27
|
-
import Severity
|
|
33
|
+
import Severity from 'vscode/vscode/vs/base/common/severity';
|
|
28
34
|
|
|
29
35
|
var ShareWorkbenchContribution_1;
|
|
30
36
|
const targetMenus = [
|
|
@@ -59,24 +65,21 @@ let ShareWorkbenchContribution = class ShareWorkbenchContribution {
|
|
|
59
65
|
}
|
|
60
66
|
registerActions() {
|
|
61
67
|
if (!this._disposables) {
|
|
62
|
-
this._disposables = (
|
|
68
|
+
this._disposables = ( new DisposableStore());
|
|
63
69
|
}
|
|
64
70
|
this._disposables.add(registerAction2(class ShareAction extends Action2 {
|
|
65
71
|
static { this.ID = 'workbench.action.share'; }
|
|
66
|
-
static { this.LABEL = ( localize2(
|
|
72
|
+
static { this.LABEL = ( localize2(8847, 'Share...')); }
|
|
67
73
|
constructor() {
|
|
68
74
|
super({
|
|
69
75
|
id: ShareAction.ID,
|
|
70
76
|
title: ShareAction.LABEL,
|
|
71
77
|
f1: true,
|
|
72
78
|
icon: Codicon.linkExternal,
|
|
73
|
-
precondition: (
|
|
74
|
-
(ShareProviderCountContext.notEqualsTo(0)),
|
|
75
|
-
(WorkspaceFolderCountContext.notEqualsTo(0))
|
|
76
|
-
))),
|
|
79
|
+
precondition: ( ContextKeyExpr.and(( ShareProviderCountContext.notEqualsTo(0)), ( WorkspaceFolderCountContext.notEqualsTo(0)))),
|
|
77
80
|
keybinding: {
|
|
78
|
-
weight:
|
|
79
|
-
primary:
|
|
81
|
+
weight: KeybindingWeight.WorkbenchContrib,
|
|
82
|
+
primary: KeyMod.Alt | KeyMod.CtrlCmd | KeyCode.KeyS,
|
|
80
83
|
},
|
|
81
84
|
menu: [
|
|
82
85
|
{ id: MenuId.CommandCenter, order: 1000 }
|
|
@@ -94,25 +97,25 @@ let ShareWorkbenchContribution = class ShareWorkbenchContribution {
|
|
|
94
97
|
const progressService = accessor.get(IProgressService);
|
|
95
98
|
const selection = accessor.get(ICodeEditorService).getActiveCodeEditor()?.getSelection() ?? undefined;
|
|
96
99
|
const result = await progressService.withProgress({
|
|
97
|
-
location:
|
|
98
|
-
detail: ( localize(
|
|
100
|
+
location: ProgressLocation.Window,
|
|
101
|
+
detail: ( localize(8848, 'Generating link...'))
|
|
99
102
|
}, async () => shareService.provideShare({ resourceUri, selection }, CancellationToken.None));
|
|
100
103
|
if (result) {
|
|
101
|
-
const uriText = (
|
|
104
|
+
const uriText = ( result.toString());
|
|
102
105
|
const isResultText = typeof result === 'string';
|
|
103
106
|
await clipboardService.writeText(uriText);
|
|
104
107
|
dialogService.prompt({
|
|
105
|
-
type: Severity
|
|
106
|
-
message: isResultText ? ( localize(
|
|
108
|
+
type: Severity.Info,
|
|
109
|
+
message: isResultText ? ( localize(8849, 'Copied text to clipboard!')) : ( localize(8850, 'Copied link to clipboard!')),
|
|
107
110
|
custom: {
|
|
108
111
|
icon: Codicon.check,
|
|
109
112
|
markdownDetails: [{
|
|
110
|
-
markdown: (
|
|
113
|
+
markdown: ( new MarkdownString(`<div aria-label='${uriText}'>${uriText}</div>`, { supportHtml: true })),
|
|
111
114
|
classes: [isResultText ? 'share-dialog-input-text' : 'share-dialog-input-link']
|
|
112
115
|
}]
|
|
113
116
|
},
|
|
114
|
-
cancelButton: ( localize(
|
|
115
|
-
buttons: isResultText ? [] : [{ label: ( localize(
|
|
117
|
+
cancelButton: ( localize(8851, 'Close')),
|
|
118
|
+
buttons: isResultText ? [] : [{ label: ( localize(8852, 'Open Link')), run: () => { urlService.open(result, { openExternal: true }); } }]
|
|
116
119
|
});
|
|
117
120
|
}
|
|
118
121
|
}
|
|
@@ -125,13 +128,13 @@ let ShareWorkbenchContribution = class ShareWorkbenchContribution {
|
|
|
125
128
|
}
|
|
126
129
|
}
|
|
127
130
|
};
|
|
128
|
-
ShareWorkbenchContribution = ShareWorkbenchContribution_1 = (
|
|
129
|
-
(
|
|
130
|
-
(
|
|
131
|
-
], ShareWorkbenchContribution))
|
|
132
|
-
const workbenchContributionsRegistry = (
|
|
133
|
-
workbenchContributionsRegistry.registerWorkbenchContribution(ShareWorkbenchContribution,
|
|
134
|
-
(
|
|
131
|
+
ShareWorkbenchContribution = ShareWorkbenchContribution_1 = ( __decorate([
|
|
132
|
+
( __param(0, IShareService)),
|
|
133
|
+
( __param(1, IConfigurationService))
|
|
134
|
+
], ShareWorkbenchContribution));
|
|
135
|
+
const workbenchContributionsRegistry = ( Registry.as(Extensions.Workbench));
|
|
136
|
+
workbenchContributionsRegistry.registerWorkbenchContribution(ShareWorkbenchContribution, LifecyclePhase.Eventually);
|
|
137
|
+
( Registry.as(Extensions$1.Configuration)).registerConfiguration({
|
|
135
138
|
...workbenchConfigurationNodeBase,
|
|
136
139
|
properties: {
|
|
137
140
|
'workbench.experimental.share.enabled': {
|
|
@@ -139,7 +142,7 @@ workbenchContributionsRegistry.registerWorkbenchContribution(ShareWorkbenchContr
|
|
|
139
142
|
default: false,
|
|
140
143
|
tags: ['experimental'],
|
|
141
144
|
markdownDescription: ( localize(
|
|
142
|
-
|
|
145
|
+
8853,
|
|
143
146
|
"Controls whether to render the Share action next to the command center when {0} is {1}.",
|
|
144
147
|
'`#window.commandCenter#`',
|
|
145
148
|
'`true`'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import n from 'vscode/external/rollup-plugin-styles/dist/runtime/inject-css
|
|
1
|
+
import n from 'vscode/external/rollup-plugin-styles/dist/runtime/inject-css';
|
|
2
2
|
|
|
3
3
|
var css = "div.share-dialog-input-link,div.share-dialog-input-text{background-color:var(--vscode-input-background);border:1px solid var(--vscode-input-border,transparent);border-radius:2px;color:var(--vscode-input-foreground);line-height:24px;padding:2px;user-select:all}div.share-dialog-input-link{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}";
|
|
4
4
|
n(css,{});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CancellationToken } from "vscode/vscode/vs/base/common/cancellation";
|
|
2
|
+
import { IDisposable } from "vscode/vscode/vs/base/common/lifecycle";
|
|
3
|
+
import { URI } from "vscode/vscode/vs/base/common/uri";
|
|
4
|
+
import { ICodeEditorService } from "vscode/vscode/vs/editor/browser/services/codeEditorService";
|
|
5
|
+
import { ISubmenuItem } from "vscode/vscode/vs/platform/actions/common/actions";
|
|
6
|
+
import { IContextKey, RawContextKey } from "vscode/vscode/vs/platform/contextkey/common/contextkey";
|
|
7
|
+
import { IContextKeyService } from "vscode/vscode/vs/platform/contextkey/common/contextkey.service";
|
|
8
|
+
import { ILabelService } from "vscode/vscode/vs/platform/label/common/label.service";
|
|
9
|
+
import { IQuickInputService } from "vscode/vscode/vs/platform/quickinput/common/quickInput.service";
|
|
10
|
+
import { ITelemetryService } from "vscode/vscode/vs/platform/telemetry/common/telemetry.service";
|
|
11
|
+
import { IShareProvider, IShareableItem } from "vscode/vscode/vs/workbench/contrib/share/common/share";
|
|
12
|
+
import { IShareService } from "vscode/vscode/vs/workbench/contrib/share/common/share.service";
|
|
13
|
+
export declare const ShareProviderCountContext: RawContextKey<number>;
|
|
14
|
+
export declare class ShareService implements IShareService {
|
|
15
|
+
private contextKeyService;
|
|
16
|
+
private readonly labelService;
|
|
17
|
+
private quickInputService;
|
|
18
|
+
private readonly codeEditorService;
|
|
19
|
+
private readonly telemetryService;
|
|
20
|
+
readonly _serviceBrand: undefined;
|
|
21
|
+
readonly providerCount: IContextKey<number>;
|
|
22
|
+
private readonly _providers;
|
|
23
|
+
constructor(contextKeyService: IContextKeyService, labelService: ILabelService, quickInputService: IQuickInputService, codeEditorService: ICodeEditorService, telemetryService: ITelemetryService);
|
|
24
|
+
registerShareProvider(provider: IShareProvider): IDisposable;
|
|
25
|
+
getShareActions(): ISubmenuItem[];
|
|
26
|
+
provideShare(item: IShareableItem, token: CancellationToken): Promise<URI | string | undefined>;
|
|
27
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
|
|
2
3
|
import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
|
|
3
4
|
import { score } from 'vscode/vscode/vs/editor/common/languageSelector';
|
|
4
5
|
import { localize } from 'vscode/vscode/vs/nls';
|
|
@@ -8,7 +9,7 @@ import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label.serv
|
|
|
8
9
|
import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
9
10
|
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
10
11
|
|
|
11
|
-
const ShareProviderCountContext = (
|
|
12
|
+
const ShareProviderCountContext = ( new RawContextKey('shareProviderCount', 0, ( localize(8854, "The number of available share providers"))));
|
|
12
13
|
let ShareService = class ShareService {
|
|
13
14
|
constructor(contextKeyService, labelService, quickInputService, codeEditorService, telemetryService) {
|
|
14
15
|
this.contextKeyService = contextKeyService;
|
|
@@ -16,7 +17,7 @@ let ShareService = class ShareService {
|
|
|
16
17
|
this.quickInputService = quickInputService;
|
|
17
18
|
this.codeEditorService = codeEditorService;
|
|
18
19
|
this.telemetryService = telemetryService;
|
|
19
|
-
this._providers = (
|
|
20
|
+
this._providers = ( new Set());
|
|
20
21
|
this.providerCount = ShareProviderCountContext.bindTo(this.contextKeyService);
|
|
21
22
|
}
|
|
22
23
|
registerShareProvider(provider) {
|
|
@@ -34,7 +35,7 @@ let ShareService = class ShareService {
|
|
|
34
35
|
}
|
|
35
36
|
async provideShare(item, token) {
|
|
36
37
|
const language = this.codeEditorService.getActiveCodeEditor()?.getModel()?.getLanguageId() ?? '';
|
|
37
|
-
const providers = [...(
|
|
38
|
+
const providers = [...( this._providers.values())]
|
|
38
39
|
.filter((p) => score(p.selector, item.resourceUri, language, true, undefined, undefined) > 0)
|
|
39
40
|
.sort((a, b) => a.priority - b.priority);
|
|
40
41
|
if (providers.length === 0) {
|
|
@@ -44,9 +45,9 @@ let ShareService = class ShareService {
|
|
|
44
45
|
this.telemetryService.publicLog2('shareService.share', { providerId: providers[0].id });
|
|
45
46
|
return providers[0].provideShare(item, token);
|
|
46
47
|
}
|
|
47
|
-
const items = (
|
|
48
|
+
const items = ( providers.map((p) => ({ label: p.label, provider: p })));
|
|
48
49
|
const selected = await this.quickInputService.pick(items, { canPickMany: false, placeHolder: ( localize(
|
|
49
|
-
|
|
50
|
+
8855,
|
|
50
51
|
'Choose how to share {0}',
|
|
51
52
|
this.labelService.getUriLabel(item.resourceUri)
|
|
52
53
|
)) }, token);
|
|
@@ -57,12 +58,12 @@ let ShareService = class ShareService {
|
|
|
57
58
|
return;
|
|
58
59
|
}
|
|
59
60
|
};
|
|
60
|
-
ShareService = (
|
|
61
|
-
(
|
|
62
|
-
(
|
|
63
|
-
(
|
|
64
|
-
(
|
|
65
|
-
(
|
|
66
|
-
], ShareService))
|
|
61
|
+
ShareService = ( __decorate([
|
|
62
|
+
( __param(0, IContextKeyService)),
|
|
63
|
+
( __param(1, ILabelService)),
|
|
64
|
+
( __param(2, IQuickInputService)),
|
|
65
|
+
( __param(3, ICodeEditorService)),
|
|
66
|
+
( __param(4, ITelemetryService))
|
|
67
|
+
], ShareService));
|
|
67
68
|
|
|
68
69
|
export { ShareProviderCountContext, ShareService };
|
package/share.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
2
|
-
import { ShareService } from './vscode/src/vs/workbench/contrib/share/browser/shareService.js';
|
|
3
|
-
import { IShareService } from 'vscode/vscode/vs/workbench/contrib/share/common/share.service';
|
|
4
|
-
import './vscode/src/vs/workbench/contrib/share/browser/share.contribution.js';
|
|
5
|
-
|
|
6
|
-
function getServiceOverride() {
|
|
7
|
-
return {
|
|
8
|
-
[( IShareService.toString())]: new SyncDescriptor(ShareService, [], true)
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export { getServiceOverride as default };
|