@codingame/monaco-vscode-api 1.76.2 → 1.76.3-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +2 -1
  2. package/dist/api.js +3 -860
  3. package/dist/{extHost.js → api2.js} +16555 -13467
  4. package/dist/async.js +107 -2
  5. package/dist/audioCue.js +105 -103
  6. package/dist/button.js +1 -1
  7. package/dist/cancellation.js +3 -0
  8. package/dist/configuration.js +7 -344
  9. package/dist/configuration2.js +339 -0
  10. package/dist/configurationRegistry.js +441 -0
  11. package/dist/contextkeys.js +211 -0
  12. package/dist/debug.d.ts +22 -0
  13. package/dist/debug.js +15842 -0
  14. package/dist/dialogs.js +855 -9
  15. package/dist/extensionResourceLoader.js +96 -0
  16. package/dist/extensions.d.ts +491 -0
  17. package/dist/extensions.js +70 -0
  18. package/dist/{tools.js → extensionsRegistry.js} +2 -30
  19. package/dist/files.js +1407 -334
  20. package/dist/iconv.js +43 -0
  21. package/dist/injection.js +1 -1
  22. package/dist/jschardet.js +7 -0
  23. package/dist/keybindings.d.ts +1 -485
  24. package/dist/keybindings.js +666 -679
  25. package/dist/labels.js +14 -0
  26. package/dist/languageConfiguration.d.ts +1 -2
  27. package/dist/languageConfiguration.js +9 -16
  28. package/dist/languageService.js +112 -8
  29. package/dist/languages.d.ts +1 -473
  30. package/dist/languages.js +2 -12
  31. package/dist/layout.js +4 -3
  32. package/dist/layoutService.js +1 -1
  33. package/dist/missing-services.js +4710 -74
  34. package/dist/modelEditor.d.ts +324 -2
  35. package/dist/modelEditor.js +15 -228
  36. package/dist/monaco.js +7 -72
  37. package/dist/notifications.js +75 -232
  38. package/dist/polyfill.js +10715 -2459
  39. package/dist/resources.js +197 -0
  40. package/dist/services.d.ts +924 -3
  41. package/dist/services.js +1 -2
  42. package/dist/services2.js +2436 -18
  43. package/dist/snippets.d.ts +1 -473
  44. package/dist/snippets.js +8 -867
  45. package/dist/snippetsService.js +868 -0
  46. package/dist/textFileEditorModel.js +2985 -0
  47. package/dist/textmate.d.ts +3 -475
  48. package/dist/textmate.js +19 -29
  49. package/dist/theme.d.ts +1 -3
  50. package/dist/theme.js +24 -70
  51. package/dist/tokenClassification.d.ts +1 -475
  52. package/dist/tokenClassification.js +11 -37
  53. package/dist/tokenClassificationRegistry.js +8 -4
  54. package/dist/variableResolver.js +1711 -0
  55. package/dist/workbenchThemeService.js +1 -1
  56. package/dist/workspaceContext.js +1 -3
  57. package/package.json +27 -12
  58. package/dist/contextkey.js +0 -419
  59. package/dist/dialog.web.contribution.js +0 -945
package/dist/async.js CHANGED
@@ -1,7 +1,10 @@
1
- import { E as Emitter } from './contextkey.js';
1
+ import { E as Emitter } from './services2.js';
2
2
  import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
3
3
  import { extUri } from 'monaco-editor/esm/vs/base/common/resources.js';
4
4
  import { CancellationError } from 'monaco-editor/esm/vs/base/common/errors.js';
