@codingame/monaco-vscode-api 4.0.0 → 4.1.1

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/README.md CHANGED
@@ -236,6 +236,8 @@ Additionally, several packages that include the VSCode version of some services
236
236
  - Survey/feedback support
237
237
  - **Update**
238
238
  - Update detection, release notes...
239
+ - **Localization**
240
+ - Register callbacks to update the display language from the VSCode UI (either from the `Set Display Language` command or from the extension gallery extension packs)
239
241
 
240
242
  Usage:
241
243
 
package/l10n.d.ts CHANGED
@@ -1,4 +1,7 @@
1
- declare function registerLocalization(language: string, main: Record<string, Record<string, string>>, extensionTranslationsUris: Record<string, string>): void;
1
+ declare function setAvailableLocales(locales: Set<string>): void;
2
+ declare function isLocaleAvailable(locale: string): boolean;
3
+ declare function registerLocalization(extensionId: string, language: string, main: Record<string, Record<string, string>>, extensionTranslationsUris: Record<string, string>): void;
2
4
  declare function getBuiltInExtensionTranslationsUris(language: string): Record<string, string> | undefined;
5
+ declare function getExtensionIdProvidingCurrentLocale(): string | undefined;
3
6
 
4
- export { getBuiltInExtensionTranslationsUris, registerLocalization };
7
+ export { getBuiltInExtensionTranslationsUris, getExtensionIdProvidingCurrentLocale, isLocaleAvailable, registerLocalization, setAvailableLocales };
package/l10n.js CHANGED
@@ -1,13 +1,25 @@
1
1
  import { isInitialized, setLocale } from './vscode/src/vs/nls.js';
2
2
  const extensionTranslationsUri = {};
