@codingame/monaco-vscode-localization-service-override 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.
Files changed (46) hide show
  1. package/external/tslib/tslib.es6.js +11 -0
  2. package/index.d.ts +1 -0
  3. package/index.js +1 -0
  4. package/localization.d.ts +14 -0
  5. package/localization.js +550 -0
  6. package/override/vs/platform/dialogs/common/dialogs.js +10 -0
  7. package/package.json +32 -0
  8. package/vscode/src/vs/platform/actions/common/actions.contribution.js +5 -0
  9. package/vscode/src/vs/platform/actions/common/menuResetAction.js +21 -0
  10. package/vscode/src/vs/platform/sign/browser/signService.js +66 -0
  11. package/vscode/src/vs/platform/sign/common/abstractSignService.js +51 -0
  12. package/vscode/src/vs/platform/telemetry/browser/errorTelemetry.js +50 -0
  13. package/vscode/src/vs/platform/telemetry/common/errorTelemetry.js +83 -0
  14. package/vscode/src/vs/platform/telemetry/common/telemetryService.js +251 -0
  15. package/vscode/src/vs/workbench/browser/actions/helpActions.js +356 -0
  16. package/vscode/src/vs/workbench/contrib/accountEntitlements/browser/accountsEntitlements.contribution.js +236 -0
  17. package/vscode/src/vs/workbench/contrib/authentication/browser/actions/manageTrustedExtensionsForAccountAction.js +206 -0
  18. package/vscode/src/vs/workbench/contrib/authentication/browser/actions/signOutOfAccountAction.js +64 -0
  19. package/vscode/src/vs/workbench/contrib/authentication/browser/authentication.contribution.js +223 -0
  20. package/vscode/src/vs/workbench/contrib/bracketPairColorizer2Telemetry/browser/bracketPairColorizer2Telemetry.contribution.js +37 -0
  21. package/vscode/src/vs/workbench/contrib/codeEditor/browser/editorSettingsMigration.js +14 -0
  22. package/vscode/src/vs/workbench/contrib/codeEditor/browser/inspectKeybindings.js +46 -0
  23. package/vscode/src/vs/workbench/contrib/codeEditor/browser/toggleColumnSelection.js +89 -0
  24. package/vscode/src/vs/workbench/contrib/deprecatedExtensionMigrator/browser/deprecatedExtensionMigrator.contribution.js +98 -0
  25. package/vscode/src/vs/workbench/contrib/localization/browser/localization.contribution.js +10 -0
  26. package/vscode/src/vs/workbench/contrib/localization/common/localization.contribution.js +160 -0
  27. package/vscode/src/vs/workbench/contrib/localization/common/localizationsActions.js +129 -0
  28. package/vscode/src/vs/workbench/contrib/logs/browser/logs.contribution.js +37 -0
  29. package/vscode/src/vs/workbench/contrib/logs/common/logsDataCleaner.js +43 -0
  30. package/vscode/src/vs/workbench/contrib/scrollLocking/browser/scrollLocking.contribution.js +4 -0
  31. package/vscode/src/vs/workbench/contrib/scrollLocking/browser/scrollLocking.js +214 -0
  32. package/vscode/src/vs/workbench/contrib/splash/browser/partsSplash.js +117 -0
  33. package/vscode/src/vs/workbench/contrib/splash/browser/splash.contribution.js +5 -0
  34. package/vscode/src/vs/workbench/contrib/splash/browser/splash.js +5 -0
  35. package/vscode/src/vs/workbench/contrib/telemetry/browser/telemetry.contribution.js +227 -0
  36. package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.contribution.js +9 -0
  37. package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.js +573 -0
  38. package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfileActions.js +197 -0
  39. package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilePreview.js +24 -0
  40. package/vscode/src/vs/workbench/services/dialogs/browser/fileDialogService.js +244 -0
  41. package/vscode/src/vs/workbench/services/issue/browser/issueTroubleshoot.js +418 -0
  42. package/vscode/src/vs/workbench/services/localization/browser/localeService.js +98 -0
  43. package/vscode/src/vs/workbench/services/search/browser/searchService.js +167 -0
  44. package/vscode/src/vs/workbench/services/textMate/browser/textMateTokenizationFeature.contribution.js +13 -0
  45. package/vscode/src/vs/workbench/services/userActivity/browser/domActivityTracker.js +41 -0
  46. package/vscode/src/vs/workbench/services/userActivity/browser/userActivityBrowser.js +4 -0