5
+ function isThenable(obj) {
6
+ return !!obj && typeof obj.then === 'function';
7
+ }
5
8
  function raceCancellationError(promise, token) {
6
9
  return ( new Promise((resolve, reject) => {
7
10
  const ref = token.onCancellationRequested(() => {
@@ -11,6 +14,28 @@ function raceCancellationError(promise, token) {
11
14
  promise.then(resolve, reject).finally(() => ref.dispose());
12
15
  }));
13
16
  }
17
+ function raceTimeout(promise, timeout, onTimeout) {
18
+ let promiseResolve = undefined;
19
+ const timer = setTimeout(() => {
20
+ promiseResolve?.(undefined);
21
+ onTimeout?.();
22
+ }, timeout);
23
+ return Promise.race([
24
+ promise.finally(() => clearTimeout(timer)),
25
+ ( new Promise(resolve => promiseResolve = resolve))
26
+ ]);
27
+ }
28
+ function asPromise(callback) {
29
+ return ( new Promise((resolve, reject) => {
30
+ const item = callback();
31
+ if (isThenable(item)) {
32
+ item.then(resolve, reject);
33
+ }
34
+ else {
35
+ resolve(item);
36
+ }
37
+ }));
38
+ }
14
39
  class Sequencer {
15
40
  constructor() {
16
41
  this.current = Promise.resolve(null);
@@ -37,6 +62,25 @@ class Barrier {
37
62
  return this._promise;
38
63
  }
39
64
  }
65
+ function sequence(promiseFactories) {
66
+ const results = [];
67
+ let index = 0;
68
+ const len = promiseFactories.length;
69
+ function next() {
70
+ return index < len ? promiseFactories[index++]() : null;
71
+ }
72
+ function thenHandler(result) {
73
+ if (result !== undefined && result !== null) {
74
+ results.push(result);
75
+ }
76
+ const n = next();
77
+ if (n) {
78
+ return n.then(thenHandler);
79
+ }
80
+ return Promise.resolve(results);
81
+ }
82
+ return Promise.resolve(null).then(thenHandler);
83
+ }
40
84
  class Limiter {
41
85
  constructor(maxDegreeOfParalellism) {
42
86
  this._size = 0;
@@ -141,6 +185,67 @@ class ResourceQueue {
141
185
  this.releaseDrainers();
142
186
  }
143
187
  }
188
+ class TaskSequentializer {
189
+ hasPending(taskId) {
190
+ if (!this._pending) {
191
+ return false;
192
+ }
193
+ if (typeof taskId === 'number') {
194
+ return this._pending.taskId === taskId;
195
+ }
196
+ return !!this._pending;
197
+ }
198
+ get pending() {
199
+ return this._pending?.promise;
200
+ }
201
+ cancelPending() {
202
+ this._pending?.cancel();
203
+ }
204
+ setPending(taskId, promise, onCancel) {
205
+ this._pending = { taskId, cancel: () => onCancel?.(), promise };
206
+ promise.then(() => this.donePending(taskId), () => this.donePending(taskId));
207
+ return promise;
208
+ }
209
+ donePending(taskId) {
210
+ if (this._pending && taskId === this._pending.taskId) {
211
+ this._pending = undefined;
212
+ this.triggerNext();
213
+ }
214
+ }
215
+ triggerNext() {
216
+ if (this._next) {
217
+ const next = this._next;
218
+ this._next = undefined;
219
+ next.run().then(next.promiseResolve, next.promiseReject);
220
+ }
221
+ }
222
+ setNext(run) {
223
+ if (!this._next) {
224
+ let promiseResolve;
225
+ let promiseReject;
226
+ const promise = ( new Promise((resolve, reject) => {
227
+ promiseResolve = resolve;
228
+ promiseReject = reject;
229
+ }));
230
+ this._next = {
231
+ run,
232
+ promise,
233
+ promiseResolve: promiseResolve,
234
+ promiseReject: promiseReject
235
+ };
236
+ }
237
+ else {
238
+ this._next.run = run;
239
+ }
240
+ return this._next.promise;
241
+ }
242
+ hasNext() {
243
+ return !!this._next;
244
+ }
245
+ async join() {
246
+ return this._next?.promise ?? this._pending?.promise;
247
+ }
248
+ }
144
249
  class IntervalCounter {
145
250
  constructor(interval, nowFn = () => Date.now()) {
146
251
  this.interval = interval;
@@ -193,4 +298,4 @@ class DeferredPromise {
193
298
  cancel() {
194
299
  }
195
300
  }
196
- export { Barrier as B, IntervalCounter as I, ResourceQueue as R, Sequencer as S, raceCancellationError as r };
301
+ export { Barrier as B, IntervalCounter as I, Queue as Q, ResourceQueue as R, Sequencer as S, TaskSequentializer as T, asPromise as a, raceTimeout as b, raceCancellationError as r, sequence as s };
package/dist/audioCue.js CHANGED
@@ -1,7 +1,6 @@
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';
1
+ import { o as onServicesInitialized } from './polyfill.js';
2
+ import { bS as IPreferencesService } from './missing-services.js';
3
+ import { _ as __decorate, a as __param, I as IEditorService, u as IDebugService } from './services2.js';
5
4
  import { Disposable, DisposableStore, toDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
6
5
  import { IAudioCueService, AudioCue as AudioCue$1 } from 'monaco-editor/esm/vs/platform/audioCues/browser/audioCueService.js';
7
6
  import { MarkerSeverity, IMarkerService } from 'monaco-editor/esm/vs/platform/markers/common/markers.js';
@@ -12,7 +11,6 @@ import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configurati
12
11
  import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
13
12
  import { FoldingController } from 'monaco-editor/esm/vs/editor/contrib/folding/browser/folding.js';
14
13
  import { GhostTextController } from 'monaco-editor/esm/vs/editor/contrib/inlineCompletions/browser/ghostTextController.js';
15
- import { o as onServicesInitialized } from './tools.js';
16
14
  import { registerAction2, Action2 } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
17
15
  import { localize } from 'monaco-editor/esm/vs/nls.js';
18
16
  import { IQuickInputService } from 'monaco-editor/esm/vs/platform/quickinput/common/quickInput.js';
@@ -501,8 +499,10 @@ let AudioCueService = class AudioCueService extends Disposable {
501
499
  }
502
500
  }
503
501
  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)));
502
+ const sounds = ( (new Set(
503
+ (cues.filter(cue => this.isEnabled(cue)).map(cue => cue.sound))
504
+ )));
505
+ await Promise.all(( (Array.from(sounds).map(sound => this.playSound(sound, true)))));
506
506
  }
507
507
  getVolumeInPercent() {
508
508
  const volume = this.configurationService.getValue('audioCues.volume');
@@ -722,85 +722,6 @@ AudioCue.diffLineModified = AudioCue.register({
722
722
  sound: Sound.diffLineModified,
723
723
  settingsKey: 'audioCues.diffLineModified'
724
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
725
  let AudioCueLineFeatureContribution = class AudioCueLineFeatureContribution extends Disposable {
805
726
  constructor(editorService, instantiationService, audioCueService, _configurationService) {
806
727
  super();
@@ -851,7 +772,7 @@ let AudioCueLineFeatureContribution = class AudioCueLineFeatureContribution exte
851
772
  });
852
773
  const debouncedPosition = debouncedObservable(curPosition, this._configurationService.getValue('audioCues.debouncePositionChanges') ? 300 : 0, store);
853
774
  const isTyping = wasEventTriggeredRecently(editorModel.onDidChangeContent.bind(editorModel), 1000, store);
854
- const featureStates = this.features.map((feature) => {
775
+ const featureStates = ( (this.features.map((feature) => {
855
776
  const lineFeatureState = feature.getObservableState(editor, editorModel);
856
777
  const isFeaturePresent = derived(`isPresentInLine:${feature.audioCue.name}`, (reader) => {
857
778
  if (!this.isEnabledCache.get(feature.audioCue).read(reader)) {
@@ -866,18 +787,18 @@ let AudioCueLineFeatureContribution = class AudioCueLineFeatureContribution exte
866
787
  return derived(`typingDebouncedFeatureState:\n${feature.audioCue.name}`, (reader) => feature.debounceWhileTyping && isTyping.read(reader)
867
788
  ? (debouncedPosition.read(reader), isFeaturePresent.get())
868
789
  : isFeaturePresent.read(reader));
869
- });
790
+ })));
870
791
  const state = derived('states', (reader) => ({
871
792
  lineNumber: debouncedPosition.read(reader),
872
- featureStates: ( (new Map(this.features.map((feature, idx) => [
793
+ featureStates: ( (new Map( (this.features.map((feature, idx) => [
873
794
  feature,
874
795
  featureStates[idx].read(reader),
875
- ])))),
796
+ ]))))),
876
797
  }));
877
798
  store.add(autorunDelta('Play Audio Cue', state, ({ lastValue, newValue }) => {
878
799
  const newFeatures = this.features.filter(feature => newValue?.featureStates.get(feature) &&
879
800
  (!lastValue?.featureStates?.get(feature) || newValue.lineNumber !== lastValue.lineNumber));
880
- this.audioCueService.playAudioCues(newFeatures.map(f => f.audioCue));
801
+ this.audioCueService.playAudioCues(( (newFeatures.map(f => f.audioCue))));
881
802
  }));
882
803
  }
883
804
  };
@@ -926,16 +847,18 @@ class FoldedAreaLineFeature {
926
847
  });
927
848
  }
928
849
  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
- }));
850
+ return (
851
+ (foldingModel.map((v) => ({
852
+ isPresent: (position) => {
853
+ const regionAtLine = v.value?.getRegionAtLine(position.lineNumber);
854
+ const hasFolding = !regionAtLine
855
+ ? false
856
+ : regionAtLine.isCollapsed &&
857
+ regionAtLine.startLineNumber === position.lineNumber;
858
+ return hasFolding;
859
+ },
860
+ })))
861
+ );
939
862
  }
940
863
  }
