@codingame/monaco-vscode-a3eaa464-944c-5b8f-8886-213068ba4897-common 16.1.0-shadow-root.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/empty.js ADDED
@@ -0,0 +1 @@
1
+ export {}
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@codingame/monaco-vscode-a3eaa464-944c-5b8f-8886-213068ba4897-common",
3
+ "version": "16.1.0-shadow-root.1",
4
+ "private": false,
5
+ "description": "VSCode public API plugged on the monaco editor - common package (keybindings, preferences)",
6
+ "keywords": [],
7
+ "author": {
8
+ "name": "CodinGame",
9
+ "url": "http://www.codingame.com"
10
+ },
11
+ "license": "MIT",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+ssh://git@github.com/CodinGame/monaco-vscode-api.git"
15
+ },
16
+ "type": "module",
17
+ "dependencies": {
18
+ "@codingame/monaco-vscode-api": "16.1.0-shadow-root.1"
19
+ },
20
+ "exports": {
21
+ ".": {
22
+ "default": "./empty.js"
23
+ },
24
+ "./vscode/*.css": {
25
+ "default": "./vscode/src/*.css"
26
+ },
27
+ "./vscode/*": {
28
+ "types": "./vscode/src/*.d.ts",
29
+ "default": "./vscode/src/*.js"
30
+ },
31
+ "./*": {
32
+ "types": "./*.d.ts",
33
+ "default": "./*.js"
34
+ }
35
+ },
36
+ "typesVersions": {
37
+ "*": {
38
+ "vscode/*": [
39
+ "./vscode/src/*.d.ts"
40
+ ]
41
+ }
42
+ }
43
+ }
@@ -0,0 +1,73 @@
1
+ import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
2
+ import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event";
3
+ import { Widget } from "@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/widget";
4
+ import { ResolvedKeybinding } from "@codingame/monaco-vscode-api/vscode/vs/base/common/keybindings";
5
+ import * as dom from "@codingame/monaco-vscode-api/vscode/vs/base/browser/dom";
6
+ import { IKeybindingService } from "@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service";
7
+ import { IContextViewService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service";
8
+ import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
9
+ import { ICodeEditor, IOverlayWidget, IOverlayWidgetPosition } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorBrowser";
10
+ import { SearchWidget, SearchOptions } from "./preferencesWidgets.js";
11
+ import { IContextKeyService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service";
12
+ export interface KeybindingsSearchOptions extends SearchOptions {
13
+ recordEnter?: boolean;
14
+ quoteRecordedKeys?: boolean;
15
+ }
16
+ export declare class KeybindingsSearchWidget extends SearchWidget {
17
+ private _chords;
18
+ private _inputValue;
19
+ private readonly recordDisposables;
20
+ private _onKeybinding;
21
+ readonly onKeybinding: Event<ResolvedKeybinding[] | null>;
22
+ private _onEnter;
23
+ readonly onEnter: Event<void>;
24
+ private _onEscape;
25
+ readonly onEscape: Event<void>;
26
+ private _onBlur;
27
+ readonly onBlur: Event<void>;
28
+ constructor(parent: HTMLElement, options: KeybindingsSearchOptions, contextViewService: IContextViewService, instantiationService: IInstantiationService, contextKeyService: IContextKeyService, keybindingService: IKeybindingService);
29
+ clear(): void;
30
+ startRecordingKeys(): void;
31
+ stopRecordingKeys(): void;
32
+ setInputValue(value: string): void;
33
+ private _onKeyDown;
34
+ private printKeybinding;
35
+ }
36
+ export declare class DefineKeybindingWidget extends Widget {
37
+ private readonly instantiationService;
38
+ private static readonly WIDTH;
39
+ private static readonly HEIGHT;
40
+ private _domNode;
41
+ private _keybindingInputWidget;
42
+ private _outputNode;
43
+ private _showExistingKeybindingsNode;
44
+ private readonly _keybindingDisposables;
45
+ private _chords;
46
+ private _isVisible;
47
+ private _onHide;
48
+ private _onDidChange;
49
+ onDidChange: Event<string>;
50
+ private _onShowExistingKeybindings;
51
+ readonly onShowExistingKeybidings: Event<string | null>;
52
+ constructor(parent: HTMLElement | null, instantiationService: IInstantiationService);
53
+ get domNode(): HTMLElement;
54
+ define(): Promise<string | null>;
55
+ layout(layout: dom.Dimension): void;
56
+ printExisting(numberOfExisting: number): void;
57
+ private onKeybinding;
58
+ private getUserSettingsLabel;
59
+ private onCancel;
60
+ private clearOrHide;
61
+ private hide;
62
+ }
63
+ export declare class DefineKeybindingOverlayWidget extends Disposable implements IOverlayWidget {
64
+ private _editor;
65
+ private static readonly ID;
66
+ private readonly _widget;
67
+ constructor(_editor: ICodeEditor, instantiationService: IInstantiationService);
68
+ getId(): string;
69
+ getDomNode(): HTMLElement;
70
+ getPosition(): IOverlayWidgetPosition;
71
+ dispose(): void;
72
+ start(): Promise<string | null>;
73
+ }
@@ -0,0 +1,280 @@
1
+
2
+ import { registerCss } from '@codingame/monaco-vscode-api/css';
3
+ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
4
+ import * as keybindings from './media/keybindings.css';
5
+ import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
6
+ import { OS } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
7
+ import { DisposableStore, toDisposable, Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
8
+ import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
9
+ import { KeybindingLabel } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/keybindingLabel/keybindingLabel';
10
+ import { Widget } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/widget';
11
+ import { KeyCode } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
12
+ import { addDisposableListener, EventType, append, $, clearNode, Dimension } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
13
+ import { alert } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/aria/aria';
14
+ import { StandardKeyboardEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/keyboardEvent';
15
+ import { createFastDomNode } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/fastDomNode';
16
+ import { IKeybindingService } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service';
17
+ import { IContextViewService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service';
18
+ import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
19
+ import { asCssVariable } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colorUtils';
20
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/baseColors';
21
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/chartsColors';
22
+ import { editorWidgetBackground, editorWidgetForeground, widgetShadow } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/editorColors';
23
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/inputColors';
24
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/listColors';
25
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/menuColors';
26
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/minimapColors';
27
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/miscColors';
28
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/quickpickColors';
29
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/searchColors';
30
+ import { ScrollType } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/editorCommon';
31
+ import { SearchWidget } from './preferencesWidgets.js';
32
+ import { Promises, timeout } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
33
+ import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
34
+ import { defaultInputBoxStyles, defaultKeybindingLabelStyles } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/browser/defaultStyles';
35
+
36
+ var DefineKeybindingWidget_1, DefineKeybindingOverlayWidget_1;
37
+ registerCss(keybindings);
38
+ let KeybindingsSearchWidget = class KeybindingsSearchWidget extends SearchWidget {
39
+ constructor(parent, options, contextViewService, instantiationService, contextKeyService, keybindingService) {
40
+ super(parent, options, contextViewService, instantiationService, contextKeyService, keybindingService);
41
+ this.recordDisposables = this._register(( new DisposableStore()));
42
+ this._onKeybinding = this._register(( new Emitter()));
43
+ this.onKeybinding = this._onKeybinding.event;
44
+ this._onEnter = this._register(( new Emitter()));
45
+ this.onEnter = this._onEnter.event;
46
+ this._onEscape = this._register(( new Emitter()));
47
+ this.onEscape = this._onEscape.event;
48
+ this._onBlur = this._register(( new Emitter()));
49
+ this.onBlur = this._onBlur.event;
50
+ this._register(toDisposable(() => this.stopRecordingKeys()));
51
+ this._chords = null;
52
+ this._inputValue = '';
53
+ }
54
+ clear() {
55
+ this._chords = null;
56
+ super.clear();
57
+ }
58
+ startRecordingKeys() {
59
+ this.recordDisposables.add(addDisposableListener(this.inputBox.inputElement, EventType.KEY_DOWN, (e) => this._onKeyDown(( new StandardKeyboardEvent(e)))));
60
+ this.recordDisposables.add(addDisposableListener(this.inputBox.inputElement, EventType.BLUR, () => this._onBlur.fire()));
61
+ this.recordDisposables.add(addDisposableListener(this.inputBox.inputElement, EventType.INPUT, () => {
62
+ this.setInputValue(this._inputValue);
63
+ }));
64
+ }
65
+ stopRecordingKeys() {
66
+ this._chords = null;
67
+ this.recordDisposables.clear();
68
+ }
69
+ setInputValue(value) {
70
+ this._inputValue = value;
71
+ this.inputBox.value = this._inputValue;
72
+ }
73
+ _onKeyDown(keyboardEvent) {
74
+ keyboardEvent.preventDefault();
75
+ keyboardEvent.stopPropagation();
76
+ const options = this.options;
77
+ if (!options.recordEnter && keyboardEvent.equals(KeyCode.Enter)) {
78
+ this._onEnter.fire();
79
+ return;
80
+ }
81
+ if (keyboardEvent.equals(KeyCode.Escape)) {
82
+ this._onEscape.fire();
83
+ return;
84
+ }
85
+ this.printKeybinding(keyboardEvent);
86
+ }
87
+ printKeybinding(keyboardEvent) {
88
+ const keybinding = this.keybindingService.resolveKeyboardEvent(keyboardEvent);
89
+ const info = `code: ${keyboardEvent.browserEvent.code}, keyCode: ${keyboardEvent.browserEvent.keyCode}, key: ${keyboardEvent.browserEvent.key} => UI: ${keybinding.getAriaLabel()}, user settings: ${keybinding.getUserSettingsLabel()}, dispatch: ${keybinding.getDispatchChords()[0]}`;
90
+ const options = this.options;
91
+ if (!this._chords) {
92
+ this._chords = [];
93
+ }
94
+ const hasIncompleteChord = this._chords.length > 0 && this._chords[this._chords.length - 1].getDispatchChords()[0] === null;
95
+ if (hasIncompleteChord) {
96
+ this._chords[this._chords.length - 1] = keybinding;
97
+ }
98
+ else {
99
+ if (this._chords.length === 2) {
100
+ this._chords = [];
101
+ }
102
+ this._chords.push(keybinding);
103
+ }
104
+ const value = ( this._chords.map((keybinding) => keybinding.getUserSettingsLabel() || '')).join(' ');
105
+ this.setInputValue(options.quoteRecordedKeys ? `"${value}"` : value);
106
+ this.inputBox.inputElement.title = info;
107
+ this._onKeybinding.fire(this._chords);
108
+ }
109
+ };
110
+ KeybindingsSearchWidget = ( __decorate([
111
+ ( __param(2, IContextViewService)),
112
+ ( __param(3, IInstantiationService)),
113
+ ( __param(4, IContextKeyService)),
114
+ ( __param(5, IKeybindingService))
115
+ ], KeybindingsSearchWidget));
116
+ let DefineKeybindingWidget = class DefineKeybindingWidget extends Widget {
117
+ static { DefineKeybindingWidget_1 = this; }
118
+ static { this.WIDTH = 400; }
119
+ static { this.HEIGHT = 110; }
120
+ constructor(parent, instantiationService) {
121
+ super();
122
+ this.instantiationService = instantiationService;
123
+ this._keybindingDisposables = this._register(( new DisposableStore()));
124
+ this._chords = null;
125
+ this._isVisible = false;
126
+ this._onHide = this._register(( new Emitter()));
127
+ this._onDidChange = this._register(( new Emitter()));
128
+ this.onDidChange = this._onDidChange.event;
129
+ this._onShowExistingKeybindings = this._register(( new Emitter()));
130
+ this.onShowExistingKeybidings = this._onShowExistingKeybindings.event;
131
+ this._domNode = createFastDomNode(document.createElement('div'));
132
+ this._domNode.setDisplay('none');
133
+ this._domNode.setClassName('defineKeybindingWidget');
134
+ this._domNode.setWidth(DefineKeybindingWidget_1.WIDTH);
135
+ this._domNode.setHeight(DefineKeybindingWidget_1.HEIGHT);
136
+ const message = ( localize(8436, "Press desired key combination and then press ENTER."));
137
+ append(this._domNode.domNode, $('.message', undefined, message));
138
+ this._domNode.domNode.style.backgroundColor = asCssVariable(editorWidgetBackground);
139
+ this._domNode.domNode.style.color = asCssVariable(editorWidgetForeground);
140
+ this._domNode.domNode.style.boxShadow = `0 2px 8px ${asCssVariable(widgetShadow)}`;
141
+ this._keybindingInputWidget = this._register(this.instantiationService.createInstance(KeybindingsSearchWidget, this._domNode.domNode, { ariaLabel: message, history: ( new Set([])), inputBoxStyles: defaultInputBoxStyles }));
142
+ this._keybindingInputWidget.startRecordingKeys();
143
+ this._register(this._keybindingInputWidget.onKeybinding(keybinding => this.onKeybinding(keybinding)));
144
+ this._register(this._keybindingInputWidget.onEnter(() => this.hide()));
145
+ this._register(this._keybindingInputWidget.onEscape(() => this.clearOrHide()));
146
+ this._register(this._keybindingInputWidget.onBlur(() => this.onCancel()));
147
+ this._outputNode = append(this._domNode.domNode, $('.output'));
148
+ this._showExistingKeybindingsNode = append(this._domNode.domNode, $('.existing'));
149
+ if (parent) {
150
+ append(parent, this._domNode.domNode);
151
+ }
152
+ }
153
+ get domNode() {
154
+ return this._domNode.domNode;
155
+ }
156
+ define() {
157
+ this._keybindingInputWidget.clear();
158
+ return Promises.withAsyncBody(async (c) => {
159
+ if (!this._isVisible) {
160
+ this._isVisible = true;
161
+ this._domNode.setDisplay('block');
162
+ this._chords = null;
163
+ this._keybindingInputWidget.setInputValue('');
164
+ clearNode(this._outputNode);
165
+ clearNode(this._showExistingKeybindingsNode);
166
+ await timeout(0);
167
+ this._keybindingInputWidget.focus();
168
+ }
169
+ const disposable = this._onHide.event(() => {
170
+ c(this.getUserSettingsLabel());
171
+ disposable.dispose();
172
+ });
173
+ });
174
+ }
175
+ layout(layout) {
176
+ const top = Math.round((layout.height - DefineKeybindingWidget_1.HEIGHT) / 2);
177
+ this._domNode.setTop(top);
178
+ const left = Math.round((layout.width - DefineKeybindingWidget_1.WIDTH) / 2);
179
+ this._domNode.setLeft(left);
180
+ }
181
+ printExisting(numberOfExisting) {
182
+ if (numberOfExisting > 0) {
183
+ const existingElement = $('span.existingText');
184
+ const text = numberOfExisting === 1 ? ( localize(8437, "1 existing command has this keybinding", numberOfExisting)) : ( localize(8438, "{0} existing commands have this keybinding", numberOfExisting));
185
+ append(existingElement, document.createTextNode(text));
186
+ alert(text);
187
+ this._showExistingKeybindingsNode.appendChild(existingElement);
188
+ existingElement.onmousedown = (e) => { e.preventDefault(); };
189
+ existingElement.onmouseup = (e) => { e.preventDefault(); };
190
+ existingElement.onclick = () => { this._onShowExistingKeybindings.fire(this.getUserSettingsLabel()); };
191
+ }
192
+ }
193
+ onKeybinding(keybinding) {
194
+ this._keybindingDisposables.clear();
195
+ this._chords = keybinding;
196
+ clearNode(this._outputNode);
197
+ clearNode(this._showExistingKeybindingsNode);
198
+ const firstLabel = this._keybindingDisposables.add(( new KeybindingLabel(this._outputNode, OS, defaultKeybindingLabelStyles)));
199
+ firstLabel.set(this._chords?.[0] ?? undefined);
200
+ if (this._chords) {
201
+ for (let i = 1; i < this._chords.length; i++) {
202
+ this._outputNode.appendChild(document.createTextNode(( localize(8439, "chord to"))));
203
+ const chordLabel = this._keybindingDisposables.add(( new KeybindingLabel(this._outputNode, OS, defaultKeybindingLabelStyles)));
204
+ chordLabel.set(this._chords[i]);
205
+ }
206
+ }
207
+ const label = this.getUserSettingsLabel();
208
+ if (label) {
209
+ this._onDidChange.fire(label);
210
+ }
211
+ }
212
+ getUserSettingsLabel() {
213
+ let label = null;
214
+ if (this._chords) {
215
+ label = ( this._chords.map(keybinding => keybinding.getUserSettingsLabel())).join(' ');
216
+ }
217
+ return label;
218
+ }
219
+ onCancel() {
220
+ this._chords = null;
221
+ this.hide();
222
+ }
223
+ clearOrHide() {
224
+ if (this._chords === null) {
225
+ this.hide();
226
+ }
227
+ else {
228
+ this._chords = null;
229
+ this._keybindingInputWidget.clear();
230
+ clearNode(this._outputNode);
231
+ clearNode(this._showExistingKeybindingsNode);
232
+ }
233
+ }
234
+ hide() {
235
+ this._domNode.setDisplay('none');
236
+ this._isVisible = false;
237
+ this._onHide.fire();
238
+ }
239
+ };
240
+ DefineKeybindingWidget = DefineKeybindingWidget_1 = ( __decorate([
241
+ ( __param(1, IInstantiationService))
242
+ ], DefineKeybindingWidget));
243
+ let DefineKeybindingOverlayWidget = class DefineKeybindingOverlayWidget extends Disposable {
244
+ static { DefineKeybindingOverlayWidget_1 = this; }
245
+ static { this.ID = 'editor.contrib.defineKeybindingWidget'; }
246
+ constructor(_editor, instantiationService) {
247
+ super();
248
+ this._editor = _editor;
249
+ this._widget = this._register(instantiationService.createInstance(DefineKeybindingWidget, null));
250
+ this._editor.addOverlayWidget(this);
251
+ }
252
+ getId() {
253
+ return DefineKeybindingOverlayWidget_1.ID;
254
+ }
255
+ getDomNode() {
256
+ return this._widget.domNode;
257
+ }
258
+ getPosition() {
259
+ return {
260
+ preference: null
261
+ };
262
+ }
263
+ dispose() {
264
+ this._editor.removeOverlayWidget(this);
265
+ super.dispose();
266
+ }
267
+ start() {
268
+ if (this._editor.hasModel()) {
269
+ this._editor.revealPositionInCenterIfOutsideViewport(this._editor.getPosition(), ScrollType.Smooth);
270
+ }
271
+ const layoutInfo = this._editor.getLayoutInfo();
272
+ this._widget.layout(new Dimension(layoutInfo.width, layoutInfo.height));
273
+ return this._widget.define();
274
+ }
275
+ };
276
+ DefineKeybindingOverlayWidget = DefineKeybindingOverlayWidget_1 = ( __decorate([
277
+ ( __param(1, IInstantiationService))
278
+ ], DefineKeybindingOverlayWidget));
279
+
280
+ export { DefineKeybindingOverlayWidget, DefineKeybindingWidget, KeybindingsSearchWidget };
@@ -0,0 +1,38 @@
1
+ .defineKeybindingWidget {
2
+ padding: 10px;
3
+ position: absolute;
4
+ }
5
+ .defineKeybindingWidget .message {
6
+ width: 400px;
7
+ text-align: center;
8
+ }
9
+ .defineKeybindingWidget .monaco-inputbox,
10
+ .defineKeybindingWidget .output,
11
+ .defineKeybindingWidget .existing {
12
+ margin-top:10px;
13
+ width: 400px;
14
+ display: block;
15
+ text-align: center;
16
+ }
17
+ .defineKeybindingWidget .input {
18
+ text-align: center;
19
+ }
20
+ .defineKeybindingWidget .output {
21
+ display: flex;
22
+ justify-content: center;
23
+ }
24
+ .defineKeybindingWidget .existing .existingText {
25
+ text-decoration: underline;
26
+ cursor: pointer;
27
+ }
28
+ .defineKeybindingWidget .output .monaco-keybinding {
29
+ margin: 0px 4px;
30
+ }
31
+ .monaco-editor .keybindingInfo {
32
+ box-shadow: inset 0 0 0 1px #B9B9B9;
33
+ background-color: rgba(100, 100, 250, 0.2);
34
+ }
35
+ .monaco-editor .keybindingError {
36
+ box-shadow: inset 0 0 0 1px #B9B9B9;
37
+ background-color: rgba(250, 100, 100, 0.2);
38
+ }
@@ -0,0 +1,12 @@
1
+ export declare const settingsScopeDropDownIcon: import("@codingame/monaco-vscode-api/vscode/vs/base/common/themables").ThemeIcon;
2
+ export declare const settingsMoreActionIcon: import("@codingame/monaco-vscode-api/vscode/vs/base/common/themables").ThemeIcon;
3
+ export declare const keybindingsRecordKeysIcon: import("@codingame/monaco-vscode-api/vscode/vs/base/common/themables").ThemeIcon;
4
+ export declare const keybindingsSortIcon: import("@codingame/monaco-vscode-api/vscode/vs/base/common/themables").ThemeIcon;
5
+ export declare const keybindingsEditIcon: import("@codingame/monaco-vscode-api/vscode/vs/base/common/themables").ThemeIcon;
6
+ export declare const keybindingsAddIcon: import("@codingame/monaco-vscode-api/vscode/vs/base/common/themables").ThemeIcon;
7
+ export declare const settingsEditIcon: import("@codingame/monaco-vscode-api/vscode/vs/base/common/themables").ThemeIcon;
8
+ export declare const settingsRemoveIcon: import("@codingame/monaco-vscode-api/vscode/vs/base/common/themables").ThemeIcon;
9
+ export declare const settingsDiscardIcon: import("@codingame/monaco-vscode-api/vscode/vs/base/common/themables").ThemeIcon;
10
+ export declare const preferencesClearInputIcon: import("@codingame/monaco-vscode-api/vscode/vs/base/common/themables").ThemeIcon;
11
+ export declare const preferencesFilterIcon: import("@codingame/monaco-vscode-api/vscode/vs/base/common/themables").ThemeIcon;
12
+ export declare const preferencesOpenSettingsIcon: import("@codingame/monaco-vscode-api/vscode/vs/base/common/themables").ThemeIcon;
@@ -0,0 +1,22 @@
1
+
2
+ import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
3
+ import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
4
+ import { registerIcon } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/iconRegistry';
5
+
6
+ const settingsScopeDropDownIcon = registerIcon('settings-folder-dropdown', Codicon.triangleDown, ( localize(
7
+ 8530,
8
+ 'Icon for the folder dropdown button in the split JSON Settings editor.'
9
+ )));
10
+ const settingsMoreActionIcon = registerIcon('settings-more-action', Codicon.gear, ( localize(8531, 'Icon for the \'more actions\' action in the Settings UI.')));
11
+ const keybindingsRecordKeysIcon = registerIcon('keybindings-record-keys', Codicon.recordKeys, ( localize(8532, 'Icon for the \'record keys\' action in the keybinding UI.')));
12
+ const keybindingsSortIcon = registerIcon('keybindings-sort', Codicon.sortPrecedence, ( localize(8533, 'Icon for the \'sort by precedence\' toggle in the keybinding UI.')));
13
+ const keybindingsEditIcon = registerIcon('keybindings-edit', Codicon.edit, ( localize(8534, 'Icon for the edit action in the keybinding UI.')));
14
+ const keybindingsAddIcon = registerIcon('keybindings-add', Codicon.add, ( localize(8535, 'Icon for the add action in the keybinding UI.')));
15
+ const settingsEditIcon = registerIcon('settings-edit', Codicon.edit, ( localize(8536, 'Icon for the edit action in the Settings UI.')));
16
+ const settingsRemoveIcon = registerIcon('settings-remove', Codicon.close, ( localize(8537, 'Icon for the remove action in the Settings UI.')));
17
+ const settingsDiscardIcon = registerIcon('settings-discard', Codicon.discard, ( localize(8538, 'Icon for the discard action in the Settings UI.')));
18
+ const preferencesClearInputIcon = registerIcon('preferences-clear-input', Codicon.clearAll, ( localize(8539, 'Icon for clear input in the Settings and keybinding UI.')));
19
+ const preferencesFilterIcon = registerIcon('preferences-filter', Codicon.filter, ( localize(8540, 'Icon for the button that suggests filters for the Settings UI.')));
20
+ const preferencesOpenSettingsIcon = registerIcon('preferences-open-settings', Codicon.goToFile, ( localize(8541, 'Icon for open settings commands.')));
21
+
22
+ export { keybindingsAddIcon, keybindingsEditIcon, keybindingsRecordKeysIcon, keybindingsSortIcon, preferencesClearInputIcon, preferencesFilterIcon, preferencesOpenSettingsIcon, settingsDiscardIcon, settingsEditIcon, settingsMoreActionIcon, settingsRemoveIcon, settingsScopeDropDownIcon };
@@ -0,0 +1,130 @@
1
+ import * as DOM from "@codingame/monaco-vscode-api/vscode/vs/base/browser/dom";
2
+ import { BaseActionViewItem } from "@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/actionbar/actionViewItems";
3
+ import { HistoryInputBox, IHistoryInputOptions } from "@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/inputbox/inputBox";
4
+ import { Widget } from "@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/widget";
5
+ import { IAction } from "@codingame/monaco-vscode-api/vscode/vs/base/common/actions";
6
+ import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event";
7
+ import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
8
+ import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
9
+ import { ICodeEditor, IEditorMouseEvent } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorBrowser";
10
+ import { ConfigurationTarget } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration";
11
+ import { IContextKey } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey";
12
+ import { IContextKeyService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service";
13
+ import { IContextMenuService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service";
14
+ import { IContextViewService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service";
15
+ import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
16
+ import { IKeybindingService } from "@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service";
17
+ import { ILabelService } from "@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service";
18
+ import { IWorkspaceFolder } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace";
19
+ import { IWorkspaceContextService } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service";
20
+ import { IWorkbenchEnvironmentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service";
21
+ import { ILanguageService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language.service";
22
+ import { IHoverService } from "@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service";
23
+ export declare class FolderSettingsActionViewItem extends BaseActionViewItem {
24
+ private readonly contextService;
25
+ private readonly contextMenuService;
26
+ private readonly hoverService;
27
+ private _folder;
28
+ private _folderSettingCounts;
29
+ private container;
30
+ private anchorElement;
31
+ private anchorElementHover;
32
+ private labelElement;
33
+ private detailsElement;
34
+ private dropDownElement;
35
+ constructor(action: IAction, contextService: IWorkspaceContextService, contextMenuService: IContextMenuService, hoverService: IHoverService);
36
+ get folder(): IWorkspaceFolder | null;
37
+ set folder(folder: IWorkspaceFolder | null);
38
+ setCount(settingsTarget: URI, count: number): void;
39
+ render(container: HTMLElement): void;
40
+ private onKeyUp;
41
+ onClick(event: DOM.EventLike): void;
42
+ protected updateEnabled(): void;
43
+ protected updateChecked(): void;
44
+ private onWorkspaceFoldersChanged;
45
+ private update;
46
+ private showMenu;
47
+ private getDropdownMenuActions;
48
+ private labelWithCount;
49
+ }
50
+ export type SettingsTarget = ConfigurationTarget.APPLICATION | ConfigurationTarget.USER_LOCAL | ConfigurationTarget.USER_REMOTE | ConfigurationTarget.WORKSPACE | URI;
51
+ export interface ISettingsTargetsWidgetOptions {
52
+ enableRemoteSettings?: boolean;
53
+ }
54
+ export declare class SettingsTargetsWidget extends Widget {
55
+ private readonly contextService;
56
+ private readonly instantiationService;
57
+ private readonly environmentService;
58
+ private readonly labelService;
59
+ private readonly languageService;
60
+ private settingsSwitcherBar;
61
+ private userLocalSettings;
62
+ private userRemoteSettings;
63
+ private workspaceSettings;
64
+ private folderSettingsAction;
65
+ private folderSettings;
66
+ private options;
67
+ private _settingsTarget;
68
+ private readonly _onDidTargetChange;
69
+ readonly onDidTargetChange: Event<SettingsTarget>;
70
+ constructor(parent: HTMLElement, options: ISettingsTargetsWidgetOptions | undefined, contextService: IWorkspaceContextService, instantiationService: IInstantiationService, environmentService: IWorkbenchEnvironmentService, labelService: ILabelService, languageService: ILanguageService);
71
+ private resetLabels;
72
+ private create;
73
+ get settingsTarget(): SettingsTarget | null;
74
+ set settingsTarget(settingsTarget: SettingsTarget | null);
75
+ setResultCount(settingsTarget: SettingsTarget, count: number): void;
76
+ updateLanguageFilterIndicators(filter: string | undefined): void;
77
+ private onWorkbenchStateChanged;
78
+ updateTarget(settingsTarget: SettingsTarget): Promise<void>;
79
+ private update;
80
+ }
81
+ export interface SearchOptions extends IHistoryInputOptions {
82
+ focusKey?: IContextKey<boolean>;
83
+ showResultCount?: boolean;
84
+ ariaLive?: string;
85
+ ariaLabelledBy?: string;
86
+ }
87
+ export declare class SearchWidget extends Widget {
88
+ protected options: SearchOptions;
89
+ private readonly contextViewService;
90
+ protected instantiationService: IInstantiationService;
91
+ private readonly contextKeyService;
92
+ protected readonly keybindingService: IKeybindingService;
93
+ domNode: HTMLElement;
94
+ private countElement;
95
+ private searchContainer;
96
+ inputBox: HistoryInputBox;
97
+ private controlsDiv;
98
+ private readonly _onDidChange;
99
+ readonly onDidChange: Event<string>;
100
+ private readonly _onFocus;
101
+ readonly onFocus: Event<void>;
102
+ constructor(parent: HTMLElement, options: SearchOptions, contextViewService: IContextViewService, instantiationService: IInstantiationService, contextKeyService: IContextKeyService, keybindingService: IKeybindingService);
103
+ private create;
104
+ private createSearchContainer;
105
+ protected createInputBox(parent: HTMLElement): HistoryInputBox;
106
+ showMessage(message: string): void;
107
+ layout(dimension: DOM.Dimension): void;
108
+ private getControlsWidth;
109
+ focus(): void;
110
+ hasFocus(): boolean;
111
+ clear(): void;
112
+ getValue(): string;
113
+ setValue(value: string): string;
114
+ dispose(): void;
115
+ }
116
+ export declare class EditPreferenceWidget<T> extends Disposable {
117
+ private editor;
118
+ private _line;
119
+ private _preferences;
120
+ private readonly _editPreferenceDecoration;
121
+ private readonly _onClick;
122
+ readonly onClick: Event<IEditorMouseEvent>;
123
+ constructor(editor: ICodeEditor);
124
+ get preferences(): T[];
125
+ getLine(): number;
126
+ show(line: number, hoverMessage: string, preferences: T[]): void;
127
+ hide(): void;
128
+ isVisible(): boolean;
129
+ dispose(): void;
130
+ }
@@ -0,0 +1,492 @@
1
+
2
+ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
+ import { $, addDisposableListener, EventType, EventHelper, append, trackFocus, getTotalWidth } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
4
+ import { StandardKeyboardEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/keyboardEvent';
5
+ import { ActionBar, ActionsOrientation } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/actionbar/actionbar';
6
+ import { BaseActionViewItem } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/actionbar/actionViewItems';
7
+ import { Widget } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/widget';
8
+ import { Action } from '@codingame/monaco-vscode-api/vscode/vs/base/common/actions';
9
+ import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
10
+ import { MarkdownString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
11
+ import { KeyCode } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
12
+ import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
13
+ import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
14
+ import { isEqual } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
15
+ import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
16
+ import { MouseTargetType } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorBrowser';
17
+ import { TrackedRangeStickiness } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/model';
18
+ import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
19
+ import { ContextScopedHistoryInputBox } from '@codingame/monaco-vscode-api/vscode/vs/platform/history/browser/contextScopedHistoryWidget';
20
+ import { showHistoryKeybindingHint } from '@codingame/monaco-vscode-api/vscode/vs/platform/history/browser/historyWidgetKeybindingHint';
21
+ import { ConfigurationTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration';
22
+ import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
23
+ import { IContextMenuService, IContextViewService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service';
24
+ import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
25
+ import { IKeybindingService } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service';
26
+ import { ILabelService } from '@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service';
27
+ import { asCssVariable } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colorUtils';
28
+ import { contrastBorder } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/baseColors';
29
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/chartsColors';
30
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/editorColors';
31
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/inputColors';
32
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/listColors';
33
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/menuColors';
34
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/minimapColors';
35
+ import { badgeBackground, badgeForeground } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/miscColors';
36
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/quickpickColors';
37
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/searchColors';
38
+ import { ThemeIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/themables';
39
+ import { WorkbenchState, isWorkspaceFolder } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace';
40
+ import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
41
+ import { settingsScopeDropDownIcon, settingsEditIcon } from './preferencesIcons.js';
42
+ import { IWorkbenchEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service';
43
+ import { ILanguageService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language.service';
44
+ import { getDefaultHoverDelegate } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/hover/hoverDelegateFactory';
45
+ import { IHoverService } from '@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service';
46
+
47
+ let FolderSettingsActionViewItem = class FolderSettingsActionViewItem extends BaseActionViewItem {
48
+ constructor(action, contextService, contextMenuService, hoverService) {
49
+ super(null, action);
50
+ this.contextService = contextService;
51
+ this.contextMenuService = contextMenuService;
52
+ this.hoverService = hoverService;
53
+ this._folderSettingCounts = ( new Map());
54
+ const workspace = this.contextService.getWorkspace();
55
+ this._folder = workspace.folders.length === 1 ? workspace.folders[0] : null;
56
+ this._register(this.contextService.onDidChangeWorkspaceFolders(() => this.onWorkspaceFoldersChanged()));
57
+ }
58
+ get folder() {
59
+ return this._folder;
60
+ }
61
+ set folder(folder) {
62
+ this._folder = folder;
63
+ this.update();
64
+ }
65
+ setCount(settingsTarget, count) {
66
+ const workspaceFolder = this.contextService.getWorkspaceFolder(settingsTarget);
67
+ if (!workspaceFolder) {
68
+ throw ( new Error('unknown folder'));
69
+ }
70
+ const folder = workspaceFolder.uri;
71
+ this._folderSettingCounts.set(( folder.toString()), count);
72
+ this.update();
73
+ }
74
+ render(container) {
75
+ this.element = container;
76
+ this.container = container;
77
+ this.labelElement = $('.action-title');
78
+ this.detailsElement = $('.action-details');
79
+ this.dropDownElement = $('.dropdown-icon.hide' + ThemeIcon.asCSSSelector(settingsScopeDropDownIcon));
80
+ this.anchorElement = $('a.action-label.folder-settings', {
81
+ role: 'button',
82
+ 'aria-haspopup': 'true',
83
+ 'tabindex': '0'
84
+ }, this.labelElement, this.detailsElement, this.dropDownElement);
85
+ this.anchorElementHover = this._register(this.hoverService.setupManagedHover(getDefaultHoverDelegate('mouse'), this.anchorElement, ''));
86
+ this._register(addDisposableListener(this.anchorElement, EventType.MOUSE_DOWN, e => EventHelper.stop(e)));
87
+ this._register(addDisposableListener(this.anchorElement, EventType.CLICK, e => this.onClick(e)));
88
+ this._register(addDisposableListener(this.container, EventType.KEY_UP, e => this.onKeyUp(e)));
89
+ append(this.container, this.anchorElement);
90
+ this.update();
91
+ }
92
+ onKeyUp(event) {
93
+ const keyboardEvent = ( new StandardKeyboardEvent(event));
94
+ switch (keyboardEvent.keyCode) {
95
+ case KeyCode.Enter:
96
+ case KeyCode.Space:
97
+ this.onClick(event);
98
+ return;
99
+ }
100
+ }
101
+ onClick(event) {
102
+ EventHelper.stop(event, true);
103
+ if (!this.folder || this._action.checked) {
104
+ this.showMenu();
105
+ }
106
+ else {
107
+ this._action.run(this._folder);
108
+ }
109
+ }
110
+ updateEnabled() {
111
+ this.update();
112
+ }
113
+ updateChecked() {
114
+ this.update();
115
+ }
116
+ onWorkspaceFoldersChanged() {
117
+ const oldFolder = this._folder;
118
+ const workspace = this.contextService.getWorkspace();
119
+ if (oldFolder) {
120
+ this._folder = workspace.folders.filter(folder => isEqual(folder.uri, oldFolder.uri))[0] || workspace.folders[0];
121
+ }
122
+ this._folder = this._folder ? this._folder : workspace.folders.length === 1 ? workspace.folders[0] : null;
123
+ this.update();
124
+ if (this._action.checked) {
125
+ this._action.run(this._folder);
126
+ }
127
+ }
128
+ update() {
129
+ let total = 0;
130
+ this._folderSettingCounts.forEach(n => total += n);
131
+ const workspace = this.contextService.getWorkspace();
132
+ if (this._folder) {
133
+ this.labelElement.textContent = this._folder.name;
134
+ this.anchorElementHover.update(this._folder.name);
135
+ const detailsText = this.labelWithCount(this._action.label, total);
136
+ this.detailsElement.textContent = detailsText;
137
+ this.dropDownElement.classList.toggle('hide', workspace.folders.length === 1 || !this._action.checked);
138
+ }
139
+ else {
140
+ const labelText = this.labelWithCount(this._action.label, total);
141
+ this.labelElement.textContent = labelText;
142
+ this.detailsElement.textContent = '';
143
+ this.anchorElementHover.update(this._action.label);
144
+ this.dropDownElement.classList.remove('hide');
145
+ }
146
+ this.anchorElement.classList.toggle('checked', this._action.checked);
147
+ this.container.classList.toggle('disabled', !this._action.enabled);
148
+ }
149
+ showMenu() {
150
+ this.contextMenuService.showContextMenu({
151
+ getAnchor: () => this.container,
152
+ getActions: () => this.getDropdownMenuActions(),
153
+ getActionViewItem: () => undefined,
154
+ onHide: () => {
155
+ this.anchorElement.blur();
156
+ }
157
+ });
158
+ }
159
+ getDropdownMenuActions() {
160
+ const actions = [];
161
+ const workspaceFolders = this.contextService.getWorkspace().folders;
162
+ if (this.contextService.getWorkbenchState() === WorkbenchState.WORKSPACE && workspaceFolders.length > 0) {
163
+ actions.push(...( workspaceFolders.map((folder, index) => {
164
+ const folderCount = this._folderSettingCounts.get(( folder.uri.toString()));
165
+ return {
166
+ id: 'folderSettingsTarget' + index,
167
+ label: this.labelWithCount(folder.name, folderCount),
168
+ tooltip: this.labelWithCount(folder.name, folderCount),
169
+ checked: !!this.folder && isEqual(this.folder.uri, folder.uri),
170
+ enabled: true,
171
+ class: undefined,
172
+ run: () => this._action.run(folder)
173
+ };
174
+ })));
175
+ }
176
+ return actions;
177
+ }
178
+ labelWithCount(label, count) {
179
+ if (count) {
180
+ label += ` (${count})`;
181
+ }
182
+ return label;
183
+ }
184
+ };
185
+ FolderSettingsActionViewItem = ( __decorate([
186
+ ( __param(1, IWorkspaceContextService)),
187
+ ( __param(2, IContextMenuService)),
188
+ ( __param(3, IHoverService))
189
+ ], FolderSettingsActionViewItem));
190
+ let SettingsTargetsWidget = class SettingsTargetsWidget extends Widget {
191
+ constructor(parent, options, contextService, instantiationService, environmentService, labelService, languageService) {
192
+ super();
193
+ this.contextService = contextService;
194
+ this.instantiationService = instantiationService;
195
+ this.environmentService = environmentService;
196
+ this.labelService = labelService;
197
+ this.languageService = languageService;
198
+ this._settingsTarget = null;
199
+ this._onDidTargetChange = this._register(( new Emitter()));
200
+ this.onDidTargetChange = this._onDidTargetChange.event;
201
+ this.options = options ?? {};
202
+ this.create(parent);
203
+ this._register(this.contextService.onDidChangeWorkbenchState(() => this.onWorkbenchStateChanged()));
204
+ this._register(this.contextService.onDidChangeWorkspaceFolders(() => this.update()));
205
+ }
206
+ resetLabels() {
207
+ const remoteAuthority = this.environmentService.remoteAuthority;
208
+ const hostLabel = remoteAuthority && this.labelService.getHostLabel(Schemas.vscodeRemote, remoteAuthority);
209
+ this.userLocalSettings.label = ( localize(8557, "User"));
210
+ this.userRemoteSettings.label = ( localize(8558, "Remote")) + (hostLabel ? ` [${hostLabel}]` : '');
211
+ this.workspaceSettings.label = ( localize(8559, "Workspace"));
212
+ this.folderSettingsAction.label = ( localize(8560, "Folder"));
213
+ }
214
+ create(parent) {
215
+ const settingsTabsWidget = append(parent, $('.settings-tabs-widget'));
216
+ this.settingsSwitcherBar = this._register(( new ActionBar(settingsTabsWidget, {
217
+ orientation: ActionsOrientation.HORIZONTAL,
218
+ focusOnlyEnabledItems: true,
219
+ ariaLabel: ( localize(8561, "Settings Switcher")),
220
+ ariaRole: 'tablist',
221
+ actionViewItemProvider: (action, options) => action.id === 'folderSettings' ? this.folderSettings : undefined
222
+ })));
223
+ this.userLocalSettings = ( new Action(
224
+ 'userSettings',
225
+ '',
226
+ '.settings-tab',
227
+ true,
228
+ () => this.updateTarget(ConfigurationTarget.USER_LOCAL)
229
+ ));
230
+ this.userLocalSettings.tooltip = ( localize(8557, "User"));
231
+ this.userRemoteSettings = ( new Action(
232
+ 'userSettingsRemote',
233
+ '',
234
+ '.settings-tab',
235
+ true,
236
+ () => this.updateTarget(ConfigurationTarget.USER_REMOTE)
237
+ ));
238
+ const remoteAuthority = this.environmentService.remoteAuthority;
239
+ const hostLabel = remoteAuthority && this.labelService.getHostLabel(Schemas.vscodeRemote, remoteAuthority);
240
+ this.userRemoteSettings.tooltip = ( localize(8558, "Remote")) + (hostLabel ? ` [${hostLabel}]` : '');
241
+ this.workspaceSettings = ( new Action(
242
+ 'workspaceSettings',
243
+ '',
244
+ '.settings-tab',
245
+ false,
246
+ () => this.updateTarget(ConfigurationTarget.WORKSPACE)
247
+ ));
248
+ this.folderSettingsAction = ( new Action('folderSettings', '', '.settings-tab', false, async (folder) => {
249
+ this.updateTarget(isWorkspaceFolder(folder) ? folder.uri : ConfigurationTarget.USER_LOCAL);
250
+ }));
251
+ this.folderSettings = this.instantiationService.createInstance(FolderSettingsActionViewItem, this.folderSettingsAction);
252
+ this.resetLabels();
253
+ this.update();
254
+ this.settingsSwitcherBar.push([this.userLocalSettings, this.userRemoteSettings, this.workspaceSettings, this.folderSettingsAction]);
255
+ }
256
+ get settingsTarget() {
257
+ return this._settingsTarget;
258
+ }
259
+ set settingsTarget(settingsTarget) {
260
+ this._settingsTarget = settingsTarget;
261
+ this.userLocalSettings.checked = ConfigurationTarget.USER_LOCAL === this.settingsTarget;
262
+ this.userRemoteSettings.checked = ConfigurationTarget.USER_REMOTE === this.settingsTarget;
263
+ this.workspaceSettings.checked = ConfigurationTarget.WORKSPACE === this.settingsTarget;
264
+ if (this.settingsTarget instanceof URI) {
265
+ this.folderSettings.action.checked = true;
266
+ this.folderSettings.folder = this.contextService.getWorkspaceFolder(this.settingsTarget);
267
+ }
268
+ else {
269
+ this.folderSettings.action.checked = false;
270
+ }
271
+ }
272
+ setResultCount(settingsTarget, count) {
273
+ if (settingsTarget === ConfigurationTarget.WORKSPACE) {
274
+ let label = ( localize(8559, "Workspace"));
275
+ if (count) {
276
+ label += ` (${count})`;
277
+ }
278
+ this.workspaceSettings.label = label;
279
+ }
280
+ else if (settingsTarget === ConfigurationTarget.USER_LOCAL) {
281
+ let label = ( localize(8557, "User"));
282
+ if (count) {
283
+ label += ` (${count})`;
284
+ }
285
+ this.userLocalSettings.label = label;
286
+ }
287
+ else if (settingsTarget instanceof URI) {
288
+ this.folderSettings.setCount(settingsTarget, count);
289
+ }
290
+ }
291
+ updateLanguageFilterIndicators(filter) {
292
+ this.resetLabels();
293
+ if (filter) {
294
+ const languageToUse = this.languageService.getLanguageName(filter);
295
+ if (languageToUse) {
296
+ const languageSuffix = ` [${languageToUse}]`;
297
+ this.userLocalSettings.label += languageSuffix;
298
+ this.userRemoteSettings.label += languageSuffix;
299
+ this.workspaceSettings.label += languageSuffix;
300
+ this.folderSettingsAction.label += languageSuffix;
301
+ }
302
+ }
303
+ }
304
+ onWorkbenchStateChanged() {
305
+ this.folderSettings.folder = null;
306
+ this.update();
307
+ if (this.settingsTarget === ConfigurationTarget.WORKSPACE && this.contextService.getWorkbenchState() === WorkbenchState.WORKSPACE) {
308
+ this.updateTarget(ConfigurationTarget.USER_LOCAL);
309
+ }
310
+ }
311
+ updateTarget(settingsTarget) {
312
+ const isSameTarget = this.settingsTarget === settingsTarget ||
313
+ settingsTarget instanceof URI &&
314
+ this.settingsTarget instanceof URI &&
315
+ isEqual(this.settingsTarget, settingsTarget);
316
+ if (!isSameTarget) {
317
+ this.settingsTarget = settingsTarget;
318
+ this._onDidTargetChange.fire(this.settingsTarget);
319
+ }
320
+ return Promise.resolve(undefined);
321
+ }
322
+ async update() {
323
+ this.settingsSwitcherBar.domNode.classList.toggle('empty-workbench', this.contextService.getWorkbenchState() === WorkbenchState.EMPTY);
324
+ this.userRemoteSettings.enabled = !!(this.options.enableRemoteSettings && this.environmentService.remoteAuthority);
325
+ this.workspaceSettings.enabled = this.contextService.getWorkbenchState() !== WorkbenchState.EMPTY;
326
+ this.folderSettings.action.enabled = this.contextService.getWorkbenchState() === WorkbenchState.WORKSPACE && this.contextService.getWorkspace().folders.length > 0;
327
+ this.workspaceSettings.tooltip = ( localize(8559, "Workspace"));
328
+ }
329
+ };
330
+ SettingsTargetsWidget = ( __decorate([
331
+ ( __param(2, IWorkspaceContextService)),
332
+ ( __param(3, IInstantiationService)),
333
+ ( __param(4, IWorkbenchEnvironmentService)),
334
+ ( __param(5, ILabelService)),
335
+ ( __param(6, ILanguageService))
336
+ ], SettingsTargetsWidget));
337
+ let SearchWidget = class SearchWidget extends Widget {
338
+ constructor(parent, options, contextViewService, instantiationService, contextKeyService, keybindingService) {
339
+ super();
340
+ this.options = options;
341
+ this.contextViewService = contextViewService;
342
+ this.instantiationService = instantiationService;
343
+ this.contextKeyService = contextKeyService;
344
+ this.keybindingService = keybindingService;
345
+ this._onDidChange = this._register(( new Emitter()));
346
+ this.onDidChange = this._onDidChange.event;
347
+ this._onFocus = this._register(( new Emitter()));
348
+ this.onFocus = this._onFocus.event;
349
+ this.create(parent);
350
+ }
351
+ create(parent) {
352
+ this.domNode = append(parent, $('div.settings-header-widget'));
353
+ this.createSearchContainer(append(this.domNode, $('div.settings-search-container')));
354
+ this.controlsDiv = append(this.domNode, $('div.settings-search-controls'));
355
+ if (this.options.showResultCount) {
356
+ this.countElement = append(this.controlsDiv, $('.settings-count-widget'));
357
+ this.countElement.style.backgroundColor = asCssVariable(badgeBackground);
358
+ this.countElement.style.color = asCssVariable(badgeForeground);
359
+ this.countElement.style.border = `1px solid ${asCssVariable(contrastBorder)}`;
360
+ }
361
+ this.inputBox.inputElement.setAttribute('aria-live', this.options.ariaLive || 'off');
362
+ if (this.options.ariaLabelledBy) {
363
+ this.inputBox.inputElement.setAttribute('aria-labelledBy', this.options.ariaLabelledBy);
364
+ }
365
+ const focusTracker = this._register(trackFocus(this.inputBox.inputElement));
366
+ this._register(focusTracker.onDidFocus(() => this._onFocus.fire()));
367
+ const focusKey = this.options.focusKey;
368
+ if (focusKey) {
369
+ this._register(focusTracker.onDidFocus(() => focusKey.set(true)));
370
+ this._register(focusTracker.onDidBlur(() => focusKey.set(false)));
371
+ }
372
+ }
373
+ createSearchContainer(searchContainer) {
374
+ this.searchContainer = searchContainer;
375
+ const searchInput = append(this.searchContainer, $('div.settings-search-input'));
376
+ this.inputBox = this._register(this.createInputBox(searchInput));
377
+ this._register(this.inputBox.onDidChange(value => this._onDidChange.fire(value)));
378
+ }
379
+ createInputBox(parent) {
380
+ const showHistoryHint = () => showHistoryKeybindingHint(this.keybindingService);
381
+ return ( new ContextScopedHistoryInputBox(
382
+ parent,
383
+ this.contextViewService,
384
+ { ...this.options, showHistoryHint },
385
+ this.contextKeyService
386
+ ));
387
+ }
388
+ showMessage(message) {
389
+ if (this.countElement && message !== this.countElement.textContent) {
390
+ this.countElement.textContent = message;
391
+ this.inputBox.inputElement.setAttribute('aria-label', message);
392
+ this.inputBox.inputElement.style.paddingRight = this.getControlsWidth() + 'px';
393
+ }
394
+ }
395
+ layout(dimension) {
396
+ if (dimension.width < 400) {
397
+ this.countElement?.classList.add('hide');
398
+ this.inputBox.inputElement.style.paddingRight = '0px';
399
+ }
400
+ else {
401
+ this.countElement?.classList.remove('hide');
402
+ this.inputBox.inputElement.style.paddingRight = this.getControlsWidth() + 'px';
403
+ }
404
+ }
405
+ getControlsWidth() {
406
+ const countWidth = this.countElement ? getTotalWidth(this.countElement) : 0;
407
+ return countWidth + 20;
408
+ }
409
+ focus() {
410
+ this.inputBox.focus();
411
+ if (this.getValue()) {
412
+ this.inputBox.select();
413
+ }
414
+ }
415
+ hasFocus() {
416
+ return this.inputBox.hasFocus();
417
+ }
418
+ clear() {
419
+ this.inputBox.value = '';
420
+ }
421
+ getValue() {
422
+ return this.inputBox.value;
423
+ }
424
+ setValue(value) {
425
+ return this.inputBox.value = value;
426
+ }
427
+ dispose() {
428
+ this.options.focusKey?.set(false);
429
+ super.dispose();
430
+ }
431
+ };
432
+ SearchWidget = ( __decorate([
433
+ ( __param(2, IContextViewService)),
434
+ ( __param(3, IInstantiationService)),
435
+ ( __param(4, IContextKeyService)),
436
+ ( __param(5, IKeybindingService))
437
+ ], SearchWidget));
438
+ class EditPreferenceWidget extends Disposable {
439
+ constructor(editor) {
440
+ super();
441
+ this.editor = editor;
442
+ this._line = -1;
443
+ this._preferences = [];
444
+ this._onClick = this._register(( new Emitter()));
445
+ this.onClick = this._onClick.event;
446
+ this._editPreferenceDecoration = this.editor.createDecorationsCollection();
447
+ this._register(this.editor.onMouseDown((e) => {
448
+ if (e.target.type !== MouseTargetType.GUTTER_GLYPH_MARGIN || e.target.detail.isAfterLines || !this.isVisible()) {
449
+ return;
450
+ }
451
+ this._onClick.fire(e);
452
+ }));
453
+ }
454
+ get preferences() {
455
+ return this._preferences;
456
+ }
457
+ getLine() {
458
+ return this._line;
459
+ }
460
+ show(line, hoverMessage, preferences) {
461
+ this._preferences = preferences;
462
+ const newDecoration = [];
463
+ this._line = line;
464
+ newDecoration.push({
465
+ options: {
466
+ description: 'edit-preference-widget-decoration',
467
+ glyphMarginClassName: ThemeIcon.asClassName(settingsEditIcon),
468
+ glyphMarginHoverMessage: ( new MarkdownString()).appendText(hoverMessage),
469
+ stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
470
+ },
471
+ range: {
472
+ startLineNumber: line,
473
+ startColumn: 1,
474
+ endLineNumber: line,
475
+ endColumn: 1
476
+ }
477
+ });
478
+ this._editPreferenceDecoration.set(newDecoration);
479
+ }
480
+ hide() {
481
+ this._editPreferenceDecoration.clear();
482
+ }
483
+ isVisible() {
484
+ return this._editPreferenceDecoration.length > 0;
485
+ }
486
+ dispose() {
487
+ this.hide();
488
+ super.dispose();
489
+ }
490
+ }
491
+
492
+ export { EditPreferenceWidget, FolderSettingsActionViewItem, SearchWidget, SettingsTargetsWidget };