@codingame/monaco-vscode-dialogs-service-override 4.0.0 → 4.1.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/dialogs.js +4 -4
- package/package.json +2 -2
- package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
- package/external/tslib/tslib.es6.js +0 -11
- package/vscode/src/vs/workbench/browser/parts/dialogs/dialog.web.contribution.js +0 -76
- package/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.js +0 -134
- package/vscode/src/vs/workbench/common/dialogs.js +0 -38
- package/vscode/src/vs/workbench/contrib/welcomeDialog/browser/media/welcomeWidget.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/welcomeDialog/browser/welcomeDialog.contribution.js +0 -103
- package/vscode/src/vs/workbench/contrib/welcomeDialog/browser/welcomeWidget.js +0 -189
- package/vscode/src/vs/workbench/services/dialogs/browser/abstractFileDialogService.js +0 -379
- package/vscode/src/vs/workbench/services/dialogs/browser/simpleFileDialog.js +0 -1039
- package/vscode/src/vs/workbench/services/dialogs/common/dialogService.js +0 -72
package/dialogs.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { DialogService } from '
|
|
1
|
+
import { DialogService } from 'vscode/vscode/vs/workbench/services/dialogs/common/dialogService';
|
|
2
2
|
import './override/vs/platform/dialogs/common/dialogs.js';
|
|
3
3
|
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
4
|
-
import { AbstractFileDialogService } from '
|
|
4
|
+
import { AbstractFileDialogService } from 'vscode/vscode/vs/workbench/services/dialogs/browser/abstractFileDialogService';
|
|
5
5
|
import { unsupported } from './tools.js';
|
|
6
|
-
import '
|
|
7
|
-
import '
|
|
6
|
+
import 'vscode/vscode/vs/workbench/browser/parts/dialogs/dialog.web.contribution';
|
|
7
|
+
import 'vscode/vscode/vs/workbench/contrib/welcomeDialog/browser/welcomeDialog.contribution';
|
|
8
8
|
import { IDialogService, IFileDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs';
|
|
9
9
|
|
|
10
10
|
class FileDialogService extends AbstractFileDialogService {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-dialogs-service-override",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -18,6 +18,6 @@
|
|
|
18
18
|
"module": "index.js",
|
|
19
19
|
"types": "index.d.ts",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"vscode": "npm:@codingame/monaco-vscode-api@4.
|
|
21
|
+
"vscode": "npm:@codingame/monaco-vscode-api@4.1.0"
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=( Object.keys(r.attributes)),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
|
|
2
|
-
|
|
3
|
-
export { n as default };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
function __decorate(decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
}
|
|
7
|
-
function __param(paramIndex, decorator) {
|
|
8
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export { __decorate, __param };
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { IClipboardService } from 'vscode/vscode/vs/platform/clipboard/common/clipboardService';
|
|
3
|
-
import '../../../../../../../override/vs/platform/dialogs/common/dialogs.js';
|
|
4
|
-
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
|
|
5
|
-
import { ILayoutService } from 'vscode/vscode/vs/platform/layout/browser/layoutService';
|
|
6
|
-
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
7
|
-
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService';
|
|
8
|
-
import { registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
9
|
-
import { BrowserDialogHandler } from './dialogHandler.js';
|
|
10
|
-
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
11
|
-
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
12
|
-
import { Lazy } from 'vscode/vscode/vs/base/common/lazy';
|
|
13
|
-
import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs';
|
|
14
|
-
|
|
15
|
-
let DialogHandlerContribution = class DialogHandlerContribution extends Disposable {
|
|
16
|
-
static { this.ID = 'workbench.contrib.dialogHandler'; }
|
|
17
|
-
constructor(dialogService, logService, layoutService, keybindingService, instantiationService, productService, clipboardService) {
|
|
18
|
-
super();
|
|
19
|
-
this.dialogService = dialogService;
|
|
20
|
-
this.impl = ( new Lazy(() => ( new BrowserDialogHandler(
|
|
21
|
-
logService,
|
|
22
|
-
layoutService,
|
|
23
|
-
keybindingService,
|
|
24
|
-
instantiationService,
|
|
25
|
-
productService,
|
|
26
|
-
clipboardService
|
|
27
|
-
))));
|
|
28
|
-
this.model = this.dialogService.model;
|
|
29
|
-
this._register(this.model.onWillShowDialog(() => {
|
|
30
|
-
if (!this.currentDialog) {
|
|
31
|
-
this.processDialogs();
|
|
32
|
-
}
|
|
33
|
-
}));
|
|
34
|
-
this.processDialogs();
|
|
35
|
-
}
|
|
36
|
-
async processDialogs() {
|
|
37
|
-
while (this.model.dialogs.length) {
|
|
38
|
-
this.currentDialog = this.model.dialogs[0];
|
|
39
|
-
let result = undefined;
|
|
40
|
-
try {
|
|
41
|
-
if (this.currentDialog.args.confirmArgs) {
|
|
42
|
-
const args = this.currentDialog.args.confirmArgs;
|
|
43
|
-
result = await this.impl.value.confirm(args.confirmation);
|
|
44
|
-
}
|
|
45
|
-
else if (this.currentDialog.args.inputArgs) {
|
|
46
|
-
const args = this.currentDialog.args.inputArgs;
|
|
47
|
-
result = await this.impl.value.input(args.input);
|
|
48
|
-
}
|
|
49
|
-
else if (this.currentDialog.args.promptArgs) {
|
|
50
|
-
const args = this.currentDialog.args.promptArgs;
|
|
51
|
-
result = await this.impl.value.prompt(args.prompt);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
await this.impl.value.about();
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
catch (error) {
|
|
58
|
-
result = error;
|
|
59
|
-
}
|
|
60
|
-
this.currentDialog.close(result);
|
|
61
|
-
this.currentDialog = undefined;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
DialogHandlerContribution = ( __decorate([
|
|
66
|
-
( __param(0, IDialogService)),
|
|
67
|
-
( __param(1, ILogService)),
|
|
68
|
-
( __param(2, ILayoutService)),
|
|
69
|
-
( __param(3, IKeybindingService)),
|
|
70
|
-
( __param(4, IInstantiationService)),
|
|
71
|
-
( __param(5, IProductService)),
|
|
72
|
-
( __param(6, IClipboardService))
|
|
73
|
-
], DialogHandlerContribution));
|
|
74
|
-
registerWorkbenchContribution2(DialogHandlerContribution.ID, DialogHandlerContribution, 1 );
|
|
75
|
-
|
|
76
|
-
export { DialogHandlerContribution };
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
3
|
-
import '../../../../../../../override/vs/platform/dialogs/common/dialogs.js';
|
|
4
|
-
import { ILayoutService } from 'vscode/vscode/vs/platform/layout/browser/layoutService';
|
|
5
|
-
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
6
|
-
import Severity$1 from 'vscode/vscode/vs/base/common/severity';
|
|
7
|
-
import { Dialog } from 'vscode/vscode/vs/base/browser/ui/dialog/dialog';
|
|
8
|
-
import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
9
|
-
import { EventHelper } from 'vscode/vscode/vs/base/browser/dom';
|
|
10
|
-
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
|
|
11
|
-
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService';
|
|
12
|
-
import { IClipboardService } from 'vscode/vscode/vs/platform/clipboard/common/clipboardService';
|
|
13
|
-
import { fromNow } from 'vscode/vscode/vs/base/common/date';
|
|
14
|
-
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
15
|
-
import { MarkdownRenderer } from 'vscode/vscode/vs/editor/browser/widget/markdownRenderer/browser/markdownRenderer';
|
|
16
|
-
import { defaultButtonStyles, defaultCheckboxStyles, defaultInputBoxStyles, defaultDialogStyles } from 'vscode/vscode/vs/platform/theme/browser/defaultStyles';
|
|
17
|
-
import { AbstractDialogHandler } from 'vscode/vscode/vs/platform/dialogs/common/dialogs';
|
|
18
|
-
|
|
19
|
-
var BrowserDialogHandler_1;
|
|
20
|
-
let BrowserDialogHandler = class BrowserDialogHandler extends AbstractDialogHandler {
|
|
21
|
-
static { BrowserDialogHandler_1 = this; }
|
|
22
|
-
static { this.ALLOWABLE_COMMANDS = [
|
|
23
|
-
'copy',
|
|
24
|
-
'cut',
|
|
25
|
-
'editor.action.selectAll',
|
|
26
|
-
'editor.action.clipboardCopyAction',
|
|
27
|
-
'editor.action.clipboardCutAction',
|
|
28
|
-
'editor.action.clipboardPasteAction'
|
|
29
|
-
]; }
|
|
30
|
-
constructor(logService, layoutService, keybindingService, instantiationService, productService, clipboardService) {
|
|
31
|
-
super();
|
|
32
|
-
this.logService = logService;
|
|
33
|
-
this.layoutService = layoutService;
|
|
34
|
-
this.keybindingService = keybindingService;
|
|
35
|
-
this.instantiationService = instantiationService;
|
|
36
|
-
this.productService = productService;
|
|
37
|
-
this.clipboardService = clipboardService;
|
|
38
|
-
this.markdownRenderer = this.instantiationService.createInstance(MarkdownRenderer, {});
|
|
39
|
-
}
|
|
40
|
-
async prompt(prompt) {
|
|
41
|
-
this.logService.trace('DialogService#prompt', prompt.message);
|
|
42
|
-
const buttons = this.getPromptButtons(prompt);
|
|
43
|
-
const { button, checkboxChecked } = await this.doShow(prompt.type, prompt.message, buttons, prompt.detail, prompt.cancelButton ? buttons.length - 1 : -1 , prompt.checkbox, undefined, typeof prompt?.custom === 'object' ? prompt.custom : undefined);
|
|
44
|
-
return this.getPromptResult(prompt, button, checkboxChecked);
|
|
45
|
-
}
|
|
46
|
-
async confirm(confirmation) {
|
|
47
|
-
this.logService.trace('DialogService#confirm', confirmation.message);
|
|
48
|
-
const buttons = this.getConfirmationButtons(confirmation);
|
|
49
|
-
const { button, checkboxChecked } = await this.doShow(confirmation.type ?? 'question', confirmation.message, buttons, confirmation.detail, buttons.length - 1, confirmation.checkbox, undefined, typeof confirmation?.custom === 'object' ? confirmation.custom : undefined);
|
|
50
|
-
return { confirmed: button === 0, checkboxChecked };
|
|
51
|
-
}
|
|
52
|
-
async input(input) {
|
|
53
|
-
this.logService.trace('DialogService#input', input.message);
|
|
54
|
-
const buttons = this.getInputButtons(input);
|
|
55
|
-
const { button, checkboxChecked, values } = await this.doShow(input.type ?? 'question', input.message, buttons, input.detail, buttons.length - 1, input?.checkbox, input.inputs, typeof input.custom === 'object' ? input.custom : undefined);
|
|
56
|
-
return { confirmed: button === 0, checkboxChecked, values };
|
|
57
|
-
}
|
|
58
|
-
async about() {
|
|
59
|
-
const detailString = (useAgo) => {
|
|
60
|
-
return ( localizeWithPath(
|
|
61
|
-
'vs/workbench/browser/parts/dialogs/dialogHandler',
|
|
62
|
-
'aboutDetail',
|
|
63
|
-
"Version: {0}\nCommit: {1}\nDate: {2}\nBrowser: {3}",
|
|
64
|
-
this.productService.version || 'Unknown',
|
|
65
|
-
this.productService.commit || 'Unknown',
|
|
66
|
-
this.productService.date ? `${this.productService.date}${useAgo ? ' (' + fromNow(( new Date(this.productService.date)), true) + ')' : ''}` : 'Unknown',
|
|
67
|
-
navigator.userAgent
|
|
68
|
-
));
|
|
69
|
-
};
|
|
70
|
-
const detail = detailString(true);
|
|
71
|
-
const detailToCopy = detailString(false);
|
|
72
|
-
const { button } = await this.doShow(Severity$1.Info, this.productService.nameLong, [
|
|
73
|
-
( localizeWithPath(
|
|
74
|
-
'vs/workbench/browser/parts/dialogs/dialogHandler',
|
|
75
|
-
{ key: 'copy', comment: ['&& denotes a mnemonic'] },
|
|
76
|
-
"&&Copy"
|
|
77
|
-
)),
|
|
78
|
-
( localizeWithPath('vs/workbench/browser/parts/dialogs/dialogHandler', 'ok', "OK"))
|
|
79
|
-
], detail, 1);
|
|
80
|
-
if (button === 0) {
|
|
81
|
-
this.clipboardService.writeText(detailToCopy);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
async doShow(type, message, buttons, detail, cancelId, checkbox, inputs, customOptions) {
|
|
85
|
-
const dialogDisposables = ( new DisposableStore());
|
|
86
|
-
const renderBody = customOptions ? (parent) => {
|
|
87
|
-
parent.classList.add(...(customOptions.classes || []));
|
|
88
|
-
customOptions.markdownDetails?.forEach(markdownDetail => {
|
|
89
|
-
const result = this.markdownRenderer.render(markdownDetail.markdown);
|
|
90
|
-
parent.appendChild(result.element);
|
|
91
|
-
result.element.classList.add(...(markdownDetail.classes || []));
|
|
92
|
-
dialogDisposables.add(result);
|
|
93
|
-
});
|
|
94
|
-
} : undefined;
|
|
95
|
-
const dialog = ( new Dialog(this.layoutService.activeContainer, message, buttons, {
|
|
96
|
-
detail,
|
|
97
|
-
cancelId,
|
|
98
|
-
type: this.getDialogType(type),
|
|
99
|
-
keyEventProcessor: (event) => {
|
|
100
|
-
const resolved = this.keybindingService.softDispatch(event, this.layoutService.activeContainer);
|
|
101
|
-
if (resolved.kind === 2 && resolved.commandId) {
|
|
102
|
-
if (BrowserDialogHandler_1.ALLOWABLE_COMMANDS.indexOf(resolved.commandId) === -1) {
|
|
103
|
-
EventHelper.stop(event, true);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
renderBody,
|
|
108
|
-
icon: customOptions?.icon,
|
|
109
|
-
disableCloseAction: customOptions?.disableCloseAction,
|
|
110
|
-
buttonDetails: customOptions?.buttonDetails,
|
|
111
|
-
checkboxLabel: checkbox?.label,
|
|
112
|
-
checkboxChecked: checkbox?.checked,
|
|
113
|
-
inputs,
|
|
114
|
-
buttonStyles: defaultButtonStyles,
|
|
115
|
-
checkboxStyles: defaultCheckboxStyles,
|
|
116
|
-
inputBoxStyles: defaultInputBoxStyles,
|
|
117
|
-
dialogStyles: defaultDialogStyles
|
|
118
|
-
}));
|
|
119
|
-
dialogDisposables.add(dialog);
|
|
120
|
-
const result = await dialog.show();
|
|
121
|
-
dialogDisposables.dispose();
|
|
122
|
-
return result;
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
BrowserDialogHandler = BrowserDialogHandler_1 = ( __decorate([
|
|
126
|
-
( __param(0, ILogService)),
|
|
127
|
-
( __param(1, ILayoutService)),
|
|
128
|
-
( __param(2, IKeybindingService)),
|
|
129
|
-
( __param(3, IInstantiationService)),
|
|
130
|
-
( __param(4, IProductService)),
|
|
131
|
-
( __param(5, IClipboardService))
|
|
132
|
-
], BrowserDialogHandler));
|
|
133
|
-
|
|
134
|
-
export { BrowserDialogHandler };
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { DeferredPromise } from 'vscode/vscode/vs/base/common/async';
|
|
2
|
-
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
3
|
-
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
|
-
|
|
5
|
-
class DialogsModel extends Disposable {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this.dialogs = [];
|
|
9
|
-
this._onWillShowDialog = this._register(( new Emitter()));
|
|
10
|
-
this.onWillShowDialog = this._onWillShowDialog.event;
|
|
11
|
-
this._onDidShowDialog = this._register(( new Emitter()));
|
|
12
|
-
this.onDidShowDialog = this._onDidShowDialog.event;
|
|
13
|
-
}
|
|
14
|
-
show(dialog) {
|
|
15
|
-
const promise = ( new DeferredPromise());
|
|
16
|
-
const item = {
|
|
17
|
-
args: dialog,
|
|
18
|
-
close: result => {
|
|
19
|
-
this.dialogs.splice(0, 1);
|
|
20
|
-
if (result instanceof Error) {
|
|
21
|
-
promise.error(result);
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
promise.complete(result);
|
|
25
|
-
}
|
|
26
|
-
this._onDidShowDialog.fire();
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
this.dialogs.push(item);
|
|
30
|
-
this._onWillShowDialog.fire();
|
|
31
|
-
return {
|
|
32
|
-
item,
|
|
33
|
-
result: promise.p
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export { DialogsModel };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import n from '../../../../../../../../external/rollup-plugin-styles/dist/runtime/inject-css.js';
|
|
2
|
-
|
|
3
|
-
var css = ".monaco-dialog-box{border-radius:6px}.dialog-message-detail-title>div>p>.codicon[class*=codicon-]:before{color:var(--vscode-textLink-foreground);font-size:larger;padding-right:10px;position:relative}.dialog-message-detail-title{font-size:large;height:22px}.monaco-dialog-box .monaco-action-bar .actions-container{justify-content:flex-end}";
|
|
4
|
-
n(css,{});
|
|
5
|
-
|
|
6
|
-
export { css, css as default };
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
3
|
-
import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
4
|
-
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
5
|
-
import { IBrowserWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/browser/environmentService';
|
|
6
|
-
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
7
|
-
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
8
|
-
import { ContextKeyExpr, IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
9
|
-
import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
|
|
10
|
-
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
11
|
-
import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands';
|
|
12
|
-
import { WelcomeWidget } from './welcomeWidget.js';
|
|
13
|
-
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
|
|
14
|
-
import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener';
|
|
15
|
-
import { Extensions as Extensions$1 } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
|
|
16
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
17
|
-
import { applicationConfigurationNodeBase } from 'vscode/vscode/vs/workbench/common/configuration';
|
|
18
|
-
import { RunOnceScheduler } from 'vscode/vscode/vs/base/common/async';
|
|
19
|
-
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
20
|
-
|
|
21
|
-
const configurationKey = 'workbench.welcome.experimental.dialog';
|
|
22
|
-
let WelcomeDialogContribution = class WelcomeDialogContribution extends Disposable {
|
|
23
|
-
constructor(storageService, environmentService, configurationService, contextService, codeEditorService, instantiationService, commandService, telemetryService, openerService, editorService) {
|
|
24
|
-
super();
|
|
25
|
-
this.contextService = contextService;
|
|
26
|
-
this.codeEditorService = codeEditorService;
|
|
27
|
-
this.instantiationService = instantiationService;
|
|
28
|
-
this.commandService = commandService;
|
|
29
|
-
this.telemetryService = telemetryService;
|
|
30
|
-
this.openerService = openerService;
|
|
31
|
-
this.editorService = editorService;
|
|
32
|
-
this.isRendered = false;
|
|
33
|
-
if (!storageService.isNew(-1 )) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
const setting = configurationService.inspect(configurationKey);
|
|
37
|
-
if (!setting.value) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
const welcomeDialog = environmentService.options?.welcomeDialog;
|
|
41
|
-
if (!welcomeDialog) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
this._register(editorService.onDidActiveEditorChange(() => {
|
|
45
|
-
if (!this.isRendered) {
|
|
46
|
-
const codeEditor = codeEditorService.getActiveCodeEditor();
|
|
47
|
-
if (codeEditor?.hasModel()) {
|
|
48
|
-
const scheduler = ( new RunOnceScheduler(() => {
|
|
49
|
-
const notificationsVisible = contextService.contextMatchesRules(ContextKeyExpr.deserialize('notificationCenterVisible')) ||
|
|
50
|
-
contextService.contextMatchesRules(ContextKeyExpr.deserialize('notificationToastsVisible'));
|
|
51
|
-
if (codeEditor === codeEditorService.getActiveCodeEditor() && !notificationsVisible) {
|
|
52
|
-
this.isRendered = true;
|
|
53
|
-
const welcomeWidget = ( new WelcomeWidget(
|
|
54
|
-
codeEditor,
|
|
55
|
-
instantiationService,
|
|
56
|
-
commandService,
|
|
57
|
-
telemetryService,
|
|
58
|
-
openerService
|
|
59
|
-
));
|
|
60
|
-
welcomeWidget.render(welcomeDialog.title, welcomeDialog.message, welcomeDialog.buttonText, welcomeDialog.buttonCommand);
|
|
61
|
-
}
|
|
62
|
-
}, 3000));
|
|
63
|
-
this._register(codeEditor.onDidChangeModelContent((e) => {
|
|
64
|
-
if (!this.isRendered) {
|
|
65
|
-
scheduler.schedule();
|
|
66
|
-
}
|
|
67
|
-
}));
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}));
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
WelcomeDialogContribution = ( __decorate([
|
|
74
|
-
( __param(0, IStorageService)),
|
|
75
|
-
( __param(1, IBrowserWorkbenchEnvironmentService)),
|
|
76
|
-
( __param(2, IConfigurationService)),
|
|
77
|
-
( __param(3, IContextKeyService)),
|
|
78
|
-
( __param(4, ICodeEditorService)),
|
|
79
|
-
( __param(5, IInstantiationService)),
|
|
80
|
-
( __param(6, ICommandService)),
|
|
81
|
-
( __param(7, ITelemetryService)),
|
|
82
|
-
( __param(8, IOpenerService)),
|
|
83
|
-
( __param(9, IEditorService))
|
|
84
|
-
], WelcomeDialogContribution));
|
|
85
|
-
( Registry.as(Extensions.Workbench))
|
|
86
|
-
.registerWorkbenchContribution(WelcomeDialogContribution, 4 );
|
|
87
|
-
const configurationRegistry = ( Registry.as(Extensions$1.Configuration));
|
|
88
|
-
configurationRegistry.registerConfiguration({
|
|
89
|
-
...applicationConfigurationNodeBase,
|
|
90
|
-
properties: {
|
|
91
|
-
'workbench.welcome.experimental.dialog': {
|
|
92
|
-
scope: 1 ,
|
|
93
|
-
type: 'boolean',
|
|
94
|
-
default: false,
|
|
95
|
-
tags: ['experimental'],
|
|
96
|
-
description: ( localizeWithPath(
|
|
97
|
-
'vs/workbench/contrib/welcomeDialog/browser/welcomeDialog.contribution',
|
|
98
|
-
'workbench.welcome.dialog',
|
|
99
|
-
"When enabled, a welcome widget is shown in the editor"
|
|
100
|
-
))
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
});
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import './media/welcomeWidget.css.js';
|
|
2
|
-
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
3
|
-
import { $, hide, append } from 'vscode/vscode/vs/base/browser/dom';
|
|
4
|
-
import { MarkdownString } from 'vscode/vscode/vs/base/common/htmlContent';
|
|
5
|
-
import { MarkdownRenderer } from 'vscode/vscode/vs/editor/browser/widget/markdownRenderer/browser/markdownRenderer';
|
|
6
|
-
import { ButtonBar } from 'vscode/vscode/vs/base/browser/ui/button/button';
|
|
7
|
-
import { mnemonicButtonLabel } from 'vscode/vscode/vs/base/common/labels';
|
|
8
|
-
import { defaultButtonStyles } from 'vscode/vscode/vs/platform/theme/browser/defaultStyles';
|
|
9
|
-
import { Action } from 'vscode/vscode/vs/base/common/actions';
|
|
10
|
-
import { ActionBar } from 'vscode/vscode/vs/base/browser/ui/actionbar/actionbar';
|
|
11
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
12
|
-
import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
|
|
13
|
-
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
14
|
-
import { parseLinkedText } from 'vscode/vscode/vs/base/common/linkedText';
|
|
15
|
-
import { Link } from 'vscode/vscode/vs/platform/opener/browser/link';
|
|
16
|
-
import { renderLabelWithIcons } from 'vscode/vscode/vs/base/browser/ui/iconLabel/iconLabels';
|
|
17
|
-
import { renderFormattedText } from 'vscode/vscode/vs/base/browser/formattedTextRenderer';
|
|
18
|
-
import { registerThemingParticipant } from 'vscode/vscode/vs/platform/theme/common/themeService';
|
|
19
|
-
import 'vscode/vscode/vs/platform/theme/common/colorUtils';
|
|
20
|
-
import { contrastBorder } from 'vscode/vscode/vs/platform/theme/common/colors/baseColors';
|
|
21
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/chartsColors';
|
|
22
|
-
import { editorWidgetBackground, widgetShadow, widgetBorder, editorWidgetForeground } from 'vscode/vscode/vs/platform/theme/common/colors/editorColors';
|
|
23
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/inputColors';
|
|
24
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/listColors';
|
|
25
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/menuColors';
|
|
26
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/minimapColors';
|
|
27
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/miscColors';
|
|
28
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
|
|
29
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
|
|
30
|
-
|
|
31
|
-
class WelcomeWidget extends Disposable {
|
|
32
|
-
constructor(_editor, instantiationService, commandService, telemetryService, openerService) {
|
|
33
|
-
super();
|
|
34
|
-
this._editor = _editor;
|
|
35
|
-
this.instantiationService = instantiationService;
|
|
36
|
-
this.commandService = commandService;
|
|
37
|
-
this.telemetryService = telemetryService;
|
|
38
|
-
this.openerService = openerService;
|
|
39
|
-
this.markdownRenderer = this.instantiationService.createInstance(MarkdownRenderer, {});
|
|
40
|
-
this._isVisible = false;
|
|
41
|
-
this._rootDomNode = document.createElement('div');
|
|
42
|
-
this._rootDomNode.className = 'welcome-widget';
|
|
43
|
-
this.element = this._rootDomNode.appendChild($('.monaco-dialog-box'));
|
|
44
|
-
this.element.setAttribute('role', 'dialog');
|
|
45
|
-
hide(this._rootDomNode);
|
|
46
|
-
this.messageContainer = this.element.appendChild($('.dialog-message-container'));
|
|
47
|
-
}
|
|
48
|
-
async executeCommand(commandId, ...args) {
|
|
49
|
-
try {
|
|
50
|
-
await this.commandService.executeCommand(commandId, ...args);
|
|
51
|
-
this.telemetryService.publicLog2('workbenchActionExecuted', {
|
|
52
|
-
id: commandId,
|
|
53
|
-
from: 'welcomeWidget'
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
catch (ex) {
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
async render(title, message, buttonText, buttonAction) {
|
|
60
|
-
if (!this._editor._getViewModel()) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
await this.buildWidgetContent(title, message, buttonText, buttonAction);
|
|
64
|
-
this._editor.addOverlayWidget(this);
|
|
65
|
-
this._show();
|
|
66
|
-
this.telemetryService.publicLog2('workbenchActionExecuted', {
|
|
67
|
-
id: 'welcomeWidgetRendered',
|
|
68
|
-
from: 'welcomeWidget'
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
async buildWidgetContent(title, message, buttonText, buttonAction) {
|
|
72
|
-
const actionBar = this._register(( new ActionBar(this.element, {})));
|
|
73
|
-
const action = this._register(( new Action('dialog.close', ( localizeWithPath(
|
|
74
|
-
'vs/workbench/contrib/welcomeDialog/browser/welcomeWidget',
|
|
75
|
-
'dialogClose',
|
|
76
|
-
"Close Dialog"
|
|
77
|
-
)), ThemeIcon.asClassName(Codicon.dialogClose), true, async () => {
|
|
78
|
-
this._hide();
|
|
79
|
-
})));
|
|
80
|
-
actionBar.push(action, { icon: true, label: false });
|
|
81
|
-
const renderBody = (message, icon) => {
|
|
82
|
-
const mds = ( new MarkdownString(undefined, { supportThemeIcons: true, supportHtml: true }));
|
|
83
|
-
mds.appendMarkdown(`<a class="copilot">$(${icon})</a>`);
|
|
84
|
-
mds.appendMarkdown(message);
|
|
85
|
-
return mds;
|
|
86
|
-
};
|
|
87
|
-
const titleElement = this.messageContainer.appendChild($('#monaco-dialog-message-detail.dialog-message-detail-title'));
|
|
88
|
-
const titleElementMdt = this.markdownRenderer.render(renderBody(title, 'zap'));
|
|
89
|
-
titleElement.appendChild(titleElementMdt.element);
|
|
90
|
-
this.buildStepMarkdownDescription(this.messageContainer, ( message.split('\n').filter(x => x).map(text => parseLinkedText(text))));
|
|
91
|
-
const buttonsRowElement = this.messageContainer.appendChild($('.dialog-buttons-row'));
|
|
92
|
-
const buttonContainer = buttonsRowElement.appendChild($('.dialog-buttons'));
|
|
93
|
-
const buttonBar = this._register(( new ButtonBar(buttonContainer)));
|
|
94
|
-
const primaryButton = this._register(buttonBar.addButtonWithDescription({ title: true, secondary: false, ...defaultButtonStyles }));
|
|
95
|
-
primaryButton.label = mnemonicButtonLabel(buttonText, true);
|
|
96
|
-
this._register(primaryButton.onDidClick(async () => {
|
|
97
|
-
await this.executeCommand(buttonAction);
|
|
98
|
-
}));
|
|
99
|
-
buttonBar.buttons[0].focus();
|
|
100
|
-
}
|
|
101
|
-
buildStepMarkdownDescription(container, text) {
|
|
102
|
-
for (const linkedText of text) {
|
|
103
|
-
const p = append(container, $('p'));
|
|
104
|
-
for (const node of linkedText.nodes) {
|
|
105
|
-
if (typeof node === 'string') {
|
|
106
|
-
const labelWithIcon = renderLabelWithIcons(node);
|
|
107
|
-
for (const element of labelWithIcon) {
|
|
108
|
-
if (typeof element === 'string') {
|
|
109
|
-
p.appendChild(renderFormattedText(element, { inline: true, renderCodeSegments: true }));
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
p.appendChild(element);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
const link = this.instantiationService.createInstance(Link, p, node, {
|
|
118
|
-
opener: (href) => {
|
|
119
|
-
this.telemetryService.publicLog2('workbenchActionExecuted', {
|
|
120
|
-
id: 'welcomeWidetLinkAction',
|
|
121
|
-
from: 'welcomeWidget'
|
|
122
|
-
});
|
|
123
|
-
this.openerService.open(href, { allowCommands: true });
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
this._register(link);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return container;
|
|
131
|
-
}
|
|
132
|
-
getId() {
|
|
133
|
-
return 'editor.contrib.welcomeWidget';
|
|
134
|
-
}
|
|
135
|
-
getDomNode() {
|
|
136
|
-
return this._rootDomNode;
|
|
137
|
-
}
|
|
138
|
-
getPosition() {
|
|
139
|
-
return {
|
|
140
|
-
preference: 0
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
_show() {
|
|
144
|
-
if (this._isVisible) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
this._isVisible = true;
|
|
148
|
-
this._rootDomNode.style.display = 'block';
|
|
149
|
-
}
|
|
150
|
-
_hide() {
|
|
151
|
-
if (!this._isVisible) {
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
this._isVisible = true;
|
|
155
|
-
this._rootDomNode.style.display = 'none';
|
|
156
|
-
this._editor.removeOverlayWidget(this);
|
|
157
|
-
this.telemetryService.publicLog2('workbenchActionExecuted', {
|
|
158
|
-
id: 'welcomeWidgetDismissed',
|
|
159
|
-
from: 'welcomeWidget'
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
registerThemingParticipant((theme, collector) => {
|
|
164
|
-
const addBackgroundColorRule = (selector, color) => {
|
|
165
|
-
if (color) {
|
|
166
|
-
collector.addRule(`.monaco-editor ${selector} { background-color: ${color}; }`);
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
const widgetBackground = theme.getColor(editorWidgetBackground);
|
|
170
|
-
addBackgroundColorRule('.welcome-widget', widgetBackground);
|
|
171
|
-
const widgetShadowColor = theme.getColor(widgetShadow);
|
|
172
|
-
if (widgetShadowColor) {
|
|
173
|
-
collector.addRule(`.welcome-widget { box-shadow: 0 0 8px 2px ${widgetShadowColor}; }`);
|
|
174
|
-
}
|
|
175
|
-
const widgetBorderColor = theme.getColor(widgetBorder);
|
|
176
|
-
if (widgetBorderColor) {
|
|
177
|
-
collector.addRule(`.welcome-widget { border-left: 1px solid ${widgetBorderColor}; border-right: 1px solid ${widgetBorderColor}; border-bottom: 1px solid ${widgetBorderColor}; }`);
|
|
178
|
-
}
|
|
179
|
-
const hcBorder = theme.getColor(contrastBorder);
|
|
180
|
-
if (hcBorder) {
|
|
181
|
-
collector.addRule(`.welcome-widget { border: 1px solid ${hcBorder}; }`);
|
|
182
|
-
}
|
|
183
|
-
const foreground = theme.getColor(editorWidgetForeground);
|
|
184
|
-
if (foreground) {
|
|
185
|
-
collector.addRule(`.welcome-widget { color: ${foreground}; }`);
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
export { WelcomeWidget };
|