@codingame/monaco-vscode-relauncher-service-override 4.1.0 → 4.1.2

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.
@@ -0,0 +1,11 @@
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 };
@@ -0,0 +1,10 @@
1
+ export { AbstractDialogHandler, IDialogService, IFileDialogService, getFileNamesMessage } from 'vscode/vscode/vs/platform/dialogs/common/dialogs';
2
+
3
+ var ConfirmResult;
4
+ ( (function(ConfirmResult) {
5
+ ConfirmResult[ConfirmResult["SAVE"] = 0] = "SAVE";
6
+ ConfirmResult[ConfirmResult["DONT_SAVE"] = 1] = "DONT_SAVE";
7
+ ConfirmResult[ConfirmResult["CANCEL"] = 2] = "CANCEL";
8
+ })(ConfirmResult || (ConfirmResult = {})));
9
+
10
+ export { ConfirmResult };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-relauncher-service-override",
3
- "version": "4.1.0",
3
+ "version": "4.1.2",
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.1.0"
21
+ "vscode": "npm:@codingame/monaco-vscode-api@4.1.2"
22
22
  }
23
23
  }
package/relauncher.js CHANGED
@@ -1,4 +1,4 @@
1
- import 'vscode/vscode/vs/workbench/contrib/relauncher/browser/relauncher.contribution';
1
+ import './vscode/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.js';
2
2
 