3
- function registerLocalization(language, main, extensionTranslationsUris) {
3
+ let currentLocaleExtensionId;
4
+ let availableLocales = new Set();
5
+ function setAvailableLocales(locales) {
6
+ availableLocales = locales;
7
+ }
8
+ function isLocaleAvailable(locale) {
9
+ return ( availableLocales.has(locale));
10
+ }
11
+ function registerLocalization(extensionId, language, main, extensionTranslationsUris) {
4
12
  if (isInitialized()) {
5
13
  console.error('Some parts of VSCode are already initialized, make sure the language pack is loaded before anything else or some translations will be missing');
6
14
  }
7
15
  setLocale(language, main);
8
16
  extensionTranslationsUri[language] = extensionTranslationsUris;
17
+ currentLocaleExtensionId = extensionId;
9
18
  }
10
19
  function getBuiltInExtensionTranslationsUris(language) {
11
20
  return extensionTranslationsUri[language];
12
21
  }
13
- export { getBuiltInExtensionTranslationsUris, registerLocalization };
22
+ function getExtensionIdProvidingCurrentLocale() {
23
+ return currentLocaleExtensionId;
24
+ }
25
+ export { getBuiltInExtensionTranslationsUris, getExtensionIdProvidingCurrentLocale, isLocaleAvailable, registerLocalization, setAvailableLocales };
@@ -198,7 +198,9 @@ import { IAuthenticationAccessService } from './vscode/src/vs/workbench/services
198
198
  import { IAuthenticationUsageService } from './vscode/src/vs/workbench/services/authentication/browser/authenticationUsageService.js';
199
199
  import { ICustomEditorLabelService } from './vscode/src/vs/workbench/services/editor/common/customEditorLabelService.js';
200
200
  import { IExtensionsProfileScannerService } from './vscode/src/vs/platform/extensionManagement/common/extensionsProfileScannerService.js';
201
- import { getBuiltInExtensionTranslationsUris } from './l10n.js';
201
+ import { createInstanceCapabilityEventMultiplexer } from './vscode/src/vs/workbench/contrib/terminal/browser/terminalEvents.js';
202
+ import { ITroubleshootIssueService } from './vscode/src/vs/workbench/services/issue/browser/issueTroubleshoot.js';
203
+ import { getExtensionIdProvidingCurrentLocale, getBuiltInExtensionTranslationsUris } from './l10n.js';
202
204
  import { unsupported } from './tools.js';
203
205
  import { IFileDialogService } from './vscode/src/vs/platform/dialogs/common/dialogs.js';
204
206
  var _a;
@@ -1599,10 +1601,8 @@ registerSingleton(ITerminalService, class TerminalService {
1599
1601
  this.onAnyInstanceProcessIdReady = Event.None;
1600
1602
  this.onAnyInstanceSelectionChange = Event.None;
1601
1603
  this.onAnyInstanceTitleChange = Event.None;
1602
- this.createOnInstanceEvent = unsupported;
1603
- this.createOnInstanceCapabilityEvent = unsupported;
1604
- this.onInstanceEvent = unsupported;
1605
- this.onInstanceCapabilityEvent = unsupported;
1604
+ this.createOnInstanceEvent = () => Event.None;
1605
+ this.createOnInstanceCapabilityEvent = (capabilityId) => createInstanceCapabilityEventMultiplexer([], Event.None, Event.None, capabilityId, () => Event.None);
1606
1606
  this.createDetachedTerminal = unsupported;
1607
1607
  this.onDidChangeSelection = Event.None;
1608
1608
  this.detachedXterms = [];
@@ -2388,8 +2388,8 @@ registerSingleton(IInteractiveDocumentService, class InteractiveDocumentService
2388
2388
  }
2389
2389
  }, 1 );
2390
2390
  registerSingleton(IActiveLanguagePackService, class ActiveLanguagePackService {
2391
- getExtensionIdProvidingCurrentLocale() {
2392
- return Promise.resolve(undefined);
2391
+ async getExtensionIdProvidingCurrentLocale() {
2392
+ return getExtensionIdProvidingCurrentLocale();
2393
2393
  }
2394
2394
  }, 0 );
2395
2395
  registerSingleton(IRemoteUserDataProfilesService, class RemoteUserDataProfilesService {
@@ -3092,8 +3092,8 @@ registerSingleton(IEditSessionsStorageService, class EditSessionsWorkbenchServic
3092
3092
  }, 1 );
3093
3093
  registerSingleton(IMultiDiffSourceResolverService, class MultiDiffSourceResolverService {
3094
3094
  constructor() {
3095
- this.registerResolver = unsupported;
3096
- this.resolve = unsupported;
3095
+ this.registerResolver = () => Disposable.None;
3096
+ this.resolve = async () => undefined;
3097
3097
  }
3098
3098
  }, 1 );
3099
3099
  registerSingleton(IWorkspaceTagsService, NoOpWorkspaceTagsService, 1 );
@@ -3136,3 +3136,11 @@ registerSingleton(ICustomEditorLabelService, class CustomEditorLabelService {
3136
3136
  this.getName = () => undefined;
3137
3137
  }
3138
3138
  }, 1 );
3139
+ registerSingleton(ITroubleshootIssueService, class TroubleshootIssueService {
3140
+ constructor() {
3141
+ this.isActive = () => false;
3142
+ this.start = unsupported;
3143
+ this.resume = unsupported;
3144
+ this.stop = unsupported;
3145
+ }
3146
+ }, 1 );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-api",
3
- "version": "4.0.0",
3
+ "version": "4.1.1",
4
4
  "description": "VSCode public API plugged on the monaco editor",
5
5
  "keywords": [],
6
6
  "author": {
@@ -94,12 +94,12 @@
94
94
  }
95
95
  },
96
96
  "dependencies": {
97
- "@codingame/monaco-vscode-files-service-override": "4.0.0",
98
- "@codingame/monaco-vscode-quickaccess-service-override": "4.0.0",
99
- "@codingame/monaco-vscode-extensions-service-override": "4.0.0",
100
- "@codingame/monaco-vscode-environment-service-override": "4.0.0",
101
- "@codingame/monaco-vscode-layout-service-override": "4.0.0",
102
- "@codingame/monaco-vscode-host-service-override": "4.0.0",
103
- "@codingame/monaco-vscode-base-service-override": "4.0.0"
97
+ "@codingame/monaco-vscode-extensions-service-override": "4.1.1",
98
+ "@codingame/monaco-vscode-files-service-override": "4.1.1",
99
+ "@codingame/monaco-vscode-quickaccess-service-override": "4.1.1",
100
+ "@codingame/monaco-vscode-environment-service-override": "4.1.1",
101
+ "@codingame/monaco-vscode-layout-service-override": "4.1.1",
102
+ "@codingame/monaco-vscode-host-service-override": "4.1.1",
103
+ "@codingame/monaco-vscode-base-service-override": "4.1.1"
104
104
  }
105
105
  }
package/services.d.ts CHANGED
@@ -73,6 +73,8 @@ export { IRemoteAuthorityResolverService } from './vscode/src/vs/platform/remote
73
73
  export { IRemoteSocketFactoryService } from './vscode/src/vs/platform/remote/common/remoteSocketFactoryService.js';