@@ -0,0 +1,214 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { Disposable, DisposableStore, MutableDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
3
+ import { localizeWithPath, localize2WithPath } from 'vscode/vscode/vs/nls';
4
+ import { Categories } from 'vscode/vscode/vs/platform/action/common/actionCommonCategories';
5
+ import { registerAction2, Action2 } from 'vscode/vscode/vs/platform/actions/common/actions';
6
+ import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
7
+ import { SideBySideEditor } from 'vscode/vscode/vs/workbench/browser/parts/editor/sideBySideEditor';
8
+ import { isEditorPaneWithScrolling } from 'vscode/vscode/vs/workbench/common/editor';
9
+ import { ReentrancyBarrier } from 'vscode/vscode/vs/workbench/contrib/mergeEditor/browser/utils';
10
+ import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
11
+ import { IStatusbarService } from 'vscode/vscode/vs/workbench/services/statusbar/browser/statusbar';
12
+
13
+ let SyncScroll = class SyncScroll extends Disposable {
14
+ static { this.ID = 'workbench.contrib.syncScrolling'; }
15
+ constructor(editorService, statusbarService) {
16
+ super();
17
+ this.editorService = editorService;
18
+ this.statusbarService = statusbarService;
19
+ this.paneInitialScrollTop = ( new Map());
20
+ this.syncScrollDispoasbles = this._register(( new DisposableStore()));
21
+ this.paneDisposables = ( new DisposableStore());
22
+ this.statusBarEntry = this._register(( new MutableDisposable()));
23
+ this.isActive = false;
24
+ this._reentrancyBarrier = ( new ReentrancyBarrier());
25
+ this.registerActions();
26
+ }
27
+ registerActiveListeners() {
28
+ this.syncScrollDispoasbles.add(this.editorService.onDidVisibleEditorsChange(() => this.trackVisiblePanes()));
29
+ }
30
+ activate() {
31
+ this.registerActiveListeners();
32
+ this.trackVisiblePanes();
33
+ }
34
+ toggle() {
35
+ if (this.isActive) {
36
+ this.deactivate();
37
+ }
38
+ else {
39
+ this.activate();
40
+ }
41
+ this.isActive = !this.isActive;
42
+ this.toggleStatusbarItem(this.isActive);
43
+ }
44
+ trackVisiblePanes() {
45
+ this.paneDisposables.clear();
46
+ this.paneInitialScrollTop.clear();
47
+ for (const pane of this.getAllVisiblePanes()) {
48
+ if (!isEditorPaneWithScrolling(pane)) {
49
+ continue;
50
+ }
51
+ this.paneInitialScrollTop.set(pane, pane.getScrollPosition());
52
+ this.paneDisposables.add(pane.onDidChangeScroll(() => this._reentrancyBarrier.runExclusively(() => {
53
+ this.onDidEditorPaneScroll(pane);
54
+ })));
55
+ }
56
+ }
57
+ onDidEditorPaneScroll(scrolledPane) {
58
+ const scrolledPaneInitialOffset = this.paneInitialScrollTop.get(scrolledPane);
59
+ if (scrolledPaneInitialOffset === undefined) {
60
+ throw new Error('Scrolled pane not tracked');
61
+ }
62
+ if (!isEditorPaneWithScrolling(scrolledPane)) {
63
+ throw new Error('Scrolled pane does not support scrolling');
64
+ }
65
+ const scrolledPaneCurrentPosition = scrolledPane.getScrollPosition();
66
+ const scrolledFromInitial = {
67
+ scrollTop: scrolledPaneCurrentPosition.scrollTop - scrolledPaneInitialOffset.scrollTop,
68
+ scrollLeft: scrolledPaneCurrentPosition.scrollLeft !== undefined && scrolledPaneInitialOffset.scrollLeft !== undefined ? scrolledPaneCurrentPosition.scrollLeft - scrolledPaneInitialOffset.scrollLeft : undefined,
69
+ };
70
+ for (const pane of this.getAllVisiblePanes()) {
71
+ if (pane === scrolledPane) {
72
+ continue;
73
+ }
74
+ if (!isEditorPaneWithScrolling(pane)) {
75
+ continue;
76
+ }
77
+ const initialOffset = this.paneInitialScrollTop.get(pane);
78
+ if (initialOffset === undefined) {
79
+ throw new Error('Could not find initial offset for pane');
80
+ }
81
+ const currentPanePosition = pane.getScrollPosition();
82
+ const newPaneScrollPosition = {
83
+ scrollTop: initialOffset.scrollTop + scrolledFromInitial.scrollTop,
84
+ scrollLeft: initialOffset.scrollLeft !== undefined && scrolledFromInitial.scrollLeft !== undefined ? initialOffset.scrollLeft + scrolledFromInitial.scrollLeft : undefined,
85
+ };
86
+ if (currentPanePosition.scrollTop === newPaneScrollPosition.scrollTop && currentPanePosition.scrollLeft === newPaneScrollPosition.scrollLeft) {
87
+ continue;
88
+ }
89
+ pane.setScrollPosition(newPaneScrollPosition);
90
+ }
91
+ }
92
+ getAllVisiblePanes() {
93
+ const panes = [];
94
+ for (const pane of this.editorService.visibleEditorPanes) {
95
+ if (pane instanceof SideBySideEditor) {
96
+ const primaryPane = pane.getPrimaryEditorPane();
97
+ const secondaryPane = pane.getSecondaryEditorPane();
98
+ if (primaryPane) {
99
+ panes.push(primaryPane);
100
+ }
101
+ if (secondaryPane) {
102
+ panes.push(secondaryPane);
103
+ }
104
+ continue;
105
+ }
106
+ panes.push(pane);
107
+ }
108
+ return panes;
109
+ }
110
+ deactivate() {
111
+ this.paneDisposables.clear();
112
+ this.syncScrollDispoasbles.clear();
113
+ this.paneInitialScrollTop.clear();
114
+ }
115
+ toggleStatusbarItem(active) {
116
+ if (active) {
117
+ if (!this.statusBarEntry.value) {
118
+ const text = ( localizeWithPath(
119
+ 'vs/workbench/contrib/scrollLocking/browser/scrollLocking',
120
+ 'mouseScrolllingLocked',
121
+ 'Scrolling Locked'
122
+ ));
123
+ const tooltip = ( localizeWithPath(
124
+ 'vs/workbench/contrib/scrollLocking/browser/scrollLocking',
125
+ 'mouseLockScrollingEnabled',
126
+ 'Lock Scrolling Enabled'
127
+ ));
128
+ this.statusBarEntry.value = this.statusbarService.addEntry({
129
+ name: text,
130
+ text,
131
+ tooltip,
132
+ ariaLabel: text,
133
+ command: {
134
+ id: 'workbench.action.toggleLockedScrolling',
135
+ title: ''
136
+ },
137
+ kind: 'prominent',
138
+ showInAllWindows: true
139
+ }, 'status.scrollLockingEnabled', 1 , 102);
140
+ }
141
+ }
142
+ else {
143
+ this.statusBarEntry.clear();
144
+ }
145
+ }
146
+ registerActions() {
147
+ const $this = this;
148
+ this._register(registerAction2(class extends Action2 {
149
+ constructor() {
150
+ super({
151
+ id: 'workbench.action.toggleLockedScrolling',
152
+ title: {
153
+ ...( localize2WithPath(
154
+ 'vs/workbench/contrib/scrollLocking/browser/scrollLocking',
155
+ 'toggleLockedScrolling',
156
+ "Toggle Locked Scrolling Across Editors"
157
+ )),
158
+ mnemonicTitle: ( localizeWithPath(
159
+ 'vs/workbench/contrib/scrollLocking/browser/scrollLocking',
160
+ { key: 'miToggleLockedScrolling', comment: ['&& denotes a mnemonic'] },
161
+ "Locked Scrolling"
162
+ )),
163
+ },
164
+ category: Categories.View,
165
+ f1: true
166
+ });
167
+ }
168
+ run() {
169
+ $this.toggle();
170
+ }
171
+ }));
172
+ this._register(registerAction2(class extends Action2 {
173
+ constructor() {
174
+ super({
175
+ id: 'workbench.action.holdLockedScrolling',
176
+ title: {
177
+ ...( localize2WithPath(
178
+ 'vs/workbench/contrib/scrollLocking/browser/scrollLocking',
179
+ 'holdLockedScrolling',
180
+ "Hold Locked Scrolling Across Editors"
181
+ )),
182
+ mnemonicTitle: ( localizeWithPath(
183
+ 'vs/workbench/contrib/scrollLocking/browser/scrollLocking',
184
+ { key: 'miHoldLockedScrolling', comment: ['&& denotes a mnemonic'] },
185
+ "Locked Scrolling"
186
+ )),
187
+ },
188
+ category: Categories.View,
189
+ });
190
+ }
191
+ run(accessor) {
192
+ const keybindingService = accessor.get(IKeybindingService);
193
+ $this.toggle();
194
+ const holdMode = keybindingService.enableKeybindingHoldMode('workbench.action.holdLockedScrolling');
195
+ if (!holdMode) {
196
+ return;
197
+ }
198
+ holdMode.finally(() => {
199
+ $this.toggle();
200
+ });
201
+ }
202
+ }));
203
+ }
204
+ dispose() {
205
+ this.deactivate();
206
+ super.dispose();
207
+ }
208
+ };
209
+ SyncScroll = ( __decorate([
210
+ ( __param(0, IEditorService)),
211
+ ( __param(1, IStatusbarService))
212
+ ], SyncScroll));
213
+
214
+ export { SyncScroll };
@@ -0,0 +1,117 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { onDidChangeFullscreen, isFullscreen } from 'vscode/vscode/vs/base/browser/browser';
3
+ import { getTotalHeight, getTotalWidth, runWhenWindowIdle } from 'vscode/vscode/vs/base/browser/dom';
4
+ import { Color } from 'vscode/vscode/vs/base/common/color';
5
+ import { Event } from 'vscode/vscode/vs/base/common/event';
6
+ import { DisposableStore, MutableDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
7
+ import 'vscode/vscode/vs/platform/theme/common/colorUtils';
8
+ import { foreground } from 'vscode/vscode/vs/platform/theme/common/colors/baseColors';
9
+ import 'vscode/vscode/vs/platform/theme/common/colors/chartsColors';
10
+ import { editorBackground } from 'vscode/vscode/vs/platform/theme/common/colors/editorColors';
11
+ import 'vscode/vscode/vs/platform/theme/common/colors/inputColors';
12
+ import 'vscode/vscode/vs/platform/theme/common/colors/listColors';
13
+ import 'vscode/vscode/vs/platform/theme/common/colors/menuColors';
14
+ import 'vscode/vscode/vs/platform/theme/common/colors/minimapColors';
15
+ import 'vscode/vscode/vs/platform/theme/common/colors/miscColors';
16
+ import 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
17
+ import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
18
+ import { getThemeTypeSelector, IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
19
+ import { DEFAULT_EDITOR_MIN_DIMENSIONS } from 'vscode/vscode/vs/workbench/browser/parts/editor/editor';
20
+ import { WORKBENCH_BACKGROUND, TITLE_BAR_ACTIVE_BACKGROUND, ACTIVITY_BAR_BACKGROUND, SIDE_BAR_BACKGROUND, STATUS_BAR_BACKGROUND, STATUS_BAR_NO_FOLDER_BACKGROUND, WINDOW_ACTIVE_BORDER, WINDOW_INACTIVE_BORDER } from 'vscode/vscode/vs/workbench/common/theme';
21
+ import { IWorkbenchLayoutService } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService';
22
+ import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService';
23
+ import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
24
+ import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
25
+ import { mark } from 'vscode/vscode/vs/base/common/performance';
26
+ import { assertIsDefined } from 'vscode/vscode/vs/base/common/types';
27
+ import { ISplashStorageService } from './splash.js';
28
+ import { mainWindow } from 'vscode/vscode/vs/base/browser/window';
29
+ import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
30
+
31
+ var PartsSplash_1;
32
+ let PartsSplash = class PartsSplash {
33
+ static { PartsSplash_1 = this; }
34
+ static { this.ID = 'workbench.contrib.partsSplash'; }
35
+ static { this._splashElementId = 'monaco-parts-splash'; }
36
+ constructor(_themeService, _layoutService, _environmentService, _configService, _partSplashService, editorGroupsService, lifecycleService) {
37
+ this._themeService = _themeService;
38
+ this._layoutService = _layoutService;
39
+ this._environmentService = _environmentService;
40
+ this._configService = _configService;
41
+ this._partSplashService = _partSplashService;
42
+ this._disposables = ( new DisposableStore());
43
+ Event.once(_layoutService.onDidLayoutMainContainer)(() => {
44
+ this._removePartsSplash();
45
+ mark('code/didRemovePartsSplash');
46
+ }, undefined, this._disposables);
47
+ const lastIdleSchedule = this._disposables.add(( new MutableDisposable()));
48
+ const savePartsSplashSoon = () => {
49
+ lastIdleSchedule.value = runWhenWindowIdle(mainWindow, () => this._savePartsSplash(), 2500);
50
+ };
51
+ lifecycleService.when(3 ).then(() => {
52
+ Event.any(Event.filter(onDidChangeFullscreen, windowId => windowId === mainWindow.vscodeWindowId), editorGroupsService.mainPart.onDidLayout, _themeService.onDidColorThemeChange)(savePartsSplashSoon, undefined, this._disposables);
53
+ savePartsSplashSoon();
54
+ });
55
+ _configService.onDidChangeConfiguration(e => {
56
+ if (e.affectsConfiguration("window.titleBarStyle" )) {
57
+ this._didChangeTitleBarStyle = true;
58
+ this._savePartsSplash();
59
+ }
60
+ }, this, this._disposables);
61
+ }
62
+ dispose() {
63
+ this._disposables.dispose();
64
+ }
65
+ _savePartsSplash() {
66
+ const theme = this._themeService.getColorTheme();
67
+ this._partSplashService.saveWindowSplash({
68
+ zoomLevel: this._configService.getValue('window.zoomLevel'),
69
+ baseTheme: getThemeTypeSelector(theme.type),
70
+ colorInfo: {
71
+ foreground: theme.getColor(foreground)?.toString(),
72
+ background: Color.Format.CSS.formatHex(theme.getColor(editorBackground) || WORKBENCH_BACKGROUND(theme)),
73
+ editorBackground: theme.getColor(editorBackground)?.toString(),
74
+ titleBarBackground: theme.getColor(TITLE_BAR_ACTIVE_BACKGROUND)?.toString(),
75
+ activityBarBackground: theme.getColor(ACTIVITY_BAR_BACKGROUND)?.toString(),
76
+ sideBarBackground: theme.getColor(SIDE_BAR_BACKGROUND)?.toString(),
77
+ statusBarBackground: theme.getColor(STATUS_BAR_BACKGROUND)?.toString(),
78
+ statusBarNoFolderBackground: theme.getColor(STATUS_BAR_NO_FOLDER_BACKGROUND)?.toString(),
79
+ windowBorder: theme.getColor(WINDOW_ACTIVE_BORDER)?.toString() ?? theme.getColor(WINDOW_INACTIVE_BORDER)?.toString()
80
+ },
81
+ layoutInfo: !this._shouldSaveLayoutInfo() ? undefined : {
82
+ sideBarSide: this._layoutService.getSideBarPosition() === 1 ? 'right' : 'left',
83
+ editorPartMinWidth: DEFAULT_EDITOR_MIN_DIMENSIONS.width,
84
+ titleBarHeight: this._layoutService.isVisible("workbench.parts.titlebar" , mainWindow) ? getTotalHeight(assertIsDefined(this._layoutService.getContainer(mainWindow, "workbench.parts.titlebar" ))) : 0,
85
+ activityBarWidth: this._layoutService.isVisible("workbench.parts.activitybar" ) ? getTotalWidth(assertIsDefined(this._layoutService.getContainer(mainWindow, "workbench.parts.activitybar" ))) : 0,
86
+ sideBarWidth: this._layoutService.isVisible("workbench.parts.sidebar" ) ? getTotalWidth(assertIsDefined(this._layoutService.getContainer(mainWindow, "workbench.parts.sidebar" ))) : 0,
87
+ statusBarHeight: this._layoutService.isVisible("workbench.parts.statusbar" , mainWindow) ? getTotalHeight(assertIsDefined(this._layoutService.getContainer(mainWindow, "workbench.parts.statusbar" ))) : 0,
88
+ windowBorder: this._layoutService.hasMainWindowBorder(),
89
+ windowBorderRadius: this._layoutService.getMainWindowBorderRadius()
90
+ }
91
+ });
92
+ }
93
+ _shouldSaveLayoutInfo() {
94
+ return !isFullscreen(mainWindow) && !this._environmentService.isExtensionDevelopment && !this._didChangeTitleBarStyle;
95
+ }
96
+ _removePartsSplash() {
97
+ const element = mainWindow.document.getElementById(PartsSplash_1._splashElementId);
98
+ if (element) {
99
+ element.style.display = 'none';
100
+ }
101
+ const defaultStyles = mainWindow.document.head.getElementsByClassName('initialShellColors');
102
+ if (defaultStyles.length) {
103
+ mainWindow.document.head.removeChild(defaultStyles[0]);
104
+ }
105
+ }
106
+ };
107
+ PartsSplash = PartsSplash_1 = ( __decorate([
108
+ ( __param(0, IThemeService)),
109
+ ( __param(1, IWorkbenchLayoutService)),
110
+ ( __param(2, IWorkbenchEnvironmentService)),
111
+ ( __param(3, IConfigurationService)),
112
+ ( __param(4, ISplashStorageService)),
113
+ ( __param(5, IEditorGroupsService)),
114
+ ( __param(6, ILifecycleService))
115
+ ], PartsSplash));
116
+
117
+ export { PartsSplash };
@@ -0,0 +1,5 @@
1
+ import { registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
2
+ import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
3
+ import { PartsSplash } from './partsSplash.js';
4
+
5
+ registerWorkbenchContribution2(PartsSplash.ID, PartsSplash, 1 );
@@ -0,0 +1,5 @@
1
+ import { createDecorator } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
2
+
3
+ const ISplashStorageService = ( createDecorator('ISplashStorageService'));
4
+
5
+ export { ISplashStorageService };
@@ -0,0 +1,227 @@
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 { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
5
+ import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
6
+ import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
7
+ import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
8
+ import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
9
+ import { IWorkbenchThemeService } from 'vscode/vscode/vs/workbench/services/themes/common/workbenchThemeService';
10
+ import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService';
11
+ import { language } from 'vscode/vscode/vs/base/common/platform';
12
+ import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
13
+ import ErrorTelemetry from '../../../../platform/telemetry/browser/errorTelemetry.js';
14
+ import { TelemetryTrustedValue } from 'vscode/vscode/vs/platform/telemetry/common/telemetryUtils';
15
+ import { ConfigurationTargetToString, IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
16
+ import { ITextFileService } from 'vscode/vscode/vs/workbench/services/textfile/common/textfiles';
17
+ import { extname, isEqual, isEqualOrParent, basename } from 'vscode/vscode/vs/base/common/resources';
18
+ import { Event } from 'vscode/vscode/vs/base/common/event';
19
+ import { Schemas } from 'vscode/vscode/vs/base/common/network';
20
+ import { getMimeTypes } from 'vscode/vscode/vs/editor/common/services/languagesAssociations';
21
+ import { hash } from 'vscode/vscode/vs/base/common/hash';
22
+ import { IPaneCompositePartService } from 'vscode/vscode/vs/workbench/services/panecomposite/browser/panecomposite';
23
+ import { IUserDataProfileService } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile';
24
+ import { mainWindow } from 'vscode/vscode/vs/base/browser/window';
25
+ import { Extensions as Extensions$1 } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
26
+ import { isNumber, isBoolean, isString } from 'vscode/vscode/vs/base/common/types';
27
+ import { AutoUpdateConfigurationKey } from 'vscode/vscode/vs/workbench/contrib/extensions/common/extensions';
28
+ import { KEYWORD_ACTIVIATION_SETTING_ID } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatService';
29
+
30
+ var TelemetryContribution_1;
31
+ let TelemetryContribution = class TelemetryContribution extends Disposable {
32
+ static { TelemetryContribution_1 = this; }
33
+ static { this.ALLOWLIST_JSON = ['package.json', 'package-lock.json', 'tsconfig.json', 'jsconfig.json', 'bower.json', '.eslintrc.json', 'tslint.json', 'composer.json']; }
34
+ static { this.ALLOWLIST_WORKSPACE_JSON = ['settings.json', 'extensions.json', 'tasks.json', 'launch.json']; }
35
+ constructor(telemetryService, contextService, lifecycleService, editorService, keybindingsService, themeService, environmentService, userDataProfileService, paneCompositeService, textFileService) {
36
+ super();
37
+ this.telemetryService = telemetryService;
38
+ this.contextService = contextService;
39
+ this.userDataProfileService = userDataProfileService;
40
+ const { filesToOpenOrCreate, filesToDiff, filesToMerge } = environmentService;
41
+ const activeViewlet = paneCompositeService.getActivePaneComposite(0 );
42
+ telemetryService.publicLog2('workspaceLoad', {
43
+ windowSize: { innerHeight: mainWindow.innerHeight, innerWidth: mainWindow.innerWidth, outerHeight: mainWindow.outerHeight, outerWidth: mainWindow.outerWidth },
44
+ emptyWorkbench: contextService.getWorkbenchState() === 1 ,
45
+ 'workbench.filesToOpenOrCreate': filesToOpenOrCreate && filesToOpenOrCreate.length || 0,
46
+ 'workbench.filesToDiff': filesToDiff && filesToDiff.length || 0,
47
+ 'workbench.filesToMerge': filesToMerge && filesToMerge.length || 0,
48
+ customKeybindingsCount: keybindingsService.customKeybindingsCount(),
49
+ theme: themeService.getColorTheme().id,
50
+ language,
51
+ pinnedViewlets: paneCompositeService.getPinnedPaneCompositeIds(0 ),
52
+ restoredViewlet: activeViewlet ? activeViewlet.getId() : undefined,
53
+ restoredEditors: editorService.visibleEditors.length,
54
+ startupKind: lifecycleService.startupKind
55
+ });
56
+ this._register(( new ErrorTelemetry(telemetryService)));
57
+ this._register(textFileService.files.onDidResolve(e => this.onTextFileModelResolved(e)));
58
+ this._register(textFileService.files.onDidSave(e => this.onTextFileModelSaved(e)));
59
+ this._register(lifecycleService.onDidShutdown(() => this.dispose()));
60
+ }
61
+ onTextFileModelResolved(e) {
62
+ const settingsType = this.getTypeIfSettings(e.model.resource);
63
+ if (settingsType) {
64
+ this.telemetryService.publicLog2('settingsRead', { settingsType });
65
+ }
66
+ else {
67
+ this.telemetryService.publicLog2('fileGet', this.getTelemetryData(e.model.resource, e.reason));
68
+ }
69
+ }
70
+ onTextFileModelSaved(e) {
71
+ const settingsType = this.getTypeIfSettings(e.model.resource);
72
+ if (settingsType) {
73
+ this.telemetryService.publicLog2('settingsWritten', { settingsType });
74
+ }
75
+ else {
76
+ this.telemetryService.publicLog2('filePUT', this.getTelemetryData(e.model.resource, e.reason));
77
+ }
78
+ }
79
+ getTypeIfSettings(resource) {
80
+ if (extname(resource) !== '.json') {
81
+ return '';
82
+ }
83
+ if (isEqual(resource, this.userDataProfileService.currentProfile.settingsResource)) {
84
+ return 'global-settings';
85
+ }
86
+ if (isEqual(resource, this.userDataProfileService.currentProfile.keybindingsResource)) {
87
+ return 'keybindings';
88
+ }
89
+ if (isEqualOrParent(resource, this.userDataProfileService.currentProfile.snippetsHome)) {
90
+ return 'snippets';
91
+ }
92
+ const folders = this.contextService.getWorkspace().folders;
93
+ for (const folder of folders) {
94
+ if (isEqualOrParent(resource, folder.toResource('.vscode'))) {
95
+ const filename = basename(resource);
96
+ if (TelemetryContribution_1.ALLOWLIST_WORKSPACE_JSON.indexOf(filename) > -1) {
97
+ return `.vscode/${filename}`;
98
+ }
99
+ }
100
+ }
101
+ return '';
102
+ }
103
+ getTelemetryData(resource, reason) {
104
+ let ext = extname(resource);
105
+ const queryStringLocation = ext.indexOf('?');
106
+ ext = queryStringLocation !== -1 ? ext.substr(0, queryStringLocation) : ext;
107
+ const fileName = basename(resource);
108
+ const path = resource.scheme === Schemas.file ? resource.fsPath : resource.path;
109
+ const telemetryData = {
110
+ mimeType: ( new TelemetryTrustedValue(getMimeTypes(resource).join(', '))),
111
+ ext,
112
+ path: hash(path),
113
+ reason,
114
+ allowlistedjson: undefined
115
+ };
116
+ if (ext === '.json' && TelemetryContribution_1.ALLOWLIST_JSON.indexOf(fileName) > -1) {
117
+ telemetryData['allowlistedjson'] = fileName;
118
+ }
119
+ return telemetryData;
120
+ }
121
+ };
122
+ TelemetryContribution = TelemetryContribution_1 = ( __decorate([
123
+ ( __param(0, ITelemetryService)),
124
+ ( __param(1, IWorkspaceContextService)),
125
+ ( __param(2, ILifecycleService)),
126
+ ( __param(3, IEditorService)),
127
+ ( __param(4, IKeybindingService)),
128
+ ( __param(5, IWorkbenchThemeService)),
129
+ ( __param(6, IWorkbenchEnvironmentService)),
130
+ ( __param(7, IUserDataProfileService)),
131
+ ( __param(8, IPaneCompositePartService)),
132
+ ( __param(9, ITextFileService))
133
+ ], TelemetryContribution));
134
+ let ConfigurationTelemetryContribution = class ConfigurationTelemetryContribution extends Disposable {
135
+ constructor(configurationService, telemetryService) {
136
+ super();
137
+ this.configurationService = configurationService;
138
+ this.telemetryService = telemetryService;
139
+ this.configurationRegistry = ( Registry.as(Extensions$1.Configuration));
140
+ const debouncedConfigService = Event.debounce(configurationService.onDidChangeConfiguration, (last, cur) => {
141
+ const newAffectedKeys = last ? ( new Set([...last.affectedKeys, ...cur.affectedKeys])) : cur.affectedKeys;
142
+ return { ...cur, affectedKeys: newAffectedKeys };
143
+ }, 1000, true);
144
+ this._register(debouncedConfigService(event => {
145
+ if (event.source !== 7 ) {
146
+ telemetryService.publicLog2('updateConfiguration', {
147
+ configurationSource: ConfigurationTargetToString(event.source),
148
+ configurationKeys: Array.from(event.affectedKeys)
149
+ });
150
+ }
151
+ }));
152
+ const { user, workspace } = ( configurationService.keys());
153
+ for (const setting of user) {
154
+ this.reportTelemetry(setting, 3 );
155
+ }
156
+ for (const setting of workspace) {
157
+ this.reportTelemetry(setting, 5 );
158
+ }
159
+ }
160
+ getValueToReport(key, target) {
161
+ const inpsectData = this.configurationService.inspect(key);
162
+ const value = target === 3 ? inpsectData.user?.value : inpsectData.workspace?.value;
163
+ if (isNumber(value) || isBoolean(value)) {
164
+ return ( value.toString());
165
+ }
166
+ const schema = this.configurationRegistry.getConfigurationProperties()[key];
167
+ if (isString(value)) {
168
+ if (schema?.enum?.includes(value)) {
169
+ return value;
170
+ }
171
+ return undefined;
172
+ }
173
+ if (Array.isArray(value)) {
174
+ if (value.every(v => isNumber(v) || isBoolean(v) || (isString(v) && schema?.enum?.includes(v)))) {
175
+ return JSON.stringify(value);
176
+ }
177
+ }
178
+ return undefined;
179
+ }
180
+ reportTelemetry(key, target) {
181
+ const source = ConfigurationTargetToString(target);
182
+ switch (key) {
183
+ case "workbench.activityBar.location" :
184
+ this.telemetryService.publicLog2('workbench.activityBar.location', { settingValue: this.getValueToReport(key, target), source });
185
+ return;
186
+ case AutoUpdateConfigurationKey:
187
+ this.telemetryService.publicLog2('extensions.autoUpdate', { settingValue: this.getValueToReport(key, target), source });
188
+ return;
189
+ case 'files.autoSave':
190
+ this.telemetryService.publicLog2('files.autoSave', { settingValue: this.getValueToReport(key, target), source });
191
+ return;
192
+ case 'editor.stickyScroll.enabled':
193
+ this.telemetryService.publicLog2('editor.stickyScroll.enabled', { settingValue: this.getValueToReport(key, target), source });
194
+ return;
195
+ case KEYWORD_ACTIVIATION_SETTING_ID:
196
+ this.telemetryService.publicLog2('accessibility.voice.keywordActivation', { settingValue: this.getValueToReport(key, target), source });
197
+ return;
198
+ case 'window.zoomLevel':
199
+ this.telemetryService.publicLog2('window.zoomLevel', { settingValue: this.getValueToReport(key, target), source });
200
+ return;
201
+ case 'window.zoomPerWindow':
202
+ this.telemetryService.publicLog2('window.zoomPerWindow', { settingValue: this.getValueToReport(key, target), source });
203
+ return;
204
+ case 'window.titleBarStyle':
205
+ this.telemetryService.publicLog2('window.titleBarStyle', { settingValue: this.getValueToReport(key, target), source });
206
+ return;
207
+ case 'window.customTitleBarVisibility':
208
+ this.telemetryService.publicLog2('window.customTitleBarVisibility', { settingValue: this.getValueToReport(key, target), source });
209
+ return;
210
+ case 'window.nativeTabs':
211
+ this.telemetryService.publicLog2('window.nativeTabs', { settingValue: this.getValueToReport(key, target), source });
212
+ return;
213
+ case 'extensions.verifySignature':
214
+ this.telemetryService.publicLog2('extensions.verifySignature', { settingValue: this.getValueToReport(key, target), source });
215
+ return;
216
+ }
217
+ }
218
+ };
219
+ ConfigurationTelemetryContribution = ( __decorate([
220
+ ( __param(0, IConfigurationService)),
221
+ ( __param(1, ITelemetryService))
222
+ ], ConfigurationTelemetryContribution));
223
+ const workbenchContributionRegistry = ( Registry.as(Extensions.Workbench));
224
+ workbenchContributionRegistry.registerWorkbenchContribution(TelemetryContribution, 3 );
225
+ workbenchContributionRegistry.registerWorkbenchContribution(ConfigurationTelemetryContribution, 4 );
226
+
227
+ export { TelemetryContribution };
@@ -0,0 +1,9 @@
1
+ import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
2
+ import { Extensions, registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
3
+ import { UserDataProfilesWorkbenchContribution } from './userDataProfile.js';
4
+ import './userDataProfileActions.js';
5
+ import { UserDataProfilePreviewContribution } from './userDataProfilePreview.js';
6
+
7
+ const workbenchRegistry = ( Registry.as(Extensions.Workbench));
8
+ registerWorkbenchContribution2(UserDataProfilesWorkbenchContribution.ID, UserDataProfilesWorkbenchContribution, 2 );
9
+ workbenchRegistry.registerWorkbenchContribution(UserDataProfilePreviewContribution, 3 );