@codingame/monaco-vscode-api 1.76.0 → 1.76.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 +4 -1
- package/dist/api.js +1 -8
- package/dist/assets/break-6b46c048-6b46c048.mp3 +0 -0
- package/dist/assets/break-6b46c048.mp3 +0 -0
- package/dist/assets/diffLineDeleted-26945eb8-26945eb8.mp3 +0 -0
- package/dist/assets/diffLineDeleted-26945eb8.mp3 +0 -0
- package/dist/assets/diffLineInserted-8f202889-8f202889.mp3 +0 -0
- package/dist/assets/diffLineInserted-8f202889.mp3 +0 -0
- package/dist/assets/diffLineModified-fb126694-fb126694.mp3 +0 -0
- package/dist/assets/diffLineModified-fb126694.mp3 +0 -0
- package/dist/assets/error-b93c2a76-b93c2a76.mp3 +0 -0
- package/dist/assets/error-b93c2a76.mp3 +0 -0
- package/dist/assets/foldedAreas-a6b54171-a6b54171.mp3 +0 -0
- package/dist/assets/foldedAreas-a6b54171.mp3 +0 -0
- package/dist/assets/quickFixes-dc7d1e73-dc7d1e73.mp3 +0 -0
- package/dist/assets/quickFixes-dc7d1e73.mp3 +0 -0
- package/dist/assets/taskCompleted-f0dd8e18-f0dd8e18.mp3 +0 -0
- package/dist/assets/taskCompleted-f0dd8e18.mp3 +0 -0
- package/dist/assets/taskFailed-5494702a-5494702a.mp3 +0 -0
- package/dist/assets/taskFailed-5494702a.mp3 +0 -0
- package/dist/assets/terminalBell-ff9df1e1-ff9df1e1.mp3 +0 -0
- package/dist/assets/terminalBell-ff9df1e1.mp3 +0 -0
- package/dist/assets/warning-2687e2e7-2687e2e7.mp3 +0 -0
- package/dist/assets/warning-2687e2e7.mp3 +0 -0
- package/dist/audioCue.d.ts +22 -0
- package/dist/audioCue.js +1147 -0
- package/dist/button.js +325 -0
- package/dist/dialog.web.contribution.js +945 -0
- package/dist/dialogs.js +7 -960
- package/dist/extHost.js +1 -1
- package/dist/files.js +2 -1
- package/dist/layout.js +4 -325
- package/dist/missing-services.js +65 -1
- package/dist/modelEditor.js +21 -3
- package/dist/notifications.js +2 -1
- package/dist/polyfill.js +186 -2
- package/dist/services.d.ts +56 -1
- package/dist/services.js +1 -0
- package/dist/snippets.js +1 -1
- package/dist/textmate.d.ts +1 -1
- package/dist/textmate.js +5 -18
- package/dist/workbenchThemeService.js +1 -1
- package/dist/workspaceContext.js +2 -0
- package/package.json +10 -1
package/dist/audioCue.js
ADDED
|
@@ -0,0 +1,1147 @@
|
|
|
1
|
+
import './polyfill.js';
|
|
2
|
+
import { d as IPreferencesService, o as IDebugService } from './missing-services.js';
|
|
3
|
+
import { _ as __decorate, a as __param } from './contextkey.js';
|
|
4
|
+
import { b as IEditorService } from './services2.js';
|
|
5
|
+
import { Disposable, DisposableStore, toDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
6
|
+
import { IAudioCueService, AudioCue as AudioCue$1 } from 'monaco-editor/esm/vs/platform/audioCues/browser/audioCueService.js';
|
|
7
|
+
import { MarkerSeverity, IMarkerService } from 'monaco-editor/esm/vs/platform/markers/common/markers.js';
|
|
8
|
+
import { CachedFunction } from 'monaco-editor/esm/vs/base/common/cache.js';
|
|
9
|
+
import { isDiffEditor, isCodeEditor } from 'monaco-editor/esm/vs/editor/browser/editorBrowser.js';
|
|
10
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
11
|
+
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
12
|
+
import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
13
|
+
import { FoldingController } from 'monaco-editor/esm/vs/editor/contrib/folding/browser/folding.js';
|
|
14
|
+
import { GhostTextController } from 'monaco-editor/esm/vs/editor/contrib/inlineCompletions/browser/ghostTextController.js';
|
|
15
|
+
import { o as onServicesInitialized } from './tools.js';
|
|
16
|
+
import { registerAction2, Action2 } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
|
|
17
|
+
import { localize } from 'monaco-editor/esm/vs/nls.js';
|
|
18
|
+
import { IQuickInputService } from 'monaco-editor/esm/vs/platform/quickinput/common/quickInput.js';
|
|
19
|
+
import { IAccessibilityService } from 'monaco-editor/esm/vs/platform/accessibility/common/accessibility.js';
|
|
20
|
+
import { ThemeIcon } from 'monaco-editor/esm/vs/base/common/themables.js';
|
|
21
|
+
import { Codicon } from 'monaco-editor/esm/vs/base/common/codicons.js';
|
|
22
|
+
import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
|
|
23
|
+
import { Extensions } from 'monaco-editor/esm/vs/platform/configuration/common/configurationRegistry.js';
|
|
24
|
+
import { FileAccess } from 'monaco-editor/esm/vs/base/common/network.js';
|
|
25
|
+
import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
|
|
26
|
+
let _derived;
|
|
27
|
+
function _setDerived(derived) {
|
|
28
|
+
_derived = derived;
|
|
29
|
+
}
|
|
30
|
+
class ConvenientObservable {
|
|
31
|
+
get TChange() { return null; }
|
|
32
|
+
read(reader) {
|
|
33
|
+
reader.subscribeTo(this);
|
|
34
|
+
return this.get();
|
|
35
|
+
}
|
|
36
|
+
map(fn) {
|
|
37
|
+
return _derived(() => {
|
|
38
|
+
const name = getFunctionName(fn);
|
|
39
|
+
return name !== undefined ? name : `${this.debugName} (mapped)`;
|
|
40
|
+
}, (reader) => fn(this.read(reader)));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
class BaseObservable extends ConvenientObservable {
|
|
44
|
+
constructor() {
|
|
45
|
+
super(...arguments);
|
|
46
|
+
this.observers = ( (new Set()));
|
|
47
|
+
}
|
|
48
|
+
addObserver(observer) {
|
|
49
|
+
const len = this.observers.size;
|
|
50
|
+
this.observers.add(observer);
|
|
51
|
+
if (len === 0) {
|
|
52
|
+
this.onFirstObserverAdded();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
removeObserver(observer) {
|
|
56
|
+
const deleted = this.observers.delete(observer);
|
|
57
|
+
if (deleted && this.observers.size === 0) {
|
|
58
|
+
this.onLastObserverRemoved();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
onFirstObserverAdded() { }
|
|
62
|
+
onLastObserverRemoved() { }
|
|
63
|
+
}
|
|
64
|
+
function transaction(fn, getDebugName) {
|
|
65
|
+
const tx = ( (new TransactionImpl(fn, getDebugName)));
|
|
66
|
+
try {
|
|
67
|
+
fn(tx);
|
|
68
|
+
}
|
|
69
|
+
finally {
|
|
70
|
+
tx.finish();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function getFunctionName(fn) {
|
|
74
|
+
const fnSrc = ( (fn.toString()));
|
|
75
|
+
const regexp = /\/\*\*\s*@description\s*([^*]*)\*\//;
|
|
76
|
+
const match = regexp.exec(fnSrc);
|
|
77
|
+
const result = match ? match[1] : undefined;
|
|
78
|
+
return result?.trim();
|
|
79
|
+
}
|
|
80
|
+
class TransactionImpl {
|
|
81
|
+
constructor(fn, _getDebugName) {
|
|
82
|
+
this.fn = fn;
|
|
83
|
+
this._getDebugName = _getDebugName;
|
|
84
|
+
this.updatingObservers = [];
|
|
85
|
+
}
|
|
86
|
+
getDebugName() {
|
|
87
|
+
if (this._getDebugName) {
|
|
88
|
+
return this._getDebugName();
|
|
89
|
+
}
|
|
90
|
+
return getFunctionName(this.fn);
|
|
91
|
+
}
|
|
92
|
+
updateObserver(observer, observable) {
|
|
93
|
+
this.updatingObservers.push({ observer, observable });
|
|
94
|
+
observer.beginUpdate(observable);
|
|
95
|
+
}
|
|
96
|
+
finish() {
|
|
97
|
+
const updatingObservers = this.updatingObservers;
|
|
98
|
+
this.updatingObservers = null;
|
|
99
|
+
for (const { observer, observable } of updatingObservers) {
|
|
100
|
+
observer.endUpdate(observable);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function observableValue(name, initialValue) {
|
|
105
|
+
return (
|
|
106
|
+
(new ObservableValue(name, initialValue))
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
class ObservableValue extends BaseObservable {
|
|
110
|
+
constructor(debugName, initialValue) {
|
|
111
|
+
super();
|
|
112
|
+
this.debugName = debugName;
|
|
113
|
+
this.value = initialValue;
|
|
114
|
+
}
|
|
115
|
+
get() {
|
|
116
|
+
return this.value;
|
|
117
|
+
}
|
|
118
|
+
set(value, tx, change) {
|
|
119
|
+
if (this.value === value) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (!tx) {
|
|
123
|
+
transaction((tx) => {
|
|
124
|
+
this.set(value, tx, change);
|
|
125
|
+
}, () => `Setting ${this.debugName}`);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
this.value = value;
|
|
129
|
+
for (const observer of this.observers) {
|
|
130
|
+
tx.updateObserver(observer, this);
|
|
131
|
+
observer.handleChange(this, change);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
toString() {
|
|
135
|
+
return `${this.debugName}: ${this.value}`;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
function derived(debugName, computeFn) {
|
|
139
|
+
return (
|
|
140
|
+
(new Derived(debugName, computeFn))
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
_setDerived(derived);
|
|
144
|
+
class Derived extends BaseObservable {
|
|
145
|
+
get dependencies() {
|
|
146
|
+
return this._dependencies;
|
|
147
|
+
}
|
|
148
|
+
get debugName() {
|
|
149
|
+
return typeof this._debugName === 'function' ? this._debugName() : this._debugName;
|
|
150
|
+
}
|
|
151
|
+
constructor(_debugName, computeFn) {
|
|
152
|
+
super();
|
|
153
|
+
this._debugName = _debugName;
|
|
154
|
+
this.computeFn = computeFn;
|
|
155
|
+
this.hadValue = false;
|
|
156
|
+
this.hasValue = false;
|
|
157
|
+
this.value = undefined;
|
|
158
|
+
this.updateCount = 0;
|
|
159
|
+
this._dependencies = ( (new Set()));
|
|
160
|
+
this.staleDependencies = ( (new Set()));
|
|
161
|
+
}
|
|
162
|
+
onLastObserverRemoved() {
|
|
163
|
+
this.hasValue = false;
|
|
164
|
+
this.hadValue = false;
|
|
165
|
+
this.value = undefined;
|
|
166
|
+
for (const d of this._dependencies) {
|
|
167
|
+
d.removeObserver(this);
|
|
168
|
+
}
|
|
169
|
+
this._dependencies.clear();
|
|
170
|
+
}
|
|
171
|
+
get() {
|
|
172
|
+
if (this.observers.size === 0) {
|
|
173
|
+
const result = this.computeFn(this);
|
|
174
|
+
this.onLastObserverRemoved();
|
|
175
|
+
return result;
|
|
176
|
+
}
|
|
177
|
+
if (this.updateCount > 0 && this.hasValue) {
|
|
178
|
+
for (const d of this._dependencies) {
|
|
179
|
+
d.get();
|
|
180
|
+
if (!this.hasValue) {
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if (!this.hasValue) {
|
|
186
|
+
const emptySet = this.staleDependencies;
|
|
187
|
+
this.staleDependencies = this._dependencies;
|
|
188
|
+
this._dependencies = emptySet;
|
|
189
|
+
const oldValue = this.value;
|
|
190
|
+
try {
|
|
191
|
+
this.value = this.computeFn(this);
|
|
192
|
+
}
|
|
193
|
+
finally {
|
|
194
|
+
for (const o of this.staleDependencies) {
|
|
195
|
+
o.removeObserver(this);
|
|
196
|
+
}
|
|
197
|
+
this.staleDependencies.clear();
|
|
198
|
+
}
|
|
199
|
+
this.hasValue = true;
|
|
200
|
+
const didChange = this.hadValue && oldValue !== this.value;
|
|
201
|
+
if (didChange) {
|
|
202
|
+
for (const r of this.observers) {
|
|
203
|
+
r.handleChange(this, undefined);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return this.value;
|
|
208
|
+
}
|
|
209
|
+
beginUpdate() {
|
|
210
|
+
if (this.updateCount === 0) {
|
|
211
|
+
for (const r of this.observers) {
|
|
212
|
+
r.beginUpdate(this);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
this.updateCount++;
|
|
216
|
+
}
|
|
217
|
+
handleChange(_observable, _change) {
|
|
218
|
+
if (this.hasValue) {
|
|
219
|
+
this.hadValue = true;
|
|
220
|
+
this.hasValue = false;
|
|
221
|
+
}
|
|
222
|
+
if (this.updateCount === 0 && this.observers.size > 0) {
|
|
223
|
+
this.get();
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
endUpdate() {
|
|
227
|
+
this.updateCount--;
|
|
228
|
+
if (this.updateCount === 0) {
|
|
229
|
+
if (this.observers.size > 0) {
|
|
230
|
+
this.get();
|
|
231
|
+
}
|
|
232
|
+
for (const r of this.observers) {
|
|
233
|
+
r.endUpdate(this);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
subscribeTo(observable) {
|
|
238
|
+
this._dependencies.add(observable);
|
|
239
|
+
if (!this.staleDependencies.delete(observable)) {
|
|
240
|
+
observable.addObserver(this);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
toString() {
|
|
244
|
+
return `LazyDerived<${this.debugName}>`;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
function autorun(debugName, fn) {
|
|
248
|
+
return (
|
|
249
|
+
(new AutorunObserver(debugName, fn, undefined))
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
function autorunWithStore(fn, debugName) {
|
|
253
|
+
const store = ( (new DisposableStore()));
|
|
254
|
+
const disposable = autorun(debugName, reader => {
|
|
255
|
+
store.clear();
|
|
256
|
+
fn(reader, store);
|
|
257
|
+
});
|
|
258
|
+
return toDisposable(() => {
|
|
259
|
+
disposable.dispose();
|
|
260
|
+
store.dispose();
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
class AutorunObserver {
|
|
264
|
+
get dependencies() {
|
|
265
|
+
return this._dependencies;
|
|
266
|
+
}
|
|
267
|
+
constructor(debugName, runFn, _handleChange) {
|
|
268
|
+
this.debugName = debugName;
|
|
269
|
+
this.runFn = runFn;
|
|
270
|
+
this._handleChange = _handleChange;
|
|
271
|
+
this.needsToRun = true;
|
|
272
|
+
this.updateCount = 0;
|
|
273
|
+
this.disposed = false;
|
|
274
|
+
this._dependencies = ( (new Set()));
|
|
275
|
+
this.staleDependencies = ( (new Set()));
|
|
276
|
+
this.runIfNeeded();
|
|
277
|
+
}
|
|
278
|
+
subscribeTo(observable) {
|
|
279
|
+
if (this.disposed) {
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
this._dependencies.add(observable);
|
|
283
|
+
if (!this.staleDependencies.delete(observable)) {
|
|
284
|
+
observable.addObserver(this);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
handleChange(observable, change) {
|
|
288
|
+
const shouldReact = this._handleChange ? this._handleChange({
|
|
289
|
+
changedObservable: observable,
|
|
290
|
+
change,
|
|
291
|
+
didChange: o => o === observable,
|
|
292
|
+
}) : true;
|
|
293
|
+
this.needsToRun = this.needsToRun || shouldReact;
|
|
294
|
+
if (this.updateCount === 0) {
|
|
295
|
+
this.runIfNeeded();
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
beginUpdate() {
|
|
299
|
+
this.updateCount++;
|
|
300
|
+
}
|
|
301
|
+
endUpdate() {
|
|
302
|
+
this.updateCount--;
|
|
303
|
+
if (this.updateCount === 0) {
|
|
304
|
+
this.runIfNeeded();
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
runIfNeeded() {
|
|
308
|
+
if (!this.needsToRun) {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
const emptySet = this.staleDependencies;
|
|
312
|
+
this.staleDependencies = this._dependencies;
|
|
313
|
+
this._dependencies = emptySet;
|
|
314
|
+
this.needsToRun = false;
|
|
315
|
+
try {
|
|
316
|
+
this.runFn(this);
|
|
317
|
+
}
|
|
318
|
+
finally {
|
|
319
|
+
for (const o of this.staleDependencies) {
|
|
320
|
+
o.removeObserver(this);
|
|
321
|
+
}
|
|
322
|
+
this.staleDependencies.clear();
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
dispose() {
|
|
326
|
+
this.disposed = true;
|
|
327
|
+
for (const o of this._dependencies) {
|
|
328
|
+
o.removeObserver(this);
|
|
329
|
+
}
|
|
330
|
+
this._dependencies.clear();
|
|
331
|
+
}
|
|
332
|
+
toString() {
|
|
333
|
+
return `Autorun<${this.debugName}>`;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
( ((function(autorun) {
|
|
337
|
+
autorun.Observer = AutorunObserver;
|
|
338
|
+
})(autorun || (autorun = {}))));
|
|
339
|
+
function autorunDelta(name, observable, handler) {
|
|
340
|
+
let _lastValue;
|
|
341
|
+
return autorun(name, (reader) => {
|
|
342
|
+
const newValue = observable.read(reader);
|
|
343
|
+
const lastValue = _lastValue;
|
|
344
|
+
_lastValue = newValue;
|
|
345
|
+
handler({ lastValue, newValue });
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
function constObservable(value) {
|
|
349
|
+
return (
|
|
350
|
+
(new ConstObservable(value))
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
class ConstObservable extends ConvenientObservable {
|
|
354
|
+
constructor(value) {
|
|
355
|
+
super();
|
|
356
|
+
this.value = value;
|
|
357
|
+
}
|
|
358
|
+
get debugName() {
|
|
359
|
+
return (
|
|
360
|
+
(this.toString())
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
get() {
|
|
364
|
+
return this.value;
|
|
365
|
+
}
|
|
366
|
+
addObserver(observer) {
|
|
367
|
+
}
|
|
368
|
+
removeObserver(observer) {
|
|
369
|
+
}
|
|
370
|
+
toString() {
|
|
371
|
+
return `Const: ${this.value}`;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
function observableFromPromise(promise) {
|
|
375
|
+
const observable = observableValue('promiseValue', {});
|
|
376
|
+
promise.then((value) => {
|
|
377
|
+
observable.set({ value }, undefined);
|
|
378
|
+
});
|
|
379
|
+
return observable;
|
|
380
|
+
}
|
|
381
|
+
function observableFromEvent(event, getValue) {
|
|
382
|
+
return (
|
|
383
|
+
(new FromEventObservable(event, getValue))
|
|
384
|
+
);
|
|
385
|
+
}
|
|
386
|
+
class FromEventObservable extends BaseObservable {
|
|
387
|
+
constructor(event, getValue) {
|
|
388
|
+
super();
|
|
389
|
+
this.event = event;
|
|
390
|
+
this.getValue = getValue;
|
|
391
|
+
this.hasValue = false;
|
|
392
|
+
this.handleEvent = (args) => {
|
|
393
|
+
const newValue = this.getValue(args);
|
|
394
|
+
const didChange = !this.hasValue || this.value !== newValue;
|
|
395
|
+
if (didChange) {
|
|
396
|
+
this.value = newValue;
|
|
397
|
+
if (this.hasValue) {
|
|
398
|
+
transaction((tx) => {
|
|
399
|
+
for (const o of this.observers) {
|
|
400
|
+
tx.updateObserver(o, this);
|
|
401
|
+
o.handleChange(this, undefined);
|
|
402
|
+
}
|
|
403
|
+
}, () => {
|
|
404
|
+
const name = this.getDebugName();
|
|
405
|
+
return 'Event fired' + (name ? `: ${name}` : '');
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
this.hasValue = true;
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
getDebugName() {
|
|
413
|
+
return getFunctionName(this.getValue);
|
|
414
|
+
}
|
|
415
|
+
get debugName() {
|
|
416
|
+
const name = this.getDebugName();
|
|
417
|
+
return 'From Event' + (name ? `: ${name}` : '');
|
|
418
|
+
}
|
|
419
|
+
onFirstObserverAdded() {
|
|
420
|
+
this.subscription = this.event(this.handleEvent);
|
|
421
|
+
}
|
|
422
|
+
onLastObserverRemoved() {
|
|
423
|
+
this.subscription.dispose();
|
|
424
|
+
this.subscription = undefined;
|
|
425
|
+
this.hasValue = false;
|
|
426
|
+
this.value = undefined;
|
|
427
|
+
}
|
|
428
|
+
get() {
|
|
429
|
+
if (this.subscription) {
|
|
430
|
+
if (!this.hasValue) {
|
|
431
|
+
this.handleEvent(undefined);
|
|
432
|
+
}
|
|
433
|
+
return this.value;
|
|
434
|
+
}
|
|
435
|
+
else {
|
|
436
|
+
return this.getValue(undefined);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
( ((function(observableFromEvent) {
|
|
441
|
+
observableFromEvent.Observer = FromEventObservable;
|
|
442
|
+
})(observableFromEvent || (observableFromEvent = {}))));
|
|
443
|
+
function debouncedObservable(observable, debounceMs, disposableStore) {
|
|
444
|
+
const debouncedObservable = observableValue('debounced', undefined);
|
|
445
|
+
let timeout = undefined;
|
|
446
|
+
disposableStore.add(autorun('debounce', reader => {
|
|
447
|
+
const value = observable.read(reader);
|
|
448
|
+
if (timeout) {
|
|
449
|
+
clearTimeout(timeout);
|
|
450
|
+
}
|
|
451
|
+
timeout = setTimeout(() => {
|
|
452
|
+
transaction(tx => {
|
|
453
|
+
debouncedObservable.set(value, tx);
|
|
454
|
+
});
|
|
455
|
+
}, debounceMs);
|
|
456
|
+
}));
|
|
457
|
+
return debouncedObservable;
|
|
458
|
+
}
|
|
459
|
+
function wasEventTriggeredRecently(event, timeoutMs, disposableStore) {
|
|
460
|
+
const observable = observableValue('triggeredRecently', false);
|
|
461
|
+
let timeout = undefined;
|
|
462
|
+
disposableStore.add(event(() => {
|
|
463
|
+
observable.set(true, undefined);
|
|
464
|
+
if (timeout) {
|
|
465
|
+
clearTimeout(timeout);
|
|
466
|
+
}
|
|
467
|
+
timeout = setTimeout(() => {
|
|
468
|
+
observable.set(false, undefined);
|
|
469
|
+
}, timeoutMs);
|
|
470
|
+
}));
|
|
471
|
+
return observable;
|
|
472
|
+
}
|
|
473
|
+
let AudioCueService = class AudioCueService extends Disposable {
|
|
474
|
+
constructor(configurationService, accessibilityService) {
|
|
475
|
+
super();
|
|
476
|
+
this.configurationService = configurationService;
|
|
477
|
+
this.accessibilityService = accessibilityService;
|
|
478
|
+
this.screenReaderAttached = observableFromEvent(this.accessibilityService.onDidChangeScreenReaderOptimized, () => this.accessibilityService.isScreenReaderOptimized());
|
|
479
|
+
this.playingSounds = ( (new Set()));
|
|
480
|
+
this.obsoleteAudioCuesEnabled = observableFromEvent(Event.filter(this.configurationService.onDidChangeConfiguration, (e) => e.affectsConfiguration('audioCues.enabled')), () => this.configurationService.getValue('audioCues.enabled'));
|
|
481
|
+
this.isEnabledCache = ( (new Cache((cue) => {
|
|
482
|
+
const settingObservable = observableFromEvent(Event.filter(this.configurationService.onDidChangeConfiguration, (e) => e.affectsConfiguration(cue.settingsKey)), () => this.configurationService.getValue(cue.settingsKey));
|
|
483
|
+
return derived('audio cue enabled', reader => {
|
|
484
|
+
const setting = settingObservable.read(reader);
|
|
485
|
+
if (setting === 'on' ||
|
|
486
|
+
(setting === 'auto' && this.screenReaderAttached.read(reader))) {
|
|
487
|
+
return true;
|
|
488
|
+
}
|
|
489
|
+
const obsoleteSetting = this.obsoleteAudioCuesEnabled.read(reader);
|
|
490
|
+
if (obsoleteSetting === 'on' ||
|
|
491
|
+
(obsoleteSetting === 'auto' && this.screenReaderAttached.read(reader))) {
|
|
492
|
+
return true;
|
|
493
|
+
}
|
|
494
|
+
return false;
|
|
495
|
+
});
|
|
496
|
+
})));
|
|
497
|
+
}
|
|
498
|
+
async playAudioCue(cue, allowManyInParallel = false) {
|
|
499
|
+
if (this.isEnabled(cue)) {
|
|
500
|
+
await this.playSound(cue.sound, allowManyInParallel);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
async playAudioCues(cues) {
|
|
504
|
+
const sounds = ( (new Set(cues.filter(cue => this.isEnabled(cue)).map(cue => cue.sound))));
|
|
505
|
+
await Promise.all(Array.from(sounds).map(sound => this.playSound(sound, true)));
|
|
506
|
+
}
|
|
507
|
+
getVolumeInPercent() {
|
|
508
|
+
const volume = this.configurationService.getValue('audioCues.volume');
|
|
509
|
+
if (typeof volume !== 'number') {
|
|
510
|
+
return 50;
|
|
511
|
+
}
|
|
512
|
+
return Math.max(Math.min(volume, 100), 0);
|
|
513
|
+
}
|
|
514
|
+
async playSound(sound, allowManyInParallel = false) {
|
|
515
|
+
if (!allowManyInParallel && this.playingSounds.has(sound)) {
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
this.playingSounds.add(sound);
|
|
519
|
+
const url = ( (FileAccess.asBrowserUri(`vs/platform/audioCues/browser/media/${sound.fileName}`).toString(true)));
|
|
520
|
+
try {
|
|
521
|
+
await playAudio(url, this.getVolumeInPercent() / 100);
|
|
522
|
+
}
|
|
523
|
+
catch (e) {
|
|
524
|
+
console.error('Error while playing sound', e);
|
|
525
|
+
}
|
|
526
|
+
finally {
|
|
527
|
+
this.playingSounds.delete(sound);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
isEnabled(cue) {
|
|
531
|
+
return this.isEnabledCache.get(cue).get();
|
|
532
|
+
}
|
|
533
|
+
onEnabledChanged(cue) {
|
|
534
|
+
return eventFromObservable(this.isEnabledCache.get(cue));
|
|
535
|
+
}
|
|
536
|
+
};
|
|
537
|
+
AudioCueService = ( (__decorate([
|
|
538
|
+
( (__param(0, IConfigurationService))),
|
|
539
|
+
( (__param(1, IAccessibilityService)))
|
|
540
|
+
], AudioCueService)));
|
|
541
|
+
function playAudio(url, volume) {
|
|
542
|
+
return (
|
|
543
|
+
(new Promise((resolve, reject) => {
|
|
544
|
+
const audio = ( (new Audio(url)));
|
|
545
|
+
audio.volume = volume;
|
|
546
|
+
audio.addEventListener('ended', () => {
|
|
547
|
+
resolve();
|
|
548
|
+
});
|
|
549
|
+
audio.addEventListener('error', (e) => {
|
|
550
|
+
reject(e.error);
|
|
551
|
+
});
|
|
552
|
+
audio.play().catch(e => {
|
|
553
|
+
reject(e);
|
|
554
|
+
});
|
|
555
|
+
}))
|
|
556
|
+
);
|
|
557
|
+
}
|
|
558
|
+
function eventFromObservable(observable) {
|
|
559
|
+
return (listener) => {
|
|
560
|
+
let count = 0;
|
|
561
|
+
let didChange = false;
|
|
562
|
+
const observer = {
|
|
563
|
+
beginUpdate() {
|
|
564
|
+
count++;
|
|
565
|
+
},
|
|
566
|
+
endUpdate() {
|
|
567
|
+
count--;
|
|
568
|
+
if (count === 0 && didChange) {
|
|
569
|
+
didChange = false;
|
|
570
|
+
listener();
|
|
571
|
+
}
|
|
572
|
+
},
|
|
573
|
+
handleChange() {
|
|
574
|
+
if (count === 0) {
|
|
575
|
+
listener();
|
|
576
|
+
}
|
|
577
|
+
else {
|
|
578
|
+
didChange = true;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
};
|
|
582
|
+
observable.addObserver(observer);
|
|
583
|
+
return {
|
|
584
|
+
dispose() {
|
|
585
|
+
observable.removeObserver(observer);
|
|
586
|
+
}
|
|
587
|
+
};
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
class Cache {
|
|
591
|
+
constructor(getValue) {
|
|
592
|
+
this.getValue = getValue;
|
|
593
|
+
this.map = ( (new Map()));
|
|
594
|
+
}
|
|
595
|
+
get(arg) {
|
|
596
|
+
if (this.map.has(arg)) {
|
|
597
|
+
return this.map.get(arg);
|
|
598
|
+
}
|
|
599
|
+
const value = this.getValue(arg);
|
|
600
|
+
this.map.set(arg, value);
|
|
601
|
+
return value;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
class Sound {
|
|
605
|
+
static register(options) {
|
|
606
|
+
const sound = ( (new Sound(options.fileName)));
|
|
607
|
+
return sound;
|
|
608
|
+
}
|
|
609
|
+
constructor(fileName) {
|
|
610
|
+
this.fileName = fileName;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
Sound.error = Sound.register({ fileName: 'error.mp3' });
|
|
614
|
+
Sound.warning = Sound.register({ fileName: 'warning.mp3' });
|
|
615
|
+
Sound.foldedArea = Sound.register({ fileName: 'foldedAreas.mp3' });
|
|
616
|
+
Sound.break = Sound.register({ fileName: 'break.mp3' });
|
|
617
|
+
Sound.quickFixes = Sound.register({ fileName: 'quickFixes.mp3' });
|
|
618
|
+
Sound.taskCompleted = Sound.register({ fileName: 'taskCompleted.mp3' });
|
|
619
|
+
Sound.taskFailed = Sound.register({ fileName: 'taskFailed.mp3' });
|
|
620
|
+
Sound.terminalBell = Sound.register({ fileName: 'terminalBell.mp3' });
|
|
621
|
+
Sound.diffLineInserted = Sound.register({ fileName: 'diffLineInserted.mp3' });
|
|
622
|
+
Sound.diffLineDeleted = Sound.register({ fileName: 'diffLineDeleted.mp3' });
|
|
623
|
+
Sound.diffLineModified = Sound.register({ fileName: 'diffLineModified.mp3' });
|
|
624
|
+
class AudioCue {
|
|
625
|
+
static register(options) {
|
|
626
|
+
const audioCue = ( (new AudioCue(options.sound, options.name, options.settingsKey)));
|
|
627
|
+
AudioCue._audioCues.add(audioCue);
|
|
628
|
+
return audioCue;
|
|
629
|
+
}
|
|
630
|
+
static get allAudioCues() {
|
|
631
|
+
return [...this._audioCues];
|
|
632
|
+
}
|
|
633
|
+
constructor(sound, name, settingsKey) {
|
|
634
|
+
this.sound = sound;
|
|
635
|
+
this.name = name;
|
|
636
|
+
this.settingsKey = settingsKey;
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
AudioCue._audioCues = ( (new Set()));
|
|
640
|
+
AudioCue.error = AudioCue.register({
|
|
641
|
+
name: ( (localize('audioCues.lineHasError.name', 'Error on Line'))),
|
|
642
|
+
sound: Sound.error,
|
|
643
|
+
settingsKey: 'audioCues.lineHasError',
|
|
644
|
+
});
|
|
645
|
+
AudioCue.warning = AudioCue.register({
|
|
646
|
+
name: ( (localize('audioCues.lineHasWarning.name', 'Warning on Line'))),
|
|
647
|
+
sound: Sound.warning,
|
|
648
|
+
settingsKey: 'audioCues.lineHasWarning',
|
|
649
|
+
});
|
|
650
|
+
AudioCue.foldedArea = AudioCue.register({
|
|
651
|
+
name: ( (localize('audioCues.lineHasFoldedArea.name', 'Folded Area on Line'))),
|
|
652
|
+
sound: Sound.foldedArea,
|
|
653
|
+
settingsKey: 'audioCues.lineHasFoldedArea',
|
|
654
|
+
});
|
|
655
|
+
AudioCue.break = AudioCue.register({
|
|
656
|
+
name: ( (localize('audioCues.lineHasBreakpoint.name', 'Breakpoint on Line'))),
|
|
657
|
+
sound: Sound.break,
|
|
658
|
+
settingsKey: 'audioCues.lineHasBreakpoint',
|
|
659
|
+
});
|
|
660
|
+
AudioCue.inlineSuggestion = AudioCue.register({
|
|
661
|
+
name: ( (localize('audioCues.lineHasInlineSuggestion.name', 'Inline Suggestion on Line'))),
|
|
662
|
+
sound: Sound.quickFixes,
|
|
663
|
+
settingsKey: 'audioCues.lineHasInlineSuggestion',
|
|
664
|
+
});
|
|
665
|
+
AudioCue.terminalQuickFix = AudioCue.register({
|
|
666
|
+
name: ( (localize('audioCues.terminalQuickFix.name', 'Terminal Quick Fix'))),
|
|
667
|
+
sound: Sound.quickFixes,
|
|
668
|
+
settingsKey: 'audioCues.terminalQuickFix',
|
|
669
|
+
});
|
|
670
|
+
AudioCue.onDebugBreak = AudioCue.register({
|
|
671
|
+
name: ( (localize('audioCues.onDebugBreak.name', 'Debugger Stopped on Breakpoint'))),
|
|
672
|
+
sound: Sound.break,
|
|
673
|
+
settingsKey: 'audioCues.onDebugBreak',
|
|
674
|
+
});
|
|
675
|
+
AudioCue.noInlayHints = AudioCue.register({
|
|
676
|
+
name: ( (localize('audioCues.noInlayHints', 'No Inlay Hints on Line'))),
|
|
677
|
+
sound: Sound.error,
|
|
678
|
+
settingsKey: 'audioCues.noInlayHints'
|
|
679
|
+
});
|
|
680
|
+
AudioCue.taskCompleted = AudioCue.register({
|
|
681
|
+
name: ( (localize('audioCues.taskCompleted', 'Task Completed'))),
|
|
682
|
+
sound: Sound.taskCompleted,
|
|
683
|
+
settingsKey: 'audioCues.taskCompleted'
|
|
684
|
+
});
|
|
685
|
+
AudioCue.taskFailed = AudioCue.register({
|
|
686
|
+
name: ( (localize('audioCues.taskFailed', 'Task Failed'))),
|
|
687
|
+
sound: Sound.taskFailed,
|
|
688
|
+
settingsKey: 'audioCues.taskFailed'
|
|
689
|
+
});
|
|
690
|
+
AudioCue.terminalCommandFailed = AudioCue.register({
|
|
691
|
+
name: ( (localize('audioCues.terminalCommandFailed', 'Terminal Command Failed'))),
|
|
692
|
+
sound: Sound.taskFailed,
|
|
693
|
+
settingsKey: 'audioCues.terminalCommandFailed'
|
|
694
|
+
});
|
|
695
|
+
AudioCue.terminalBell = AudioCue.register({
|
|
696
|
+
name: ( (localize('audioCues.terminalBell', 'Terminal Bell'))),
|
|
697
|
+
sound: Sound.terminalBell,
|
|
698
|
+
settingsKey: 'audioCues.terminalBell'
|
|
699
|
+
});
|
|
700
|
+
AudioCue.notebookCellCompleted = AudioCue.register({
|
|
701
|
+
name: ( (localize('audioCues.notebookCellCompleted', 'Notebook Cell Completed'))),
|
|
702
|
+
sound: Sound.taskCompleted,
|
|
703
|
+
settingsKey: 'audioCues.notebookCellCompleted'
|
|
704
|
+
});
|
|
705
|
+
AudioCue.notebookCellFailed = AudioCue.register({
|
|
706
|
+
name: ( (localize('audioCues.notebookCellFailed', 'Notebook Cell Failed'))),
|
|
707
|
+
sound: Sound.taskFailed,
|
|
708
|
+
settingsKey: 'audioCues.notebookCellFailed'
|
|
709
|
+
});
|
|
710
|
+
AudioCue.diffLineInserted = AudioCue.register({
|
|
711
|
+
name: ( (localize('audioCues.diffLineInserted', 'Diff Line Inserted'))),
|
|
712
|
+
sound: Sound.diffLineInserted,
|
|
713
|
+
settingsKey: 'audioCues.diffLineInserted'
|
|
714
|
+
});
|
|
715
|
+
AudioCue.diffLineDeleted = AudioCue.register({
|
|
716
|
+
name: ( (localize('audioCues.diffLineDeleted', 'Diff Line Deleted'))),
|
|
717
|
+
sound: Sound.diffLineDeleted,
|
|
718
|
+
settingsKey: 'audioCues.diffLineDeleted'
|
|
719
|
+
});
|
|
720
|
+
AudioCue.diffLineModified = AudioCue.register({
|
|
721
|
+
name: ( (localize('audioCues.diffLineModified', 'Diff Line Modified'))),
|
|
722
|
+
sound: Sound.diffLineModified,
|
|
723
|
+
settingsKey: 'audioCues.diffLineModified'
|
|
724
|
+
});
|
|
725
|
+
class ShowAudioCueHelp extends Action2 {
|
|
726
|
+
constructor() {
|
|
727
|
+
super({
|
|
728
|
+
id: ShowAudioCueHelp.ID,
|
|
729
|
+
title: {
|
|
730
|
+
value: ( (localize('audioCues.help', "Help: List Audio Cues"))),
|
|
731
|
+
original: 'Help: List Audio Cues'
|
|
732
|
+
},
|
|
733
|
+
f1: true,
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
async run(accessor) {
|
|
737
|
+
const audioCueService = accessor.get(IAudioCueService);
|
|
738
|
+
const quickPickService = accessor.get(IQuickInputService);
|
|
739
|
+
const preferencesService = accessor.get(IPreferencesService);
|
|
740
|
+
const accessibilityService = accessor.get(IAccessibilityService);
|
|
741
|
+
const items = AudioCue$1.allAudioCues.map((cue, idx) => ({
|
|
742
|
+
label: accessibilityService.isScreenReaderOptimized() ?
|
|
743
|
+
`${cue.name}${audioCueService.isEnabled(cue) ? '' : ' (' + ( ( localize('disabled', "Disabled"))) + ')'}`
|
|
744
|
+
: `${audioCueService.isEnabled(cue) ? '$(check)' : ' '} ${cue.name}`,
|
|
745
|
+
audioCue: cue,
|
|
746
|
+
buttons: [{
|
|
747
|
+
iconClass: ThemeIcon.asClassName(Codicon.settingsGear),
|
|
748
|
+
tooltip: ( (localize('audioCues.help.settings', 'Enable/Disable Audio Cue'))),
|
|
749
|
+
}],
|
|
750
|
+
}));
|
|
751
|
+
const quickPick = quickPickService.pick(items, {
|
|
752
|
+
activeItem: items[0],
|
|
753
|
+
onDidFocus: (item) => {
|
|
754
|
+
audioCueService.playSound(item.audioCue.sound, true);
|
|
755
|
+
},
|
|
756
|
+
onDidTriggerItemButton: (context) => {
|
|
757
|
+
preferencesService.openSettings({ query: context.item.audioCue.settingsKey });
|
|
758
|
+
},
|
|
759
|
+
placeHolder: ( (localize('audioCues.help.placeholder', 'Select an audio cue to play'))),
|
|
760
|
+
});
|
|
761
|
+
await quickPick;
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
ShowAudioCueHelp.ID = 'audioCues.help';
|
|
765
|
+
let AudioCueLineDebuggerContribution = class AudioCueLineDebuggerContribution extends Disposable {
|
|
766
|
+
constructor(debugService, audioCueService) {
|
|
767
|
+
super();
|
|
768
|
+
this.audioCueService = audioCueService;
|
|
769
|
+
const isEnabled = observableFromEvent(audioCueService.onEnabledChanged(AudioCue$1.onDebugBreak), () => audioCueService.isEnabled(AudioCue$1.onDebugBreak));
|
|
770
|
+
this._register(autorunWithStore((reader, store) => {
|
|
771
|
+
if (!isEnabled.read(reader)) {
|
|
772
|
+
return;
|
|
773
|
+
}
|
|
774
|
+
const sessionDisposables = ( (new Map()));
|
|
775
|
+
store.add(toDisposable(() => {
|
|
776
|
+
sessionDisposables.forEach(d => d.dispose());
|
|
777
|
+
sessionDisposables.clear();
|
|
778
|
+
}));
|
|
779
|
+
store.add(debugService.onDidNewSession((session) => sessionDisposables.set(session, this.handleSession(session))));
|
|
780
|
+
store.add(debugService.onDidEndSession(session => {
|
|
781
|
+
sessionDisposables.get(session)?.dispose();
|
|
782
|
+
sessionDisposables.delete(session);
|
|
783
|
+
}));
|
|
784
|
+
debugService
|
|
785
|
+
.getModel()
|
|
786
|
+
.getSessions()
|
|
787
|
+
.forEach((session) => sessionDisposables.set(session, this.handleSession(session)));
|
|
788
|
+
}, 'subscribe to debug sessions'));
|
|
789
|
+
}
|
|
790
|
+
handleSession(session) {
|
|
791
|
+
return session.onDidChangeState(e => {
|
|
792
|
+
const stoppedDetails = session.getStoppedDetails();
|
|
793
|
+
const BREAKPOINT_STOP_REASON = 'breakpoint';
|
|
794
|
+
if (stoppedDetails && stoppedDetails.reason === BREAKPOINT_STOP_REASON) {
|
|
795
|
+
this.audioCueService.playAudioCue(AudioCue$1.onDebugBreak);
|
|
796
|
+
}
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
};
|
|
800
|
+
AudioCueLineDebuggerContribution = ( (__decorate([
|
|
801
|
+
( (__param(0, IDebugService))),
|
|
802
|
+
( (__param(1, IAudioCueService)))
|
|
803
|
+
], AudioCueLineDebuggerContribution)));
|
|
804
|
+
let AudioCueLineFeatureContribution = class AudioCueLineFeatureContribution extends Disposable {
|
|
805
|
+
constructor(editorService, instantiationService, audioCueService, _configurationService) {
|
|
806
|
+
super();
|
|
807
|
+
this.editorService = editorService;
|
|
808
|
+
this.instantiationService = instantiationService;
|
|
809
|
+
this.audioCueService = audioCueService;
|
|
810
|
+
this._configurationService = _configurationService;
|
|
811
|
+
this.store = this._register(( (new DisposableStore())));
|
|
812
|
+
this.features = [
|
|
813
|
+
this.instantiationService.createInstance(MarkerLineFeature, AudioCue$1.error, MarkerSeverity.Error),
|
|
814
|
+
this.instantiationService.createInstance(MarkerLineFeature, AudioCue$1.warning, MarkerSeverity.Warning),
|
|
815
|
+
this.instantiationService.createInstance(FoldedAreaLineFeature),
|
|
816
|
+
this.instantiationService.createInstance(BreakpointLineFeature),
|
|
817
|
+
this.instantiationService.createInstance(InlineCompletionLineFeature),
|
|
818
|
+
];
|
|
819
|
+
this.isEnabledCache = ( (new CachedFunction(
|
|
820
|
+
(cue) => observableFromEvent(this.audioCueService.onEnabledChanged(cue), () => this.audioCueService.isEnabled(cue))
|
|
821
|
+
)));
|
|
822
|
+
const someAudioCueFeatureIsEnabled = derived('someAudioCueFeatureIsEnabled', (reader) => this.features.some((feature) => this.isEnabledCache.get(feature.audioCue).read(reader)));
|
|
823
|
+
const activeEditorObservable = observableFromEvent(this.editorService.onDidActiveEditorChange, (_) => {
|
|
824
|
+
const activeTextEditorControl = this.editorService.activeTextEditorControl;
|
|
825
|
+
const editor = isDiffEditor(activeTextEditorControl)
|
|
826
|
+
? activeTextEditorControl.getOriginalEditor()
|
|
827
|
+
: isCodeEditor(activeTextEditorControl)
|
|
828
|
+
? activeTextEditorControl
|
|
829
|
+
: undefined;
|
|
830
|
+
return editor && editor.hasModel() ? { editor, model: editor.getModel() } : undefined;
|
|
831
|
+
});
|
|
832
|
+
this._register(autorun('updateAudioCuesEnabled', (reader) => {
|
|
833
|
+
this.store.clear();
|
|
834
|
+
if (!someAudioCueFeatureIsEnabled.read(reader)) {
|
|
835
|
+
return;
|
|
836
|
+
}
|
|
837
|
+
const activeEditor = activeEditorObservable.read(reader);
|
|
838
|
+
if (activeEditor) {
|
|
839
|
+
this.registerAudioCuesForEditor(activeEditor.editor, activeEditor.model, this.store);
|
|
840
|
+
}
|
|
841
|
+
}));
|
|
842
|
+
}
|
|
843
|
+
registerAudioCuesForEditor(editor, editorModel, store) {
|
|
844
|
+
const curPosition = observableFromEvent(editor.onDidChangeCursorPosition, (args) => {
|
|
845
|
+
if (args &&
|
|
846
|
+
args.reason !== 3 &&
|
|
847
|
+
args.reason !== 0 ) {
|
|
848
|
+
return undefined;
|
|
849
|
+
}
|
|
850
|
+
return editor.getPosition();
|
|
851
|
+
});
|
|
852
|
+
const debouncedPosition = debouncedObservable(curPosition, this._configurationService.getValue('audioCues.debouncePositionChanges') ? 300 : 0, store);
|
|
853
|
+
const isTyping = wasEventTriggeredRecently(editorModel.onDidChangeContent.bind(editorModel), 1000, store);
|
|
854
|
+
const featureStates = this.features.map((feature) => {
|
|
855
|
+
const lineFeatureState = feature.getObservableState(editor, editorModel);
|
|
856
|
+
const isFeaturePresent = derived(`isPresentInLine:${feature.audioCue.name}`, (reader) => {
|
|
857
|
+
if (!this.isEnabledCache.get(feature.audioCue).read(reader)) {
|
|
858
|
+
return false;
|
|
859
|
+
}
|
|
860
|
+
const position = debouncedPosition.read(reader);
|
|
861
|
+
if (!position) {
|
|
862
|
+
return false;
|
|
863
|
+
}
|
|
864
|
+
return lineFeatureState.read(reader).isPresent(position);
|
|
865
|
+
});
|
|
866
|
+
return derived(`typingDebouncedFeatureState:\n${feature.audioCue.name}`, (reader) => feature.debounceWhileTyping && isTyping.read(reader)
|
|
867
|
+
? (debouncedPosition.read(reader), isFeaturePresent.get())
|
|
868
|
+
: isFeaturePresent.read(reader));
|
|
869
|
+
});
|
|
870
|
+
const state = derived('states', (reader) => ({
|
|
871
|
+
lineNumber: debouncedPosition.read(reader),
|
|
872
|
+
featureStates: ( (new Map(this.features.map((feature, idx) => [
|
|
873
|
+
feature,
|
|
874
|
+
featureStates[idx].read(reader),
|
|
875
|
+
])))),
|
|
876
|
+
}));
|
|
877
|
+
store.add(autorunDelta('Play Audio Cue', state, ({ lastValue, newValue }) => {
|
|
878
|
+
const newFeatures = this.features.filter(feature => newValue?.featureStates.get(feature) &&
|
|
879
|
+
(!lastValue?.featureStates?.get(feature) || newValue.lineNumber !== lastValue.lineNumber));
|
|
880
|
+
this.audioCueService.playAudioCues(newFeatures.map(f => f.audioCue));
|
|
881
|
+
}));
|
|
882
|
+
}
|
|
883
|
+
};
|
|
884
|
+
AudioCueLineFeatureContribution = ( (__decorate([
|
|
885
|
+
( (__param(0, IEditorService))),
|
|
886
|
+
( (__param(1, IInstantiationService))),
|
|
887
|
+
( (__param(2, IAudioCueService))),
|
|
888
|
+
( (__param(3, IConfigurationService)))
|
|
889
|
+
], AudioCueLineFeatureContribution)));
|
|
890
|
+
let MarkerLineFeature = class MarkerLineFeature {
|
|
891
|
+
constructor(audioCue, severity, markerService) {
|
|
892
|
+
this.audioCue = audioCue;
|
|
893
|
+
this.severity = severity;
|
|
894
|
+
this.markerService = markerService;
|
|
895
|
+
this.debounceWhileTyping = true;
|
|
896
|
+
this._previousLine = 0;
|
|
897
|
+
}
|
|
898
|
+
getObservableState(editor, model) {
|
|
899
|
+
return observableFromEvent(Event.filter(this.markerService.onMarkerChanged, (changedUris) => changedUris.some((u) => ( (u.toString())) === ( (model.uri.toString())))), () => ({
|
|
900
|
+
isPresent: (position) => {
|
|
901
|
+
const lineChanged = position.lineNumber !== this._previousLine;
|
|
902
|
+
this._previousLine = position.lineNumber;
|
|
903
|
+
const hasMarker = this.markerService
|
|
904
|
+
.read({ resource: model.uri })
|
|
905
|
+
.some((m) => {
|
|
906
|
+
const onLine = m.severity === this.severity && m.startLineNumber <= position.lineNumber && position.lineNumber <= m.endLineNumber;
|
|
907
|
+
return lineChanged ? onLine : onLine && (position.lineNumber <= m.endLineNumber && m.startColumn <= position.column);
|
|
908
|
+
});
|
|
909
|
+
return hasMarker;
|
|
910
|
+
},
|
|
911
|
+
}));
|
|
912
|
+
}
|
|
913
|
+
};
|
|
914
|
+
MarkerLineFeature = ( (__decorate([
|
|
915
|
+
( (__param(2, IMarkerService)))
|
|
916
|
+
], MarkerLineFeature)));
|
|
917
|
+
class FoldedAreaLineFeature {
|
|
918
|
+
constructor() {
|
|
919
|
+
this.audioCue = AudioCue$1.foldedArea;
|
|
920
|
+
}
|
|
921
|
+
getObservableState(editor, model) {
|
|
922
|
+
const foldingController = FoldingController.get(editor);
|
|
923
|
+
if (!foldingController) {
|
|
924
|
+
return constObservable({
|
|
925
|
+
isPresent: () => false,
|
|
926
|
+
});
|
|
927
|
+
}
|
|
928
|
+
const foldingModel = observableFromPromise(foldingController.getFoldingModel() ?? Promise.resolve(undefined));
|
|
929
|
+
return foldingModel.map((v) => ({
|
|
930
|
+
isPresent: (position) => {
|
|
931
|
+
const regionAtLine = v.value?.getRegionAtLine(position.lineNumber);
|
|
932
|
+
const hasFolding = !regionAtLine
|
|
933
|
+
? false
|
|
934
|
+
: regionAtLine.isCollapsed &&
|
|
935
|
+
regionAtLine.startLineNumber === position.lineNumber;
|
|
936
|
+
return hasFolding;
|
|
937
|
+
},
|
|
938
|
+
}));
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
let BreakpointLineFeature = class BreakpointLineFeature {
|
|
942
|
+
constructor(debugService) {
|
|
943
|
+
this.debugService = debugService;
|
|
944
|
+
this.audioCue = AudioCue$1.break;
|
|
945
|
+
}
|
|
946
|
+
getObservableState(editor, model) {
|
|
947
|
+
return observableFromEvent(this.debugService.getModel().onDidChangeBreakpoints, () => ({
|
|
948
|
+
isPresent: (position) => {
|
|
949
|
+
const breakpoints = this.debugService
|
|
950
|
+
.getModel()
|
|
951
|
+
.getBreakpoints({ uri: model.uri, lineNumber: position.lineNumber });
|
|
952
|
+
const hasBreakpoints = breakpoints.length > 0;
|
|
953
|
+
return hasBreakpoints;
|
|
954
|
+
},
|
|
955
|
+
}));
|
|
956
|
+
}
|
|
957
|
+
};
|
|
958
|
+
BreakpointLineFeature = ( (__decorate([
|
|
959
|
+
( (__param(0, IDebugService)))
|
|
960
|
+
], BreakpointLineFeature)));
|
|
961
|
+
class InlineCompletionLineFeature {
|
|
962
|
+
constructor() {
|
|
963
|
+
this.audioCue = AudioCue$1.inlineSuggestion;
|
|
964
|
+
}
|
|
965
|
+
getObservableState(editor, _model) {
|
|
966
|
+
const ghostTextController = GhostTextController.get(editor);
|
|
967
|
+
if (!ghostTextController) {
|
|
968
|
+
return constObservable({
|
|
969
|
+
isPresent: () => false,
|
|
970
|
+
});
|
|
971
|
+
}
|
|
972
|
+
const activeGhostText = observableFromEvent(ghostTextController.onActiveModelDidChange, () => ghostTextController.activeModel).map((activeModel) => (activeModel
|
|
973
|
+
? observableFromEvent(activeModel.inlineCompletionsModel.onDidChange, () => activeModel.inlineCompletionsModel.ghostText)
|
|
974
|
+
: undefined));
|
|
975
|
+
return derived('ghostText', reader => {
|
|
976
|
+
const ghostText = activeGhostText.read(reader)?.read(reader);
|
|
977
|
+
return {
|
|
978
|
+
isPresent(position) {
|
|
979
|
+
return ghostText?.lineNumber === position.lineNumber;
|
|
980
|
+
}
|
|
981
|
+
};
|
|
982
|
+
});
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
const audioCueFeatureBase = {
|
|
986
|
+
'type': 'string',
|
|
987
|
+
'enum': ['auto', 'on', 'off'],
|
|
988
|
+
'default': 'auto',
|
|
989
|
+
'enumDescriptions': [
|
|
990
|
+
( (localize(
|
|
991
|
+
'audioCues.enabled.auto',
|
|
992
|
+
"Enable audio cue when a screen reader is attached."
|
|
993
|
+
))),
|
|
994
|
+
( (localize('audioCues.enabled.on', "Enable audio cue."))),
|
|
995
|
+
( (localize('audioCues.enabled.off', "Disable audio cue.")))
|
|
996
|
+
],
|
|
997
|
+
tags: ['accessibility']
|
|
998
|
+
};
|
|
999
|
+
( (Registry.as(Extensions.Configuration))).registerConfiguration({
|
|
1000
|
+
'properties': {
|
|
1001
|
+
'audioCues.enabled': {
|
|
1002
|
+
markdownDeprecationMessage: 'Deprecated. Use the specific setting for each audio cue instead (`audioCues.*`).',
|
|
1003
|
+
tags: ['accessibility']
|
|
1004
|
+
},
|
|
1005
|
+
'audioCues.volume': {
|
|
1006
|
+
'description': ( (localize('audioCues.volume', "The volume of the audio cues in percent (0-100)."))),
|
|
1007
|
+
'type': 'number',
|
|
1008
|
+
'minimum': 0,
|
|
1009
|
+
'maximum': 100,
|
|
1010
|
+
'default': 70,
|
|
1011
|
+
tags: ['accessibility']
|
|
1012
|
+
},
|
|
1013
|
+
'audioCues.debouncePositionChanges': {
|
|
1014
|
+
'description': ( (localize(
|
|
1015
|
+
'audioCues.debouncePositionChanges',
|
|
1016
|
+
"Whether or not position changes should be debounced"
|
|
1017
|
+
))),
|
|
1018
|
+
'type': 'boolean',
|
|
1019
|
+
'default': false,
|
|
1020
|
+
tags: ['accessibility']
|
|
1021
|
+
},
|
|
1022
|
+
'audioCues.lineHasBreakpoint': {
|
|
1023
|
+
'description': ( (localize(
|
|
1024
|
+
'audioCues.lineHasBreakpoint',
|
|
1025
|
+
"Plays a sound when the active line has a breakpoint."
|
|
1026
|
+
))),
|
|
1027
|
+
...audioCueFeatureBase
|
|
1028
|
+
},
|
|
1029
|
+
'audioCues.lineHasInlineSuggestion': {
|
|
1030
|
+
'description': ( (localize(
|
|
1031
|
+
'audioCues.lineHasInlineSuggestion',
|
|
1032
|
+
"Plays a sound when the active line has an inline suggestion."
|
|
1033
|
+
))),
|
|
1034
|
+
...audioCueFeatureBase
|
|
1035
|
+
},
|
|
1036
|
+
'audioCues.lineHasError': {
|
|
1037
|
+
'description': ( (localize(
|
|
1038
|
+
'audioCues.lineHasError',
|
|
1039
|
+
"Plays a sound when the active line has an error."
|
|
1040
|
+
))),
|
|
1041
|
+
...audioCueFeatureBase,
|
|
1042
|
+
},
|
|
1043
|
+
'audioCues.lineHasFoldedArea': {
|
|
1044
|
+
'description': ( (localize(
|
|
1045
|
+
'audioCues.lineHasFoldedArea',
|
|
1046
|
+
"Plays a sound when the active line has a folded area that can be unfolded."
|
|
1047
|
+
))),
|
|
1048
|
+
...audioCueFeatureBase,
|
|
1049
|
+
},
|
|
1050
|
+
'audioCues.lineHasWarning': {
|
|
1051
|
+
'description': ( (localize(
|
|
1052
|
+
'audioCues.lineHasWarning',
|
|
1053
|
+
"Plays a sound when the active line has a warning."
|
|
1054
|
+
))),
|
|
1055
|
+
...audioCueFeatureBase,
|
|
1056
|
+
default: 'off',
|
|
1057
|
+
},
|
|
1058
|
+
'audioCues.onDebugBreak': {
|
|
1059
|
+
'description': ( (localize(
|
|
1060
|
+
'audioCues.onDebugBreak',
|
|
1061
|
+
"Plays a sound when the debugger stopped on a breakpoint."
|
|
1062
|
+
))),
|
|
1063
|
+
...audioCueFeatureBase,
|
|
1064
|
+
},
|
|
1065
|
+
'audioCues.noInlayHints': {
|
|
1066
|
+
'description': ( (localize(
|
|
1067
|
+
'audioCues.noInlayHints',
|
|
1068
|
+
"Plays a sound when trying to read a line with inlay hints that has no inlay hints."
|
|
1069
|
+
))),
|
|
1070
|
+
...audioCueFeatureBase,
|
|
1071
|
+
},
|
|
1072
|
+
'audioCues.taskCompleted': {
|
|
1073
|
+
'description': ( (localize('audioCues.taskCompleted', "Plays a sound when a task is completed."))),
|
|
1074
|
+
...audioCueFeatureBase,
|
|
1075
|
+
},
|
|
1076
|
+
'audioCues.taskFailed': {
|
|
1077
|
+
'description': ( (localize(
|
|
1078
|
+
'audioCues.taskFailed',
|
|
1079
|
+
"Plays a sound when a task fails (non-zero exit code)."
|
|
1080
|
+
))),
|
|
1081
|
+
...audioCueFeatureBase,
|
|
1082
|
+
},
|
|
1083
|
+
'audioCues.terminalCommandFailed': {
|
|
1084
|
+
'description': ( (localize(
|
|
1085
|
+
'audioCues.terminalCommandFailed',
|
|
1086
|
+
"Plays a sound when a terminal command fails (non-zero exit code)."
|
|
1087
|
+
))),
|
|
1088
|
+
...audioCueFeatureBase,
|
|
1089
|
+
},
|
|
1090
|
+
'audioCues.terminalQuickFix': {
|
|
1091
|
+
'description': ( (localize(
|
|
1092
|
+
'audioCues.terminalQuickFix',
|
|
1093
|
+
"Plays a sound when terminal Quick Fixes are available."
|
|
1094
|
+
))),
|
|
1095
|
+
...audioCueFeatureBase,
|
|
1096
|
+
},
|
|
1097
|
+
'audioCues.diffLineInserted': {
|
|
1098
|
+
'description': ( (localize(
|
|
1099
|
+
'audioCues.diffLineInserted',
|
|
1100
|
+
"Plays a sound when the focus moves to an inserted line in diff review mode or to the next/previous change"
|
|
1101
|
+
))),
|
|
1102
|
+
...audioCueFeatureBase,
|
|
1103
|
+
},
|
|
1104
|
+
'audioCues.diffLineDeleted': {
|
|
1105
|
+
'description': ( (localize(
|
|
1106
|
+
'audioCues.diffLineDeleted',
|
|
1107
|
+
"Plays a sound when the focus moves to a deleted line in diff review mode or to the next/previous change"
|
|
1108
|
+
))),
|
|
1109
|
+
...audioCueFeatureBase,
|
|
1110
|
+
},
|
|
1111
|
+
'audioCues.diffLineModified': {
|
|
1112
|
+
'description': ( (localize(
|
|
1113
|
+
'audioCues.diffLineModified',
|
|
1114
|
+
"Plays a sound when the focus moves to a modified line in diff review mode or to the next/previous change"
|
|
1115
|
+
))),
|
|
1116
|
+
...audioCueFeatureBase,
|
|
1117
|
+
},
|
|
1118
|
+
'audioCues.notebookCellCompleted': {
|
|
1119
|
+
'description': ( (localize(
|
|
1120
|
+
'audioCues.notebookCellCompleted',
|
|
1121
|
+
"Plays a sound when a notebook cell execution is successfully completed."
|
|
1122
|
+
))),
|
|
1123
|
+
...audioCueFeatureBase,
|
|
1124
|
+
},
|
|
1125
|
+
'audioCues.notebookCellFailed': {
|
|
1126
|
+
'description': ( (localize(
|
|
1127
|
+
'audioCues.notebookCellFailed',
|
|
1128
|
+
"Plays a sound when a notebook cell execution fails."
|
|
1129
|
+
))),
|
|
1130
|
+
...audioCueFeatureBase,
|
|
1131
|
+
},
|
|
1132
|
+
}
|
|
1133
|
+
});
|
|
1134
|
+
registerAction2(ShowAudioCueHelp);
|
|
1135
|
+
function initialize(instantiationService) {
|
|
1136
|
+
setTimeout(() => {
|
|
1137
|
+
instantiationService.createInstance(AudioCueLineFeatureContribution);
|
|
1138
|
+
instantiationService.createInstance(AudioCueLineDebuggerContribution);
|
|
1139
|
+
});
|
|
1140
|
+
}
|
|
1141
|
+
function getServiceOverride() {
|
|
1142
|
+
onServicesInitialized(initialize);
|
|
1143
|
+
return {
|
|
1144
|
+
[( IAudioCueService.toString())]: new SyncDescriptor(AudioCueService)
|
|
1145
|
+
};
|
|
1146
|
+
}
|
|
1147
|
+
export { getServiceOverride as default };
|