74
74
  export { IFilesConfigurationService } from './vscode/src/vs/workbench/services/filesConfiguration/common/filesConfigurationService.js';
75
75
  export { ILabelService } from './vscode/src/vs/platform/label/common/label.js';
76
+ export { ILanguagePackService } from './vscode/src/vs/platform/languagePacks/common/languagePacks.js';
77
+ export { ILocaleService } from './vscode/src/vs/workbench/services/localization/common/locale.js';
76
78
  export { IActivityService, IBadge } from './vscode/src/vs/workbench/services/activity/common/activity.js';
77
79
  export { IHoverService } from './vscode/src/vs/platform/hover/browser/hover.js';
78
80
  export { IExplorerService } from './vscode/src/vs/workbench/contrib/files/browser/files.js';
package/services.js CHANGED
@@ -136,6 +136,8 @@ export { IRemoteSocketFactoryService } from './vscode/src/vs/platform/remote/com
136
136
  export { IFilesConfigurationService } from './vscode/src/vs/workbench/services/filesConfiguration/common/filesConfigurationService.js';
137
137
  export { ILabelService } from './vscode/src/vs/platform/label/common/label.js';
138
138
  export { IWorkbenchLayoutService } from './vscode/src/vs/workbench/services/layout/browser/layoutService.js';
139
+ export { ILanguagePackService } from './vscode/src/vs/platform/languagePacks/common/languagePacks.js';
140
+ export { ILocaleService } from './vscode/src/vs/workbench/services/localization/common/locale.js';
139
141
  export { IActivityService } from './vscode/src/vs/workbench/services/activity/common/activity.js';
140
142
  export { IHoverService } from './vscode/src/vs/platform/hover/browser/hover.js';
141
143
  export { IExplorerService } from './vscode/src/vs/workbench/contrib/files/browser/files.js';
