@codingame/monaco-vscode-dialogs-service-override 11.1.1 → 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 +36 -1
- package/package.json +16 -7
- package/vscode/src/vs/workbench/browser/parts/dialogs/dialog.web.contribution.d.ts +18 -0
- package/vscode/src/vs/workbench/browser/parts/dialogs/dialog.web.contribution.js +5 -3
- package/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.d.ts +23 -0
- package/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.js +27 -24
- package/vscode/src/vs/workbench/common/dialogs.d.ts +25 -0
- package/vscode/src/vs/workbench/common/dialogs.js +1 -0
- package/vscode/src/vs/workbench/contrib/welcomeDialog/browser/media/welcomeWidget.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/welcomeDialog/browser/welcomeDialog.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/welcomeDialog/browser/welcomeDialog.contribution.js +27 -24
- package/vscode/src/vs/workbench/contrib/welcomeDialog/browser/welcomeWidget.d.ts +28 -0
- package/vscode/src/vs/workbench/contrib/welcomeDialog/browser/welcomeWidget.js +9 -7
- package/vscode/src/vs/workbench/services/dialogs/browser/abstractFileDialogService.d.ts +76 -0
- package/vscode/src/vs/workbench/services/dialogs/browser/abstractFileDialogService.js +49 -48
- package/vscode/src/vs/workbench/services/dialogs/browser/fileDialogService.d.ts +19 -0
- package/vscode/src/vs/workbench/services/dialogs/browser/fileDialogService.js +19 -21
- package/vscode/src/vs/workbench/services/dialogs/browser/simpleFileDialog.d.ts +122 -0
- package/vscode/src/vs/workbench/services/dialogs/browser/simpleFileDialog.js +201 -205
- package/vscode/src/vs/workbench/services/dialogs/common/dialogService.d.ts +25 -0
- package/vscode/src/vs/workbench/services/dialogs/common/dialogService.js +7 -5
- package/dialogs.js +0 -23
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,36 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { DialogService } from './vscode/src/vs/workbench/services/dialogs/common/dialogService.js';
|
|
3
|
+
import { IDialogService, IFileDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
4
|
+
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
5
|
+
import { FileDialogService } from './vscode/src/vs/workbench/services/dialogs/browser/fileDialogService.js';
|
|
6
|
+
import 'vscode/vscode/vs/nls';
|
|
7
|
+
import 'vscode/vscode/vs/base/common/charCode';
|
|
8
|
+
import 'vscode/vscode/vs/base/common/marshallingIds';
|
|
9
|
+
import 'vscode/vscode/vs/base/common/path';
|
|
10
|
+
import 'vscode/vscode/vs/base/common/platform';
|
|
11
|
+
import 'vscode/vscode/vs/base/common/lifecycle';
|
|
12
|
+
import 'vscode/vscode/vs/base/common/event';
|
|
13
|
+
import 'vscode/vscode/vs/base/common/network';
|
|
14
|
+
import 'vscode/vscode/vs/base/common/resources';
|
|
15
|
+
import 'vscode/vscode/vs/platform/files/common/files';
|
|
16
|
+
import 'vscode/vscode/vs/platform/files/browser/webFileSystemAccess';
|
|
17
|
+
import 'vscode/vscode/vs/platform/log/common/log';
|
|
18
|
+
import './vscode/src/vs/workbench/browser/parts/dialogs/dialog.web.contribution.js';
|
|
19
|
+
import './vscode/src/vs/workbench/contrib/welcomeDialog/browser/welcomeDialog.contribution.js';
|
|
20
|
+
|
|
21
|
+
function isHTMLFileSystemProvider(provider) {
|
|
22
|
+
return provider.directories != null;
|
|
23
|
+
}
|
|
24
|
+
class DialogServiceOverride extends FileDialogService {
|
|
25
|
+
shouldUseSimplified(scheme) {
|
|
26
|
+
return !isHTMLFileSystemProvider(super.fileSystemProvider) || super.shouldUseSimplified(scheme);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function getServiceOverride() {
|
|
30
|
+
return {
|
|
31
|
+
[IDialogService.toString()]: new SyncDescriptor(DialogService, undefined, true),
|
|
32
|
+
[IFileDialogService.toString()]: new SyncDescriptor(DialogServiceOverride, undefined, true)
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { getServiceOverride as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-dialogs-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "VSCode public API plugged on the monaco editor - dialogs service-override",
|
|
4
6
|
"keywords": [],
|
|
5
7
|
"author": {
|
|
6
8
|
"name": "CodinGame",
|
|
@@ -12,8 +14,13 @@
|
|
|
12
14
|
"url": "git+ssh://git@github.com/CodinGame/monaco-vscode-api.git"
|
|
13
15
|
},
|
|
14
16
|
"type": "module",
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@codingame/monaco-vscode-44b92f80-48ea-5562-a8d0-18a015f8d845-common": "12.0.0",
|
|
19
|
+
"@codingame/monaco-vscode-d6e33d82-c101-549d-a885-0807ab3e0cfb-common": "12.0.0",
|
|
20
|
+
"vscode": "npm:@codingame/monaco-vscode-api@12.0.0"
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {},
|
|
23
|
+
"peerDependenciesMeta": {},
|
|
17
24
|
"main": "index.js",
|
|
18
25
|
"module": "index.js",
|
|
19
26
|
"types": "index.d.ts",
|
|
@@ -22,10 +29,12 @@
|
|
|
22
29
|
"default": "./index.js"
|
|
23
30
|
},
|
|
24
31
|
"./vscode/*": {
|
|
25
|
-
"default": "./vscode/src/*.js"
|
|
32
|
+
"default": "./vscode/src/*.js",
|
|
33
|
+
"types": "./vscode/src/*.d.ts"
|
|
34
|
+
},
|
|
35
|
+
"./*": {
|
|
36
|
+
"default": "./*.js",
|
|
37
|
+
"types": "./*.d.ts"
|
|
26
38
|
}
|
|
27
|
-
},
|
|
28
|
-
"dependencies": {
|
|
29
|
-
"vscode": "npm:@codingame/monaco-vscode-api@11.1.1"
|
|
30
39
|
}
|
|
31
40
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IClipboardService } from "vscode/vscode/vs/platform/clipboard/common/clipboardService.service";
|
|
2
|
+
import { IDialogService } from "vscode/vscode/vs/platform/dialogs/common/dialogs.service";
|
|
3
|
+
import { IKeybindingService } from "vscode/vscode/vs/platform/keybinding/common/keybinding.service";
|
|
4
|
+
import { ILayoutService } from "vscode/vscode/vs/platform/layout/browser/layoutService.service";
|
|
5
|
+
import { ILogService } from "vscode/vscode/vs/platform/log/common/log.service";
|
|
6
|
+
import { IProductService } from "vscode/vscode/vs/platform/product/common/productService.service";
|
|
7
|
+
import { IWorkbenchContribution } from "vscode/vscode/vs/workbench/common/contributions";
|
|
8
|
+
import { Disposable } from "vscode/vscode/vs/base/common/lifecycle";
|
|
9
|
+
import { IInstantiationService } from "vscode/vscode/vs/platform/instantiation/common/instantiation";
|
|
10
|
+
export declare class DialogHandlerContribution extends Disposable implements IWorkbenchContribution {
|
|
11
|
+
private dialogService;
|
|
12
|
+
static readonly ID = "workbench.contrib.dialogHandler";
|
|
13
|
+
private readonly model;
|
|
14
|
+
private readonly impl;
|
|
15
|
+
private currentDialog;
|
|
16
|
+
constructor(dialogService: IDialogService, logService: ILogService, layoutService: ILayoutService, keybindingService: IKeybindingService, instantiationService: IInstantiationService, productService: IProductService, clipboardService: IClipboardService);
|
|
17
|
+
private processDialogs;
|
|
18
|
+
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
|
|
2
3
|
import { IClipboardService } from 'vscode/vscode/vs/platform/clipboard/common/clipboardService.service';
|
|
3
4
|
import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
4
5
|
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding.service';
|
|
5
6
|
import { ILayoutService } from 'vscode/vscode/vs/platform/layout/browser/layoutService.service';
|
|
6
7
|
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
7
8
|
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService.service';
|
|
8
|
-
import { registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
9
|
+
import { registerWorkbenchContribution2, WorkbenchPhase } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
9
10
|
import { BrowserDialogHandler } from './dialogHandler.js';
|
|
10
11
|
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
11
12
|
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
@@ -70,6 +71,7 @@ DialogHandlerContribution = ( __decorate([
|
|
|
70
71
|
( __param(5, IProductService)),
|
|
71
72
|
( __param(6, IClipboardService))
|
|
72
73
|
], DialogHandlerContribution));
|
|
73
|
-
registerWorkbenchContribution2(DialogHandlerContribution.ID, DialogHandlerContribution,
|
|
74
|
+
registerWorkbenchContribution2(DialogHandlerContribution.ID, DialogHandlerContribution, WorkbenchPhase.BlockStartup
|
|
75
|
+
);
|
|
74
76
|
|
|
75
77
|
export { DialogHandlerContribution };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { IConfirmation, IConfirmationResult, IInputResult, IInput, AbstractDialogHandler, IPrompt, IAsyncPromptResult } from "@codingame/monaco-vscode-d6e33d82-c101-549d-a885-0807ab3e0cfb-common/vscode/vs/platform/dialogs/common/dialogs";
|
|
2
|
+
import { ILayoutService } from "vscode/vscode/vs/platform/layout/browser/layoutService.service";
|
|
3
|
+
import { ILogService } from "vscode/vscode/vs/platform/log/common/log.service";
|
|
4
|
+
import { IKeybindingService } from "vscode/vscode/vs/platform/keybinding/common/keybinding.service";
|
|
5
|
+
import { IProductService } from "vscode/vscode/vs/platform/product/common/productService.service";
|
|
6
|
+
import { IClipboardService } from "vscode/vscode/vs/platform/clipboard/common/clipboardService.service";
|
|
7
|
+
import { IInstantiationService } from "vscode/vscode/vs/platform/instantiation/common/instantiation";
|
|
8
|
+
export declare class BrowserDialogHandler extends AbstractDialogHandler {
|
|
9
|
+
private readonly logService;
|
|
10
|
+
private readonly layoutService;
|
|
11
|
+
private readonly keybindingService;
|
|
12
|
+
private readonly instantiationService;
|
|
13
|
+
private readonly productService;
|
|
14
|
+
private readonly clipboardService;
|
|
15
|
+
private static readonly ALLOWABLE_COMMANDS;
|
|
16
|
+
private readonly markdownRenderer;
|
|
17
|
+
constructor(logService: ILogService, layoutService: ILayoutService, keybindingService: IKeybindingService, instantiationService: IInstantiationService, productService: IProductService, clipboardService: IClipboardService);
|
|
18
|
+
prompt<T>(prompt: IPrompt<T>): Promise<IAsyncPromptResult<T>>;
|
|
19
|
+
confirm(confirmation: IConfirmation): Promise<IConfirmationResult>;
|
|
20
|
+
input(input: IInput): Promise<IInputResult>;
|
|
21
|
+
about(): Promise<void>;
|
|
22
|
+
private doShow;
|
|
23
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
|
|
2
3
|
import { localize } from 'vscode/vscode/vs/nls';
|
|
3
|
-
import { AbstractDialogHandler } from 'vscode/vscode/vs/platform/dialogs/common/dialogs';
|
|
4
|
+
import { AbstractDialogHandler } from '@codingame/monaco-vscode-d6e33d82-c101-549d-a885-0807ab3e0cfb-common/vscode/vs/platform/dialogs/common/dialogs';
|
|
4
5
|
import { ILayoutService } from 'vscode/vscode/vs/platform/layout/browser/layoutService.service';
|
|
5
6
|
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
6
|
-
import Severity
|
|
7
|
-
import { Dialog } from 'vscode/vscode/vs/base/browser/ui/dialog/dialog';
|
|
7
|
+
import Severity from 'vscode/vscode/vs/base/common/severity';
|
|
8
|
+
import { Dialog } from '@codingame/monaco-vscode-44b92f80-48ea-5562-a8d0-18a015f8d845-common/vscode/vs/base/browser/ui/dialog/dialog';
|
|
8
9
|
import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
9
10
|
import { EventHelper } from 'vscode/vscode/vs/base/browser/dom';
|
|
10
11
|
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding.service';
|
|
@@ -14,6 +15,7 @@ import { fromNow } from 'vscode/vscode/vs/base/common/date';
|
|
|
14
15
|
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
15
16
|
import { MarkdownRenderer } from 'vscode/vscode/vs/editor/browser/widget/markdownRenderer/browser/markdownRenderer';
|
|
16
17
|
import { defaultButtonStyles, defaultCheckboxStyles, defaultInputBoxStyles, defaultDialogStyles } from 'vscode/vscode/vs/platform/theme/browser/defaultStyles';
|
|
18
|
+
import { ResultKind } from 'vscode/vscode/vs/platform/keybinding/common/keybindingResolver';
|
|
17
19
|
|
|
18
20
|
var BrowserDialogHandler_1;
|
|
19
21
|
let BrowserDialogHandler = class BrowserDialogHandler extends AbstractDialogHandler {
|
|
@@ -56,27 +58,27 @@ let BrowserDialogHandler = class BrowserDialogHandler extends AbstractDialogHand
|
|
|
56
58
|
}
|
|
57
59
|
async about() {
|
|
58
60
|
const detailString = (useAgo) => {
|
|
59
|
-
return
|
|
60
|
-
|
|
61
|
+
return localize(
|
|
62
|
+
2729,
|
|
61
63
|
"Version: {0}\nCommit: {1}\nDate: {2}\nBrowser: {3}",
|
|
62
64
|
this.productService.version || 'Unknown',
|
|
63
65
|
this.productService.commit || 'Unknown',
|
|
64
|
-
this.productService.date ? `${this.productService.date}${useAgo ? ' (' + fromNow((
|
|
66
|
+
this.productService.date ? `${this.productService.date}${useAgo ? ' (' + fromNow(( new Date(this.productService.date)), true) + ')' : ''}` : 'Unknown',
|
|
65
67
|
navigator.userAgent
|
|
66
|
-
)
|
|
68
|
+
);
|
|
67
69
|
};
|
|
68
70
|
const detail = detailString(true);
|
|
69
71
|
const detailToCopy = detailString(false);
|
|
70
|
-
const { button } = await this.doShow(Severity
|
|
71
|
-
( localize(
|
|
72
|
-
( localize(
|
|
72
|
+
const { button } = await this.doShow(Severity.Info, this.productService.nameLong, [
|
|
73
|
+
( localize(2730, "&&Copy")),
|
|
74
|
+
( localize(2731, "OK"))
|
|
73
75
|
], detail, 1);
|
|
74
76
|
if (button === 0) {
|
|
75
77
|
this.clipboardService.writeText(detailToCopy);
|
|
76
78
|
}
|
|
77
79
|
}
|
|
78
|
-
async doShow(type, message, buttons, detail, cancelId, checkbox, inputs, customOptions) {
|
|
79
|
-
const dialogDisposables = (
|
|
80
|
+
async doShow(type, message, buttons, detail, cancelId, checkbox, inputs, customOptions, cancellationToken) {
|
|
81
|
+
const dialogDisposables = ( new DisposableStore());
|
|
80
82
|
const renderBody = customOptions ? (parent) => {
|
|
81
83
|
parent.classList.add(...(customOptions.classes || []));
|
|
82
84
|
customOptions.markdownDetails?.forEach(markdownDetail => {
|
|
@@ -86,13 +88,13 @@ let BrowserDialogHandler = class BrowserDialogHandler extends AbstractDialogHand
|
|
|
86
88
|
dialogDisposables.add(result);
|
|
87
89
|
});
|
|
88
90
|
} : undefined;
|
|
89
|
-
const dialog = (
|
|
91
|
+
const dialog = ( new Dialog(this.layoutService.activeContainer, message, buttons, {
|
|
90
92
|
detail,
|
|
91
93
|
cancelId,
|
|
92
94
|
type: this.getDialogType(type),
|
|
93
95
|
keyEventProcessor: (event) => {
|
|
94
96
|
const resolved = this.keybindingService.softDispatch(event, this.layoutService.activeContainer);
|
|
95
|
-
if (resolved.kind ===
|
|
97
|
+
if (resolved.kind === ResultKind.KbFound && resolved.commandId) {
|
|
96
98
|
if (BrowserDialogHandler_1.ALLOWABLE_COMMANDS.indexOf(resolved.commandId) === -1) {
|
|
97
99
|
EventHelper.stop(event, true);
|
|
98
100
|
}
|
|
@@ -101,6 +103,7 @@ let BrowserDialogHandler = class BrowserDialogHandler extends AbstractDialogHand
|
|
|
101
103
|
renderBody,
|
|
102
104
|
icon: customOptions?.icon,
|
|
103
105
|
disableCloseAction: customOptions?.disableCloseAction,
|
|
106
|
+
closeOnLinkClick: customOptions?.closeOnLinkClick,
|
|
104
107
|
buttonDetails: customOptions?.buttonDetails,
|
|
105
108
|
checkboxLabel: checkbox?.label,
|
|
106
109
|
checkboxChecked: checkbox?.checked,
|
|
@@ -109,20 +112,20 @@ let BrowserDialogHandler = class BrowserDialogHandler extends AbstractDialogHand
|
|
|
109
112
|
checkboxStyles: defaultCheckboxStyles,
|
|
110
113
|
inputBoxStyles: defaultInputBoxStyles,
|
|
111
114
|
dialogStyles: defaultDialogStyles
|
|
112
|
-
}))
|
|
115
|
+
}));
|
|
113
116
|
dialogDisposables.add(dialog);
|
|
114
117
|
const result = await dialog.show();
|
|
115
118
|
dialogDisposables.dispose();
|
|
116
119
|
return result;
|
|
117
120
|
}
|
|
118
121
|
};
|
|
119
|
-
BrowserDialogHandler = BrowserDialogHandler_1 = (
|
|
120
|
-
(
|
|
121
|
-
(
|
|
122
|
-
(
|
|
123
|
-
(
|
|
124
|
-
(
|
|
125
|
-
(
|
|
126
|
-
], BrowserDialogHandler))
|
|
122
|
+
BrowserDialogHandler = BrowserDialogHandler_1 = ( __decorate([
|
|
123
|
+
( __param(0, ILogService)),
|
|
124
|
+
( __param(1, ILayoutService)),
|
|
125
|
+
( __param(2, IKeybindingService)),
|
|
126
|
+
( __param(3, IInstantiationService)),
|
|
127
|
+
( __param(4, IProductService)),
|
|
128
|
+
( __param(5, IClipboardService))
|
|
129
|
+
], BrowserDialogHandler));
|
|
127
130
|
|
|
128
131
|
export { BrowserDialogHandler };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Event } from "vscode/vscode/vs/base/common/event";
|
|
2
|
+
import { Disposable } from "vscode/vscode/vs/base/common/lifecycle";
|
|
3
|
+
import { IDialogArgs, IDialogResult } from "@codingame/monaco-vscode-d6e33d82-c101-549d-a885-0807ab3e0cfb-common/vscode/vs/platform/dialogs/common/dialogs";
|
|
4
|
+
export interface IDialogViewItem {
|
|
5
|
+
readonly args: IDialogArgs;
|
|
6
|
+
close(result?: IDialogResult | Error): void;
|
|
7
|
+
}
|
|
8
|
+
export interface IDialogHandle {
|
|
9
|
+
readonly item: IDialogViewItem;
|
|
10
|
+
readonly result: Promise<IDialogResult | undefined>;
|
|
11
|
+
}
|
|
12
|
+
export interface IDialogsModel {
|
|
13
|
+
readonly onWillShowDialog: Event<void>;
|
|
14
|
+
readonly onDidShowDialog: Event<void>;
|
|
15
|
+
readonly dialogs: IDialogViewItem[];
|
|
16
|
+
show(dialog: IDialogArgs): IDialogHandle;
|
|
17
|
+
}
|
|
18
|
+
export declare class DialogsModel extends Disposable implements IDialogsModel {
|
|
19
|
+
readonly dialogs: IDialogViewItem[];
|
|
20
|
+
private readonly _onWillShowDialog;
|
|
21
|
+
readonly onWillShowDialog: Event<void>;
|
|
22
|
+
private readonly _onDidShowDialog;
|
|
23
|
+
readonly onDidShowDialog: Event<void>;
|
|
24
|
+
show(dialog: IDialogArgs): IDialogHandle;
|
|
25
|
+
}
|
|
@@ -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 = ".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
4
|
n(css,{});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
|
|
3
|
+
import { LifecyclePhase } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
|
|
2
4
|
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
3
5
|
import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
6
|
+
import { StorageScope } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
4
7
|
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
5
8
|
import { IBrowserWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/browser/environmentService.service';
|
|
6
9
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
@@ -13,7 +16,7 @@ import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/comma
|
|
|
13
16
|
import { WelcomeWidget } from './welcomeWidget.js';
|
|
14
17
|
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
15
18
|
import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener.service';
|
|
16
|
-
import { Extensions as Extensions$1 } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
|
|
19
|
+
import { Extensions as Extensions$1, ConfigurationScope } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
|
|
17
20
|
import { localize } from 'vscode/vscode/vs/nls';
|
|
18
21
|
import { applicationConfigurationNodeBase } from 'vscode/vscode/vs/workbench/common/configuration';
|
|
19
22
|
import { RunOnceScheduler } from 'vscode/vscode/vs/base/common/async';
|
|
@@ -24,7 +27,7 @@ let WelcomeDialogContribution = class WelcomeDialogContribution extends Disposab
|
|
|
24
27
|
constructor(storageService, environmentService, configurationService, contextService, codeEditorService, instantiationService, commandService, telemetryService, openerService, editorService) {
|
|
25
28
|
super();
|
|
26
29
|
this.isRendered = false;
|
|
27
|
-
if (!storageService.isNew(
|
|
30
|
+
if (!storageService.isNew(StorageScope.APPLICATION)) {
|
|
28
31
|
return;
|
|
29
32
|
}
|
|
30
33
|
const setting = configurationService.inspect(configurationKey);
|
|
@@ -39,21 +42,21 @@ let WelcomeDialogContribution = class WelcomeDialogContribution extends Disposab
|
|
|
39
42
|
if (!this.isRendered) {
|
|
40
43
|
const codeEditor = codeEditorService.getActiveCodeEditor();
|
|
41
44
|
if (codeEditor?.hasModel()) {
|
|
42
|
-
const scheduler = (
|
|
45
|
+
const scheduler = ( new RunOnceScheduler(() => {
|
|
43
46
|
const notificationsVisible = contextService.contextMatchesRules(ContextKeyExpr.deserialize('notificationCenterVisible')) ||
|
|
44
47
|
contextService.contextMatchesRules(ContextKeyExpr.deserialize('notificationToastsVisible'));
|
|
45
48
|
if (codeEditor === codeEditorService.getActiveCodeEditor() && !notificationsVisible) {
|
|
46
49
|
this.isRendered = true;
|
|
47
|
-
const welcomeWidget = (
|
|
50
|
+
const welcomeWidget = ( new WelcomeWidget(
|
|
48
51
|
codeEditor,
|
|
49
52
|
instantiationService,
|
|
50
53
|
commandService,
|
|
51
54
|
telemetryService,
|
|
52
55
|
openerService
|
|
53
|
-
))
|
|
56
|
+
));
|
|
54
57
|
welcomeWidget.render(welcomeDialog.title, welcomeDialog.message, welcomeDialog.buttonText, welcomeDialog.buttonCommand);
|
|
55
58
|
}
|
|
56
|
-
}, 3000))
|
|
59
|
+
}, 3000));
|
|
57
60
|
this._register(codeEditor.onDidChangeModelContent((e) => {
|
|
58
61
|
if (!this.isRendered) {
|
|
59
62
|
scheduler.schedule();
|
|
@@ -64,30 +67,30 @@ let WelcomeDialogContribution = class WelcomeDialogContribution extends Disposab
|
|
|
64
67
|
}));
|
|
65
68
|
}
|
|
66
69
|
};
|
|
67
|
-
WelcomeDialogContribution = (
|
|
68
|
-
(
|
|
69
|
-
(
|
|
70
|
-
(
|
|
71
|
-
(
|
|
72
|
-
(
|
|
73
|
-
(
|
|
74
|
-
(
|
|
75
|
-
(
|
|
76
|
-
(
|
|
77
|
-
(
|
|
78
|
-
], WelcomeDialogContribution))
|
|
79
|
-
(
|
|
80
|
-
.registerWorkbenchContribution(WelcomeDialogContribution,
|
|
81
|
-
const configurationRegistry = (
|
|
70
|
+
WelcomeDialogContribution = ( __decorate([
|
|
71
|
+
( __param(0, IStorageService)),
|
|
72
|
+
( __param(1, IBrowserWorkbenchEnvironmentService)),
|
|
73
|
+
( __param(2, IConfigurationService)),
|
|
74
|
+
( __param(3, IContextKeyService)),
|
|
75
|
+
( __param(4, ICodeEditorService)),
|
|
76
|
+
( __param(5, IInstantiationService)),
|
|
77
|
+
( __param(6, ICommandService)),
|
|
78
|
+
( __param(7, ITelemetryService)),
|
|
79
|
+
( __param(8, IOpenerService)),
|
|
80
|
+
( __param(9, IEditorService))
|
|
81
|
+
], WelcomeDialogContribution));
|
|
82
|
+
( Registry.as(Extensions.Workbench))
|
|
83
|
+
.registerWorkbenchContribution(WelcomeDialogContribution, LifecyclePhase.Eventually);
|
|
84
|
+
const configurationRegistry = ( Registry.as(Extensions$1.Configuration));
|
|
82
85
|
configurationRegistry.registerConfiguration({
|
|
83
86
|
...applicationConfigurationNodeBase,
|
|
84
87
|
properties: {
|
|
85
88
|
'workbench.welcome.experimental.dialog': {
|
|
86
|
-
scope:
|
|
89
|
+
scope: ConfigurationScope.APPLICATION,
|
|
87
90
|
type: 'boolean',
|
|
88
91
|
default: false,
|
|
89
92
|
tags: ['experimental'],
|
|
90
|
-
description: ( localize(
|
|
93
|
+
description: ( localize(10717, "When enabled, a welcome widget is shown in the editor"))
|
|
91
94
|
}
|
|
92
95
|
}
|
|
93
96
|
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Disposable } from "vscode/vscode/vs/base/common/lifecycle";
|
|
2
|
+
import { ICodeEditor, IOverlayWidget, IOverlayWidgetPosition } from "vscode/vscode/vs/editor/browser/editorBrowser";
|
|
3
|
+
import { IInstantiationService } from "vscode/vscode/vs/platform/instantiation/common/instantiation";
|
|
4
|
+
import { ICommandService } from "vscode/vscode/vs/platform/commands/common/commands.service";
|
|
5
|
+
import { ITelemetryService } from "vscode/vscode/vs/platform/telemetry/common/telemetry.service";
|
|
6
|
+
import { IOpenerService } from "vscode/vscode/vs/platform/opener/common/opener.service";
|
|
7
|
+
export declare class WelcomeWidget extends Disposable implements IOverlayWidget {
|
|
8
|
+
private readonly _editor;
|
|
9
|
+
private readonly instantiationService;
|
|
10
|
+
private readonly commandService;
|
|
11
|
+
private readonly telemetryService;
|
|
12
|
+
private readonly openerService;
|
|
13
|
+
private readonly _rootDomNode;
|
|
14
|
+
private readonly element;
|
|
15
|
+
private readonly messageContainer;
|
|
16
|
+
private readonly markdownRenderer;
|
|
17
|
+
constructor(_editor: ICodeEditor, instantiationService: IInstantiationService, commandService: ICommandService, telemetryService: ITelemetryService, openerService: IOpenerService);
|
|
18
|
+
executeCommand(commandId: string, ...args: string[]): Promise<void>;
|
|
19
|
+
render(title: string, message: string, buttonText: string, buttonAction: string): Promise<void>;
|
|
20
|
+
private buildWidgetContent;
|
|
21
|
+
private buildStepMarkdownDescription;
|
|
22
|
+
getId(): string;
|
|
23
|
+
getDomNode(): HTMLElement;
|
|
24
|
+
getPosition(): IOverlayWidgetPosition | null;
|
|
25
|
+
private _isVisible;
|
|
26
|
+
private _show;
|
|
27
|
+
private _hide;
|
|
28
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
|
|
1
2
|
import './media/welcomeWidget.css.js';
|
|
2
3
|
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
|
+
import { OverlayWidgetPositionPreference } from 'vscode/vscode/vs/editor/browser/editorBrowser';
|
|
3
5
|
import { $, hide, append } from 'vscode/vscode/vs/base/browser/dom';
|
|
4
6
|
import { MarkdownString } from 'vscode/vscode/vs/base/common/htmlContent';
|
|
5
7
|
import { MarkdownRenderer } from 'vscode/vscode/vs/editor/browser/widget/markdownRenderer/browser/markdownRenderer';
|
|
@@ -69,13 +71,13 @@ class WelcomeWidget extends Disposable {
|
|
|
69
71
|
});
|
|
70
72
|
}
|
|
71
73
|
async buildWidgetContent(title, message, buttonText, buttonAction) {
|
|
72
|
-
const actionBar = this._register((
|
|
73
|
-
const action = this._register((
|
|
74
|
+
const actionBar = this._register(( new ActionBar(this.element, {})));
|
|
75
|
+
const action = this._register(( new Action('dialog.close', ( localize(10718, "Close Dialog")), ThemeIcon.asClassName(Codicon.dialogClose), true, async () => {
|
|
74
76
|
this._hide();
|
|
75
|
-
})))
|
|
77
|
+
})));
|
|
76
78
|
actionBar.push(action, { icon: true, label: false });
|
|
77
79
|
const renderBody = (message, icon) => {
|
|
78
|
-
const mds = (
|
|
80
|
+
const mds = ( new MarkdownString(undefined, { supportThemeIcons: true, supportHtml: true }));
|
|
79
81
|
mds.appendMarkdown(`<a class="copilot">$(${icon})</a>`);
|
|
80
82
|
mds.appendMarkdown(message);
|
|
81
83
|
return mds;
|
|
@@ -83,10 +85,10 @@ class WelcomeWidget extends Disposable {
|
|
|
83
85
|
const titleElement = this.messageContainer.appendChild($('#monaco-dialog-message-detail.dialog-message-detail-title'));
|
|
84
86
|
const titleElementMdt = this.markdownRenderer.render(renderBody(title, 'zap'));
|
|
85
87
|
titleElement.appendChild(titleElementMdt.element);
|
|
86
|
-
this.buildStepMarkdownDescription(this.messageContainer, (
|
|
88
|
+
this.buildStepMarkdownDescription(this.messageContainer, ( message.split('\n').filter(x => x).map(text => parseLinkedText(text))));
|
|
87
89
|
const buttonsRowElement = this.messageContainer.appendChild($('.dialog-buttons-row'));
|
|
88
90
|
const buttonContainer = buttonsRowElement.appendChild($('.dialog-buttons'));
|
|
89
|
-
const buttonBar = this._register((
|
|
91
|
+
const buttonBar = this._register(( new ButtonBar(buttonContainer)));
|
|
90
92
|
const primaryButton = this._register(buttonBar.addButtonWithDescription({ title: true, secondary: false, ...defaultButtonStyles }));
|
|
91
93
|
primaryButton.label = mnemonicButtonLabel(buttonText, true);
|
|
92
94
|
this._register(primaryButton.onDidClick(async () => {
|
|
@@ -133,7 +135,7 @@ class WelcomeWidget extends Disposable {
|
|
|
133
135
|
}
|
|
134
136
|
getPosition() {
|
|
135
137
|
return {
|
|
136
|
-
preference:
|
|
138
|
+
preference: OverlayWidgetPositionPreference.TOP_RIGHT_CORNER
|
|
137
139
|
};
|
|
138
140
|
}
|
|
139
141
|
_show() {
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { IPickAndOpenOptions, ISaveDialogOptions, IOpenDialogOptions, ConfirmResult } from "@codingame/monaco-vscode-d6e33d82-c101-549d-a885-0807ab3e0cfb-common/vscode/vs/platform/dialogs/common/dialogs";
|
|
2
|
+
import { IFileDialogService } from "vscode/vscode/vs/platform/dialogs/common/dialogs.service";
|
|
3
|
+
import { IDialogService } from "vscode/vscode/vs/platform/dialogs/common/dialogs.service";
|
|
4
|
+
import { IWorkspaceContextService } from "vscode/vscode/vs/platform/workspace/common/workspace.service";
|
|
5
|
+
import { IHistoryService } from "vscode/vscode/vs/workbench/services/history/common/history.service";
|
|
6
|
+
import { IWorkbenchEnvironmentService } from "vscode/vscode/vs/workbench/services/environment/common/environmentService.service";
|
|
7
|
+
import { URI } from "vscode/vscode/vs/base/common/uri";
|
|
8
|
+
import { IInstantiationService } from "vscode/vscode/vs/platform/instantiation/common/instantiation";
|
|
9
|
+
import { ISimpleFileDialog } from "./simpleFileDialog.js";
|
|
10
|
+
import { IWorkspacesService } from "vscode/vscode/vs/platform/workspaces/common/workspaces.service";
|
|
11
|
+
import { IConfigurationService } from "vscode/vscode/vs/platform/configuration/common/configuration.service";
|
|
12
|
+
import { IFileService } from "vscode/vscode/vs/platform/files/common/files.service";
|
|
13
|
+
import { IOpenerService } from "vscode/vscode/vs/platform/opener/common/opener.service";
|
|
14
|
+
import { IHostService } from "vscode/vscode/vs/workbench/services/host/browser/host.service";
|
|
15
|
+
import { ILanguageService } from "vscode/vscode/vs/editor/common/languages/language";
|
|
16
|
+
import { ILabelService } from "vscode/vscode/vs/platform/label/common/label.service";
|
|
17
|
+
import { IPathService } from "vscode/vscode/vs/workbench/services/path/common/pathService.service";
|
|
18
|
+
import { ICommandService } from "vscode/vscode/vs/platform/commands/common/commands.service";
|
|
19
|
+
import { ICodeEditorService } from "vscode/vscode/vs/editor/browser/services/codeEditorService";
|
|
20
|
+
import { IEditorService } from "vscode/vscode/vs/workbench/services/editor/common/editorService.service";
|
|
21
|
+
import { ILogService } from "vscode/vscode/vs/platform/log/common/log.service";
|
|
22
|
+
export declare abstract class AbstractFileDialogService implements IFileDialogService {
|
|
23
|
+
protected readonly hostService: IHostService;
|
|
24
|
+
protected readonly contextService: IWorkspaceContextService;
|
|
25
|
+
protected readonly historyService: IHistoryService;
|
|
26
|
+
protected readonly environmentService: IWorkbenchEnvironmentService;
|
|
27
|
+
protected readonly instantiationService: IInstantiationService;
|
|
28
|
+
protected readonly configurationService: IConfigurationService;
|
|
29
|
+
protected readonly fileService: IFileService;
|
|
30
|
+
protected readonly openerService: IOpenerService;
|
|
31
|
+
protected readonly dialogService: IDialogService;
|
|
32
|
+
private readonly languageService;
|
|
33
|
+
private readonly workspacesService;
|
|
34
|
+
private readonly labelService;
|
|
35
|
+
private readonly pathService;
|
|
36
|
+
protected readonly commandService: ICommandService;
|
|
37
|
+
protected readonly editorService: IEditorService;
|
|
38
|
+
protected readonly codeEditorService: ICodeEditorService;
|
|
39
|
+
protected readonly logService: ILogService;
|
|
40
|
+
readonly _serviceBrand: undefined;
|
|
41
|
+
constructor(hostService: IHostService, contextService: IWorkspaceContextService, historyService: IHistoryService, environmentService: IWorkbenchEnvironmentService, instantiationService: IInstantiationService, configurationService: IConfigurationService, fileService: IFileService, openerService: IOpenerService, dialogService: IDialogService, languageService: ILanguageService, workspacesService: IWorkspacesService, labelService: ILabelService, pathService: IPathService, commandService: ICommandService, editorService: IEditorService, codeEditorService: ICodeEditorService, logService: ILogService);
|
|
42
|
+
defaultFilePath(schemeFilter?: string, authorityFilter?: string | undefined): Promise<URI>;
|
|
43
|
+
defaultFolderPath(schemeFilter?: string, authorityFilter?: string | undefined): Promise<URI>;
|
|
44
|
+
preferredHome(schemeFilter?: string): Promise<URI>;
|
|
45
|
+
defaultWorkspacePath(schemeFilter?: string): Promise<URI>;
|
|
46
|
+
showSaveConfirm(fileNamesOrResources: (string | URI)[]): Promise<ConfirmResult>;
|
|
47
|
+
private skipDialogs;
|
|
48
|
+
private doShowSaveConfirm;
|
|
49
|
+
protected addFileSchemaIfNeeded(schema: string, _isFolder?: boolean): string[];
|
|
50
|
+
protected pickFileFolderAndOpenSimplified(schema: string, options: IPickAndOpenOptions, preferNewWindow: boolean): Promise<void>;
|
|
51
|
+
protected pickFileAndOpenSimplified(schema: string, options: IPickAndOpenOptions, preferNewWindow: boolean): Promise<void>;
|
|
52
|
+
protected addFileToRecentlyOpened(uri: URI): void;
|
|
53
|
+
protected pickFolderAndOpenSimplified(schema: string, options: IPickAndOpenOptions): Promise<void>;
|
|
54
|
+
protected pickWorkspaceAndOpenSimplified(schema: string, options: IPickAndOpenOptions): Promise<void>;
|
|
55
|
+
protected pickFileToSaveSimplified(schema: string, options: ISaveDialogOptions): Promise<URI | undefined>;
|
|
56
|
+
protected showSaveDialogSimplified(schema: string, options: ISaveDialogOptions): Promise<URI | undefined>;
|
|
57
|
+
protected showOpenDialogSimplified(schema: string, options: IOpenDialogOptions): Promise<URI[] | undefined>;
|
|
58
|
+
protected getSimpleFileDialog(): ISimpleFileDialog;
|
|
59
|
+
private pickResource;
|
|
60
|
+
private saveRemoteResource;
|
|
61
|
+
private getSchemeFilterForWindow;
|
|
62
|
+
private getAuthorityFilterForWindow;
|
|
63
|
+
protected getFileSystemSchema(options: {
|
|
64
|
+
availableFileSystems?: readonly string[];
|
|
65
|
+
defaultUri?: URI;
|
|
66
|
+
}): string;
|
|
67
|
+
abstract pickFileFolderAndOpen(options: IPickAndOpenOptions): Promise<void>;
|
|
68
|
+
abstract pickFileAndOpen(options: IPickAndOpenOptions): Promise<void>;
|
|
69
|
+
abstract pickFolderAndOpen(options: IPickAndOpenOptions): Promise<void>;
|
|
70
|
+
abstract pickWorkspaceAndOpen(options: IPickAndOpenOptions): Promise<void>;
|
|
71
|
+
protected getWorkspaceAvailableFileSystems(options: IPickAndOpenOptions): string[];
|
|
72
|
+
abstract showSaveDialog(options: ISaveDialogOptions): Promise<URI | undefined>;
|
|
73
|
+
abstract showOpenDialog(options: IOpenDialogOptions): Promise<URI[] | undefined>;
|
|
74
|
+
abstract pickFileToSave(defaultUri: URI, availableFileSystems?: string[]): Promise<URI | undefined>;
|
|
75
|
+
protected getPickFileToSaveDialogOptions(defaultUri: URI, availableFileSystems?: string[]): ISaveDialogOptions;
|
|
76
|
+
}
|