3
3
  function getServiceOverride() {
4
4
  return {};
@@ -0,0 +1,208 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { Disposable, toDisposable, dispose } from 'vscode/vscode/vs/base/common/lifecycle';
3
+ import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
4
+ import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
5
+ import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host';
6
+ import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
7
+ import { localizeWithPath } from 'vscode/vscode/vs/nls';
8
+ import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
9
+ import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
10
+ import { RunOnceScheduler } from 'vscode/vscode/vs/base/common/async';
11
+ import { isEqual } from 'vscode/vscode/vs/base/common/resources';
12
+ import { isNative, isMacintosh, isLinux } from 'vscode/vscode/vs/base/common/platform';
13
+ import '../../../../../../../override/vs/platform/dialogs/common/dialogs.js';
14
+ import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService';
15
+ import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService';
16
+ import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs';
17
+
18
+ var SettingsChangeRelauncher_1;
19
+ let SettingsChangeRelauncher = class SettingsChangeRelauncher extends Disposable {
20
+ static { SettingsChangeRelauncher_1 = this; }
21
+ static { this.SETTINGS = [
22
+ "window.titleBarStyle" ,
23
+ 'window.nativeTabs',
24
+ 'window.nativeFullScreen',
25
+ 'window.clickThroughInactive',
26
+ 'update.mode',
27
+ 'editor.accessibilitySupport',
28
+ 'security.workspace.trust.enabled',
29
+ 'workbench.enableExperiments',
30
+ '_extensionsGallery.enablePPE',
31
+ 'security.restrictUNCAccess'
32
+ ]; }
33
+ constructor(hostService, configurationService, productService, dialogService) {
34
+ super();
35
+ this.hostService = hostService;
36
+ this.configurationService = configurationService;
37
+ this.productService = productService;
38
+ this.dialogService = dialogService;
39
+ this.titleBarStyle = ( new ChangeObserver('string'));
40
+ this.nativeTabs = ( new ChangeObserver('boolean'));
41
+ this.nativeFullScreen = ( new ChangeObserver('boolean'));
42
+ this.clickThroughInactive = ( new ChangeObserver('boolean'));
43
+ this.updateMode = ( new ChangeObserver('string'));
44
+ this.workspaceTrustEnabled = ( new ChangeObserver('boolean'));
45
+ this.experimentsEnabled = ( new ChangeObserver('boolean'));
46
+ this.enablePPEExtensionsGallery = ( new ChangeObserver('boolean'));
47
+ this.restrictUNCAccess = ( new ChangeObserver('boolean'));
48
+ this.onConfigurationChange(undefined);
49
+ this._register(this.configurationService.onDidChangeConfiguration(e => this.onConfigurationChange(e)));
50
+ }
51
+ onConfigurationChange(e) {
52
+ if (e && !( SettingsChangeRelauncher_1.SETTINGS.some(key => e.affectsConfiguration(key)))) {
53
+ return;
54
+ }
55
+ let changed = false;
56
+ function processChanged(didChange) {
57
+ changed = changed || didChange;
58
+ }
59
+ const config = this.configurationService.getValue();
60
+ if (isNative) {
61
+ processChanged(((config.window.titleBarStyle === "native" || config.window.titleBarStyle === "custom") ) && this.titleBarStyle.handleChange(config.window?.titleBarStyle));
62
+ processChanged(isMacintosh && this.nativeTabs.handleChange(config.window?.nativeTabs));
63
+ processChanged(isMacintosh && this.nativeFullScreen.handleChange(config.window?.nativeFullScreen));
64
+ processChanged(isMacintosh && this.clickThroughInactive.handleChange(config.window?.clickThroughInactive));
65
+ processChanged(this.updateMode.handleChange(config.update?.mode));
66
+ if (isLinux && typeof config.editor?.accessibilitySupport === 'string' && config.editor.accessibilitySupport !== this.accessibilitySupport) {
67
+ this.accessibilitySupport = config.editor.accessibilitySupport;
68
+ if (this.accessibilitySupport === 'on') {
69
+ changed = true;
70
+ }
71
+ }
72
+ processChanged(this.workspaceTrustEnabled.handleChange(config?.security?.workspace?.trust?.enabled));
73
+ processChanged(this.restrictUNCAccess.handleChange(config?.security?.restrictUNCAccess));
74
+ }
75
+ processChanged(this.experimentsEnabled.handleChange(config.workbench?.enableExperiments));
76
+ processChanged(this.productService.quality !== 'stable' && this.enablePPEExtensionsGallery.handleChange(config._extensionsGallery?.enablePPE));
77
+ if (changed && e && e.source !== 7 ) {
78
+ this.doConfirm(isNative ?
79
+ ( localizeWithPath(
80
+ 'vs/workbench/contrib/relauncher/browser/relauncher.contribution',
81
+ 'relaunchSettingMessage',
82
+ "A setting has changed that requires a restart to take effect."
83
+ )) :
84
+ ( localizeWithPath(
85
+ 'vs/workbench/contrib/relauncher/browser/relauncher.contribution',
86
+ 'relaunchSettingMessageWeb',
87
+ "A setting has changed that requires a reload to take effect."
88
+ )), isNative ?
89
+ ( localizeWithPath(
90
+ 'vs/workbench/contrib/relauncher/browser/relauncher.contribution',
91
+ 'relaunchSettingDetail',
92
+ "Press the restart button to restart {0} and enable the setting.",
93
+ this.productService.nameLong
94
+ )) :
95
+ ( localizeWithPath(
96
+ 'vs/workbench/contrib/relauncher/browser/relauncher.contribution',
97
+ 'relaunchSettingDetailWeb',
98
+ "Press the reload button to reload {0} and enable the setting.",
99
+ this.productService.nameLong
100
+ )), isNative ?
101
+ ( localizeWithPath(
102
+ 'vs/workbench/contrib/relauncher/browser/relauncher.contribution',
103
+ { key: 'restart', comment: ['&& denotes a mnemonic'] },
104
+ "&&Restart"
105
+ )) :
106
+ ( localizeWithPath(
107
+ 'vs/workbench/contrib/relauncher/browser/relauncher.contribution',
108
+ { key: 'restartWeb', comment: ['&& denotes a mnemonic'] },
109
+ "&&Reload"
110
+ )), () => this.hostService.restart());
111
+ }
112
+ }
113
+ async doConfirm(message, detail, primaryButton, confirmedFn) {
114
+ if (this.hostService.hasFocus) {
115
+ const { confirmed } = await this.dialogService.confirm({ message, detail, primaryButton });
116
+ if (confirmed) {
117
+ confirmedFn();
118
+ }
119
+ }
120
+ }
121
+ };
122
+ SettingsChangeRelauncher = SettingsChangeRelauncher_1 = ( __decorate([
123
+ ( __param(0, IHostService)),
124
+ ( __param(1, IConfigurationService)),
125
+ ( __param(2, IProductService)),
126
+ ( __param(3, IDialogService))
127
+ ], SettingsChangeRelauncher));
128
+ class ChangeObserver {
129
+ static create(typeName) {
130
+ return ( new ChangeObserver(typeName));
131
+ }
132
+ constructor(typeName) {
133
+ this.typeName = typeName;
134
+ this.lastValue = undefined;
135
+ }
136
+ handleChange(value) {
137
+ if (typeof value === this.typeName && value !== this.lastValue) {
138
+ this.lastValue = value;
139
+ return true;
140
+ }
141
+ return false;
142
+ }
143
+ }
144
+ let WorkspaceChangeExtHostRelauncher = class WorkspaceChangeExtHostRelauncher extends Disposable {
145
+ constructor(contextService, extensionService, hostService, environmentService) {
146
+ super();
147
+ this.contextService = contextService;
148
+ this.extensionHostRestarter = this._register(( new RunOnceScheduler(async () => {
149
+ if (!!environmentService.extensionTestsLocationURI) {
150
+ return;
151
+ }
152
+ if (environmentService.remoteAuthority) {
153
+ hostService.reload();
154
+ }
155
+ else if (isNative) {
156
+ const stopped = await extensionService.stopExtensionHosts(( localizeWithPath(
157
+ 'vs/workbench/contrib/relauncher/browser/relauncher.contribution',
158
+ 'restartExtensionHost.reason',
159
+ "Restarting extension host due to a workspace folder change."
160
+ )));
161
+ if (stopped) {
162
+ extensionService.startExtensionHosts();
163
+ }
164
+ }
165
+ }, 10)));
166
+ this.contextService.getCompleteWorkspace()
167
+ .then(workspace => {
168
+ this.firstFolderResource = workspace.folders.length > 0 ? workspace.folders[0].uri : undefined;
169
+ this.handleWorkbenchState();
170
+ this._register(this.contextService.onDidChangeWorkbenchState(() => setTimeout(() => this.handleWorkbenchState())));
171
+ });
172
+ this._register(toDisposable(() => {
173
+ this.onDidChangeWorkspaceFoldersUnbind?.dispose();
174
+ }));
175
+ }
176
+ handleWorkbenchState() {
177
+ if (this.contextService.getWorkbenchState() === 3 ) {
178
+ const workspace = this.contextService.getWorkspace();
179
+ this.firstFolderResource = workspace.folders.length > 0 ? workspace.folders[0].uri : undefined;
180
+ if (!this.onDidChangeWorkspaceFoldersUnbind) {
181
+ this.onDidChangeWorkspaceFoldersUnbind = this.contextService.onDidChangeWorkspaceFolders(() => this.onDidChangeWorkspaceFolders());
182
+ }
183
+ }
184
+ else {
185
+ dispose(this.onDidChangeWorkspaceFoldersUnbind);
186
+ this.onDidChangeWorkspaceFoldersUnbind = undefined;
187
+ }
188
+ }
189
+ onDidChangeWorkspaceFolders() {
190
+ const workspace = this.contextService.getWorkspace();
191
+ const newFirstFolderResource = workspace.folders.length > 0 ? workspace.folders[0].uri : undefined;
192
+ if (!isEqual(this.firstFolderResource, newFirstFolderResource)) {
193
+ this.firstFolderResource = newFirstFolderResource;
194
+ this.extensionHostRestarter.schedule();
195
+ }
196
+ }
197
+ };
198
+ WorkspaceChangeExtHostRelauncher = ( __decorate([
199
+ ( __param(0, IWorkspaceContextService)),
200
+ ( __param(1, IExtensionService)),
201
+ ( __param(2, IHostService)),
202
+ ( __param(3, IWorkbenchEnvironmentService))
203
+ ], WorkspaceChangeExtHostRelauncher));
204
+ const workbenchRegistry = ( Registry.as(Extensions.Workbench));
205
+ workbenchRegistry.registerWorkbenchContribution(SettingsChangeRelauncher, 3 );
206
+ workbenchRegistry.registerWorkbenchContribution(WorkspaceChangeExtHostRelauncher, 3 );
207
+
208
+ export { SettingsChangeRelauncher, WorkspaceChangeExtHostRelauncher };