@@ -0,0 +1,18 @@
1
+ import { ServiceIdentifier } from '../../instantiation/common/instantiation.js';
2
+ import { URI } from '../../../base/common/uri.js';
3
+ import { IQuickPickItem } from '../../quickinput/common/quickInput.js';
4
+ import { IGalleryExtension } from '../../extensionManagement/common/extensionManagement.js';
5
+
6
+ interface ILanguagePackItem extends IQuickPickItem {
7
+ readonly extensionId?: string;
8
+ readonly galleryExtension?: IGalleryExtension;
9
+ }
10
+ declare const ILanguagePackService: ServiceIdentifier<ILanguagePackService>;
11
+ interface ILanguagePackService {
12
+ readonly _serviceBrand: undefined;
13
+ getAvailableLanguages(): Promise<Array<ILanguagePackItem>>;
14
+ getInstalledLanguages(): Promise<Array<ILanguagePackItem>>;
15
+ getBuiltInExtensionTranslationsUri(id: string, language: string): Promise<URI | undefined>;
16
+ }
17
+
18
+ export { type ILanguagePackItem, ILanguagePackService };
@@ -0,0 +1,47 @@
1
+ import { EventMultiplexer, DynamicListEventMultiplexer, Event } from '../../../../base/common/event.js';
2
+ import { DisposableMap, DisposableStore } from '../../../../base/common/lifecycle.js';
3
+ function createInstanceCapabilityEventMultiplexer(currentInstances, onAddInstance, onRemoveInstance, capabilityId, getEvent) {
4
+ const store = ( new DisposableStore());
5
+ const multiplexer = store.add(( new EventMultiplexer()));
6
+ const capabilityListeners = store.add(( new DisposableMap()));
7
+ function addCapability(instance, capability) {
8
+ const listener = multiplexer.add(( Event.map(getEvent(capability), data => ({ instance, data }))));
9
+ capabilityListeners.set(capability, listener);
10
+ }
11
+ for (const instance of currentInstances) {
12
+ const capability = instance.capabilities.get(capabilityId);
13
+ if (capability) {
14
+ addCapability(instance, capability);
15
+ }
16
+ }
17
+ const addCapabilityMultiplexer = store.add(( new DynamicListEventMultiplexer(
18
+ currentInstances,
19
+ onAddInstance,
20
+ onRemoveInstance,
21
+ instance => ( Event.map(
22
+ instance.capabilities.onDidAddCapability,
23
+ changeEvent => ({ instance, changeEvent })
24
+ ))
25
+ )));
26
+ store.add(addCapabilityMultiplexer.event(e => {
27
+ if (e.changeEvent.id === capabilityId) {
28
+ addCapability(e.instance, e.changeEvent.capability);
29
+ }
30
+ }));
31
+ const removeCapabilityMultiplexer = store.add(( new DynamicListEventMultiplexer(
32
+ currentInstances,
33
+ onAddInstance,
34
+ onRemoveInstance,
35
+ instance => instance.capabilities.onDidRemoveCapability
36
+ )));
37
+ store.add(removeCapabilityMultiplexer.event(e => {
38
+ if (e.id === capabilityId) {
39
+ capabilityListeners.deleteAndDispose(e.capability);
40
+ }
41
+ }));
42
+ return {
43
+ dispose: () => store.dispose(),
44
+ event: multiplexer.event
45
+ };
46
+ }
47
+ export { createInstanceCapabilityEventMultiplexer };
@@ -0,0 +1,418 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { localizeWithPath, localize2WithPath } from '../../../../nls.js';
3
+ import { IExtensionManagementService } from '../../../../platform/extensionManagement/common/extensionManagement.js';
4
+ import { IProductService } from '../../../../platform/product/common/productService.js';
5
+ import { IWorkbenchIssueService } from '../common/issue.js';
6
+ import { Disposable, DisposableStore } from '../../../../base/common/lifecycle.js';
7
+ import { registerAction2, Action2 } from '../../../../platform/actions/common/actions.js';
8
+ import { IUserDataProfileService, IUserDataProfileManagementService, IUserDataProfileImportExportService } from '../../userDataProfile/common/userDataProfile.js';
9
+ import '../../../../../../../override/vs/platform/dialogs/common/dialogs.js';
10
+ import { IExtensionBisectService } from '../../extensionManagement/browser/extensionBisect.js';
11
+ import { Severity, NotificationPriority, INotificationService } from '../../../../platform/notification/common/notification.js';
12
+ import { IWorkbenchExtensionEnablementService } from '../../extensionManagement/common/extensionManagement.js';
13
+ import { IHostService } from '../../host/browser/host.js';
14
+ import { IUserDataProfilesService } from '../../../../platform/userDataProfile/common/userDataProfile.js';
15
+ import { createDecorator } from '../../../../platform/instantiation/common/instantiation.js';
16
+ import { Categories } from '../../../../platform/action/common/actionCommonCategories.js';
17
+ import { RawContextKey, IContextKeyService, ContextKeyExpr } from '../../../../platform/contextkey/common/contextkey.js';
18
+ import { Registry } from '../../../../platform/registry/common/platform.js';
19
+ import { Extensions } from '../../../common/contributions.js';
20
+ import { IStorageService } from '../../../../platform/storage/common/storage.js';
21
+ import { IOpenerService } from '../../../../platform/opener/common/opener.js';
22
+ import { URI } from '../../../../base/common/uri.js';
23
+ import { RemoteNameContext } from '../../../common/contextkeys.js';
24
+ import { IsWebContext } from '../../../../platform/contextkey/common/contextkeys.js';
25
+ import { IDialogService } from '../../../../platform/dialogs/common/dialogs.js';
26
+ var TroubleshootIssueService_1, IssueTroubleshootUi_1;
27
+ const ITroubleshootIssueService = ( createDecorator('ITroubleshootIssueService'));
28
+ var TroubleshootStage;
29
+ ( (function(TroubleshootStage) {
30
+ TroubleshootStage[TroubleshootStage["EXTENSIONS"] = 1] = "EXTENSIONS";
31
+ TroubleshootStage[TroubleshootStage["WORKBENCH"] = 2] = "WORKBENCH";
32
+ })(TroubleshootStage || (TroubleshootStage = {})));
33
+ class TroubleShootState {
34
+ static fromJSON(raw) {
35
+ if (!raw) {
36
+ return undefined;
37
+ }
38
+ try {
39
+ const data = JSON.parse(raw);
40
+ if ((data.stage === TroubleshootStage.EXTENSIONS || data.stage === TroubleshootStage.WORKBENCH)
41
+ && typeof data.profile === 'string') {
42
+ return ( new TroubleShootState(data.stage, data.profile));
43
+ }
44
+ }
45
+ catch { }
46
+ return undefined;
47
+ }
48
+ constructor(stage, profile) {
49
+ this.stage = stage;
50
+ this.profile = profile;
51
+ }
52
+ }
53
+ let TroubleshootIssueService = class TroubleshootIssueService extends Disposable {
54
+ static { TroubleshootIssueService_1 = this; }
55
+ static { this.storageKey = 'issueTroubleshootState'; }
56
+ constructor(userDataProfileService, userDataProfilesService, userDataProfileManagementService, userDataProfileImportExportService, dialogService, extensionBisectService, notificationService, extensionManagementService, extensionEnablementService, issueService, productService, hostService, storageService, openerService) {
57
+ super();
58
+ this.userDataProfileService = userDataProfileService;
59
+ this.userDataProfilesService = userDataProfilesService;
60
+ this.userDataProfileManagementService = userDataProfileManagementService;
61
+ this.userDataProfileImportExportService = userDataProfileImportExportService;
62
+ this.dialogService = dialogService;
63
+ this.extensionBisectService = extensionBisectService;
64
+ this.notificationService = notificationService;
65
+ this.extensionManagementService = extensionManagementService;
66
+ this.extensionEnablementService = extensionEnablementService;
67
+ this.issueService = issueService;
68
+ this.productService = productService;
69
+ this.hostService = hostService;
70
+ this.storageService = storageService;
71
+ this.openerService = openerService;
72
+ }
73
+ isActive() {
74
+ return this.state !== undefined;
75
+ }
76
+ async start() {
77
+ if (this.isActive()) {
78
+ throw new Error('invalid state');
79
+ }
80
+ const res = await this.dialogService.confirm({
81
+ message: ( localizeWithPath(
82
+ 'vs/workbench/services/issue/browser/issueTroubleshoot',
83
+ 'troubleshoot issue',
84
+ "Troubleshoot Issue"
85
+ )),
86
+ detail: ( localizeWithPath(
87
+ 'vs/workbench/services/issue/browser/issueTroubleshoot',
88
+ 'detail.start',
89
+ "Issue troubleshooting is a process to help you identify the cause for an issue. The cause for an issue can be a misconfiguration, due to an extension, or be {0} itself.\n\nDuring the process the window reloads repeatedly. Each time you must confirm if you are still seeing the issue.",
90
+ this.productService.nameLong
91
+ )),
92
+ primaryButton: ( localizeWithPath(
93
+ 'vs/workbench/services/issue/browser/issueTroubleshoot',
94
+ { key: 'msg', comment: ['&& denotes a mnemonic'] },
95
+ "&&Troubleshoot Issue"
96
+ )),
97
+ custom: true
98
+ });
99
+ if (!res.confirmed) {
100
+ return;
101
+ }
102
+ const originalProfile = this.userDataProfileService.currentProfile;
103
+ await this.userDataProfileImportExportService.createTroubleshootProfile();
104
+ this.state = ( new TroubleShootState(TroubleshootStage.EXTENSIONS, originalProfile.id));
105
+ await this.resume();
106
+ }
107
+ async resume() {
108
+ if (!this.isActive()) {
109
+ return;
110
+ }
111
+ if (this.state?.stage === TroubleshootStage.EXTENSIONS && !this.extensionBisectService.isActive) {
112
+ await this.reproduceIssueWithExtensionsDisabled();
113
+ }
114
+ if (this.state?.stage === TroubleshootStage.WORKBENCH) {
115
+ await this.reproduceIssueWithEmptyProfile();
116
+ }
117
+ await this.stop();
118
+ }
119
+ async stop() {
120
+ if (!this.isActive()) {
121
+ return;
122
+ }
123
+ if (this.notificationHandle) {
124
+ this.notificationHandle.close();
125
+ this.notificationHandle = undefined;
126
+ }
127
+ if (this.extensionBisectService.isActive) {
128
+ await this.extensionBisectService.reset();
129
+ }
130
+ const profile = this.userDataProfilesService.profiles.find(p => p.id === this.state?.profile) ?? this.userDataProfilesService.defaultProfile;
131
+ this.state = undefined;
132
+ await this.userDataProfileManagementService.switchProfile(profile);
133
+ }
134
+ async reproduceIssueWithExtensionsDisabled() {
135
+ if (!(await this.extensionManagementService.getInstalled(1 )).length) {
136
+ this.state = ( new TroubleShootState(TroubleshootStage.WORKBENCH, this.state.profile));
137
+ return;
138
+ }
139
+ const result = await this.askToReproduceIssue(( localizeWithPath(
140
+ 'vs/workbench/services/issue/browser/issueTroubleshoot',
141
+ 'profile.extensions.disabled',
142
+ "Issue troubleshooting is active and has temporarily disabled all installed extensions. Check if you can still reproduce the problem and proceed by selecting from these options."
143
+ )));
144
+ if (result === 'good') {
145
+ const profile = this.userDataProfilesService.profiles.find(p => p.id === this.state.profile) ?? this.userDataProfilesService.defaultProfile;
146
+ await this.reproduceIssueWithExtensionsBisect(profile);
147
+ }
148
+ if (result === 'bad') {
149
+ this.state = ( new TroubleShootState(TroubleshootStage.WORKBENCH, this.state.profile));
150
+ }
151
+ if (result === 'stop') {
152
+ await this.stop();
153
+ }
154
+ }
155
+ async reproduceIssueWithEmptyProfile() {
156
+ await this.userDataProfileManagementService.createAndEnterTransientProfile();
157
+ this.updateState(this.state);
158
+ const result = await this.askToReproduceIssue(( localizeWithPath(
159
+ 'vs/workbench/services/issue/browser/issueTroubleshoot',
160
+ 'empty.profile',
161
+ "Issue troubleshooting is active and has temporarily reset your configurations to defaults. Check if you can still reproduce the problem and proceed by selecting from these options."
162
+ )));
163
+ if (result === 'stop') {
164
+ await this.stop();
165
+ }
166
+ if (result === 'good') {
167
+ await this.askToReportIssue(( localizeWithPath(
168
+ 'vs/workbench/services/issue/browser/issueTroubleshoot',
169
+ 'issue is with configuration',
170
+ "Issue troubleshooting has identified that the issue is caused by your configurations. Please report the issue by exporting your configurations using \"Export Profile\" command and share the file in the issue report."
171
+ )));
172
+ }
173
+ if (result === 'bad') {
174
+ await this.askToReportIssue(( localizeWithPath(
175
+ 'vs/workbench/services/issue/browser/issueTroubleshoot',
176
+ 'issue is in core',
177
+ "Issue troubleshooting has identified that the issue is with {0}.",
178
+ this.productService.nameLong
179
+ )));
180
+ }
181
+ }
182
+ async reproduceIssueWithExtensionsBisect(profile) {
183
+ await this.userDataProfileManagementService.switchProfile(profile);
184
+ const extensions = (await this.extensionManagementService.getInstalled(1 )).filter(ext => this.extensionEnablementService.isEnabled(ext));
185
+ await this.extensionBisectService.start(extensions);
186
+ await this.hostService.reload();
187
+ }
188
+ askToReproduceIssue(message) {
189
+ return ( new Promise((c, e) => {
190
+ const goodPrompt = {
191
+ label: ( localizeWithPath(
192
+ 'vs/workbench/services/issue/browser/issueTroubleshoot',
193
+ 'I cannot reproduce',
194
+ "I Can't Reproduce"
195
+ )),
196
+ run: () => c('good')
197
+ };
198
+ const badPrompt = {
199
+ label: ( localizeWithPath(
200
+ 'vs/workbench/services/issue/browser/issueTroubleshoot',
201
+ 'This is Bad',
202
+ "I Can Reproduce"
203
+ )),
204
+ run: () => c('bad')
205
+ };
206
+ const stop = {
207
+ label: ( localizeWithPath('vs/workbench/services/issue/browser/issueTroubleshoot', 'Stop', "Stop")),
208
+ run: () => c('stop')
209
+ };
210
+ this.notificationHandle = this.notificationService.prompt(Severity.Info, message, [goodPrompt, badPrompt, stop], { sticky: true, priority: NotificationPriority.URGENT });
211
+ }));
212
+ }
213
+ async askToReportIssue(message) {
214
+ let isCheckedInInsiders = false;
215
+ if (this.productService.quality === 'stable') {
216
+ const res = await this.askToReproduceIssueWithInsiders();
217
+ if (res === 'good') {
218
+ await this.dialogService.prompt({
219
+ type: Severity.Info,
220
+ message: ( localizeWithPath(
221
+ 'vs/workbench/services/issue/browser/issueTroubleshoot',
222
+ 'troubleshoot issue',
223
+ "Troubleshoot Issue"
224
+ )),
225
+ detail: ( localizeWithPath(
226
+ 'vs/workbench/services/issue/browser/issueTroubleshoot',
227
+ 'use insiders',
228
+ "This likely means that the issue has been addressed already and will be available in an upcoming release. You can safely use {0} insiders until the new stable version is available.",
229
+ this.productService.nameLong
230
+ )),
231
+ custom: true
232
+ });
233
+ return;
234
+ }
235
+ if (res === 'stop') {
236
+ await this.stop();
237
+ return;
238
+ }
239
+ if (res === 'bad') {
240
+ isCheckedInInsiders = true;
241
+ }
242
+ }
243
+ await this.issueService.openReporter({
244
+ issueBody: `> ${message} ${isCheckedInInsiders ? `It is confirmed that the issue exists in ${this.productService.nameLong} Insiders` : ''}`,
245
+ });
246
+ }
247
+ async askToReproduceIssueWithInsiders() {
248
+ const confirmRes = await this.dialogService.confirm({
249
+ type: 'info',
250
+ message: ( localizeWithPath(
251
+ 'vs/workbench/services/issue/browser/issueTroubleshoot',
252
+ 'troubleshoot issue',
253
+ "Troubleshoot Issue"
254
+ )),
255
+ primaryButton: ( localizeWithPath(
256
+ 'vs/workbench/services/issue/browser/issueTroubleshoot',
257
+ 'download insiders',
258
+ "Download {0} Insiders",
259
+ this.productService.nameLong
260
+ )),
261
+ cancelButton: ( localizeWithPath(
262
+ 'vs/workbench/services/issue/browser/issueTroubleshoot',
263
+ 'report anyway',
264
+ "Report Issue Anyway"
265
+ )),
266
+ detail: ( localizeWithPath(
267
+ 'vs/workbench/services/issue/browser/issueTroubleshoot',
268
+ 'ask to download insiders',
269
+ "Please try to download and reproduce the issue in {0} insiders.",
270
+ this.productService.nameLong
271
+ )),
272
+ custom: {
273
+ disableCloseAction: true,
274
+ }
275
+ });
276
+ if (!confirmRes.confirmed) {
277
+ return undefined;
278
+ }
279
+ const opened = await this.openerService.open(( URI.parse('https://aka.ms/vscode-insiders')));
280
+ if (!opened) {
281
+ return undefined;
282
+ }
283
+ const res = await this.dialogService.prompt({
284
+ type: 'info',
285
+ message: ( localizeWithPath(
286
+ 'vs/workbench/services/issue/browser/issueTroubleshoot',
287
+ 'troubleshoot issue',
288
+ "Troubleshoot Issue"
289
+ )),
290
+ buttons: [{
291
+ label: ( localizeWithPath(
292
+ 'vs/workbench/services/issue/browser/issueTroubleshoot',
293
+ 'good',
294
+ "I can't reproduce"
295
+ )),
296
+ run: () => 'good'
297
+ }, {
298
+ label: ( localizeWithPath(
299
+ 'vs/workbench/services/issue/browser/issueTroubleshoot',
300
+ 'bad',
301
+ "I can reproduce"
302
+ )),
303
+ run: () => 'bad'
304
+ }],
305
+ cancelButton: {
306
+ label: ( localizeWithPath('vs/workbench/services/issue/browser/issueTroubleshoot', 'stop', "Stop")),
307
+ run: () => 'stop'
308
+ },
309
+ detail: ( localizeWithPath(
310
+ 'vs/workbench/services/issue/browser/issueTroubleshoot',
311
+ 'ask to reproduce issue',
312
+ "Please try to reproduce the issue in {0} insiders and confirm if the issue exists there.",
313
+ this.productService.nameLong
314
+ )),
315
+ custom: {
316
+ disableCloseAction: true,
317
+ }
318
+ });
319
+ return res.result;
320
+ }
321
+ get state() {
322
+ if (this._state === undefined) {
323
+ const raw = this.storageService.get(TroubleshootIssueService_1.storageKey, 0 );
324
+ this._state = TroubleShootState.fromJSON(raw);
325
+ }
326
+ return this._state || undefined;
327
+ }
328
+ set state(state) {
329
+ this._state = state ?? null;
330
+ this.updateState(state);
331
+ }
332
+ updateState(state) {
333
+ if (state) {
334
+ this.storageService.store(TroubleshootIssueService_1.storageKey, JSON.stringify(state), 0 , 1 );
335
+ }
336
+ else {
337
+ this.storageService.remove(TroubleshootIssueService_1.storageKey, 0 );
338
+ }
339
+ }
340
+ };
341
+ TroubleshootIssueService = TroubleshootIssueService_1 = ( __decorate([
342
+ ( __param(0, IUserDataProfileService)),
343
+ ( __param(1, IUserDataProfilesService)),
344
+ ( __param(2, IUserDataProfileManagementService)),
345
+ ( __param(3, IUserDataProfileImportExportService)),
346
+ ( __param(4, IDialogService)),
347
+ ( __param(5, IExtensionBisectService)),
348
+ ( __param(6, INotificationService)),
349
+ ( __param(7, IExtensionManagementService)),
350
+ ( __param(8, IWorkbenchExtensionEnablementService)),
351
+ ( __param(9, IWorkbenchIssueService)),
352
+ ( __param(10, IProductService)),
353
+ ( __param(11, IHostService)),
354
+ ( __param(12, IStorageService)),
355
+ ( __param(13, IOpenerService))
356
+ ], TroubleshootIssueService));
357
+ let IssueTroubleshootUi = class IssueTroubleshootUi extends Disposable {
358
+ static { IssueTroubleshootUi_1 = this; }
359
+ static { this.ctxIsTroubleshootActive = ( new RawContextKey('isIssueTroubleshootActive', false)); }
360
+ constructor(contextKeyService, troubleshootIssueService, storageService) {
361
+ super();
362
+ this.contextKeyService = contextKeyService;
363
+ this.troubleshootIssueService = troubleshootIssueService;
364
+ this.updateContext();
365
+ if (troubleshootIssueService.isActive()) {
366
+ troubleshootIssueService.resume();
367
+ }
368
+ this._register(storageService.onDidChangeValue(0 , TroubleshootIssueService.storageKey, this._register(( new DisposableStore())))(() => {
369
+ this.updateContext();
370
+ }));
371
+ }
372
+ updateContext() {
373
+ IssueTroubleshootUi_1.ctxIsTroubleshootActive.bindTo(this.contextKeyService).set(this.troubleshootIssueService.isActive());
374
+ }
375
+ };
376
+ IssueTroubleshootUi = IssueTroubleshootUi_1 = ( __decorate([
377
+ ( __param(0, IContextKeyService)),
378
+ ( __param(1, ITroubleshootIssueService)),
379
+ ( __param(2, IStorageService))
380
+ ], IssueTroubleshootUi));
381
+ ( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(IssueTroubleshootUi, 3 );
382
+ registerAction2(class TroubleshootIssueAction extends Action2 {
383
+ constructor() {
384
+ super({
385
+ id: 'workbench.action.troubleshootIssue.start',
386
+ title: ( localize2WithPath(
387
+ 'vs/workbench/services/issue/browser/issueTroubleshoot',
388
+ 'troubleshootIssue',
389
+ 'Troubleshoot Issue...'
390
+ )),
391
+ category: Categories.Help,
392
+ f1: true,
393
+ precondition: ( ContextKeyExpr.and(( IssueTroubleshootUi.ctxIsTroubleshootActive.negate()), ( RemoteNameContext.isEqualTo('')), ( IsWebContext.negate()))),
394
+ });
395
+ }
396
+ run(accessor) {
397
+ return accessor.get(ITroubleshootIssueService).start();
398
+ }
399
+ });
400
+ registerAction2(class extends Action2 {
401
+ constructor() {
402
+ super({
403
+ id: 'workbench.action.troubleshootIssue.stop',
404
+ title: ( localize2WithPath(
405
+ 'vs/workbench/services/issue/browser/issueTroubleshoot',
406
+ 'title.stop',
407
+ 'Stop Troubleshoot Issue'
408
+ )),
409
+ category: Categories.Help,
410
+ f1: true,
411
+ precondition: IssueTroubleshootUi.ctxIsTroubleshootActive
412
+ });
413
+ }
414
+ async run(accessor) {
415
+ return accessor.get(ITroubleshootIssueService).stop();
416
+ }
417
+ });
418
+ export { ITroubleshootIssueService, TroubleshootIssueService };
@@ -0,0 +1,11 @@
1
+ import { ServiceIdentifier } from '../../../../platform/instantiation/common/instantiation.js';
2
+ import { ILanguagePackItem } from '../../../../platform/languagePacks/common/languagePacks.js';
3
+
4
+ declare const ILocaleService: ServiceIdentifier<ILocaleService>;
5
+ interface ILocaleService {
6
+ readonly _serviceBrand: undefined;
7
+ setLocale(languagePackItem: ILanguagePackItem, skipDialog?: boolean): Promise<void>;
8
+ clearLocalePreference(): Promise<void>;
9
+ }
10
+
11
+ export { ILocaleService };