941
864
  let BreakpointLineFeature = class BreakpointLineFeature {
@@ -969,9 +892,9 @@ class InlineCompletionLineFeature {
969
892
  isPresent: () => false,
970
893
  });
971
894
  }
972
- const activeGhostText = observableFromEvent(ghostTextController.onActiveModelDidChange, () => ghostTextController.activeModel).map((activeModel) => (activeModel
895
+ const activeGhostText = ( (observableFromEvent(ghostTextController.onActiveModelDidChange, () => ghostTextController.activeModel).map((activeModel) => (activeModel
973
896
  ? observableFromEvent(activeModel.inlineCompletionsModel.onDidChange, () => activeModel.inlineCompletionsModel.ghostText)
974
- : undefined));
897
+ : undefined))));
975
898
  return derived('ghostText', reader => {
976
899
  const ghostText = activeGhostText.read(reader)?.read(reader);
977
900
  return {
@@ -982,6 +905,85 @@ class InlineCompletionLineFeature {
982
905
  });
983
906
  }
984
907
  }
908
+ let AudioCueLineDebuggerContribution = class AudioCueLineDebuggerContribution extends Disposable {
909
+ constructor(debugService, audioCueService) {
910
+ super();
911
+ this.audioCueService = audioCueService;
912
+ const isEnabled = observableFromEvent(audioCueService.onEnabledChanged(AudioCue$1.onDebugBreak), () => audioCueService.isEnabled(AudioCue$1.onDebugBreak));
913
+ this._register(autorunWithStore((reader, store) => {
914
+ if (!isEnabled.read(reader)) {
915
+ return;
916
+ }
917
+ const sessionDisposables = ( (new Map()));
918
+ store.add(toDisposable(() => {
919
+ sessionDisposables.forEach(d => d.dispose());
920
+ sessionDisposables.clear();
921
+ }));
922
+ store.add(debugService.onDidNewSession((session) => sessionDisposables.set(session, this.handleSession(session))));
923
+ store.add(debugService.onDidEndSession(session => {
924
+ sessionDisposables.get(session)?.dispose();
925
+ sessionDisposables.delete(session);
926
+ }));
927
+ debugService
928
+ .getModel()
929
+ .getSessions()
930
+ .forEach((session) => sessionDisposables.set(session, this.handleSession(session)));
931
+ }, 'subscribe to debug sessions'));
932
+ }
933
+ handleSession(session) {
934
+ return session.onDidChangeState(e => {
935
+ const stoppedDetails = session.getStoppedDetails();
936
+ const BREAKPOINT_STOP_REASON = 'breakpoint';
937
+ if (stoppedDetails && stoppedDetails.reason === BREAKPOINT_STOP_REASON) {
938
+ this.audioCueService.playAudioCue(AudioCue$1.onDebugBreak);
939
+ }
940
+ });
941
+ }
942
+ };
943
+ AudioCueLineDebuggerContribution = ( (__decorate([
944
+ ( (__param(0, IDebugService))),
945
+ ( (__param(1, IAudioCueService)))
946
+ ], AudioCueLineDebuggerContribution)));
947
+ class ShowAudioCueHelp extends Action2 {
948
+ constructor() {
949
+ super({
950
+ id: ShowAudioCueHelp.ID,
951
+ title: {
952
+ value: ( (localize('audioCues.help', "Help: List Audio Cues"))),
953
+ original: 'Help: List Audio Cues'
954
+ },
955
+ f1: true,
956
+ });
957
+ }
958
+ async run(accessor) {
959
+ const audioCueService = accessor.get(IAudioCueService);
960
+ const quickPickService = accessor.get(IQuickInputService);
961
+ const preferencesService = accessor.get(IPreferencesService);
962
+ const accessibilityService = accessor.get(IAccessibilityService);
963
+ const items = ( (AudioCue$1.allAudioCues.map((cue, idx) => ({
964
+ label: accessibilityService.isScreenReaderOptimized() ?
965
+ `${cue.name}${audioCueService.isEnabled(cue) ? '' : ' (' + ( ( localize('disabled', "Disabled"))) + ')'}`
966
+ : `${audioCueService.isEnabled(cue) ? '$(check)' : ' '} ${cue.name}`,
967
+ audioCue: cue,
968
+ buttons: [{
969
+ iconClass: ThemeIcon.asClassName(Codicon.settingsGear),
970
+ tooltip: ( (localize('audioCues.help.settings', 'Enable/Disable Audio Cue'))),
971
+ }],
972
+ }))));
973
+ const quickPick = quickPickService.pick(items, {
974
+ activeItem: items[0],
975
+ onDidFocus: (item) => {
976
+ audioCueService.playSound(item.audioCue.sound, true);
977
+ },
978
+ onDidTriggerItemButton: (context) => {
979
+ preferencesService.openSettings({ query: context.item.audioCue.settingsKey });
980
+ },
981
+ placeHolder: ( (localize('audioCues.help.placeholder', 'Select an audio cue to play'))),
982
+ });
983
+ await quickPick;
984
+ }
985
+ }
986
+ ShowAudioCueHelp.ID = 'audioCues.help';
985
987
  const audioCueFeatureBase = {
986
988
  'type': 'string',
987
989
  'enum': ['auto', 'on', 'off'],
package/dist/button.js CHANGED
@@ -1,4 +1,4 @@
1
- import { E as Emitter } from './contextkey.js';
1
+ import { E as Emitter } from './services2.js';
2
2
  import { n } from './polyfill.js';
3
3
  import { addDisposableListener, EventType, EventHelper, trackFocus, reset } from 'monaco-editor/esm/vs/base/browser/dom.js';
4
4
  import { renderLabelWithIcons } from 'monaco-editor/esm/vs/base/browser/ui/iconLabel/iconLabels.js';
@@ -0,0 +1,3 @@
1
+ import * as monaco from 'monaco-editor/esm/vs/editor/editor.api.js';
2
+ const CancellationTokenSource = monaco.CancellationTokenSource;
3
+ export { CancellationTokenSource as C };