@codingame/monaco-vscode-keybindings-service-override 1.83.9 → 1.83.10-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 (2) hide show
  1. package/monaco.js +80 -11
  2. package/package.json +3 -3
package/monaco.js CHANGED
@@ -2,7 +2,7 @@ import { __decorate, __param } from './external/tslib/tslib.es6.js';
2
2
  import { StandaloneKeybindingService } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js';
3
3
  import { ITextResourceConfigurationService } from 'monaco-editor/esm/vs/editor/common/services/textResourceConfiguration.js';
4
4
  import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
5
- import { StandaloneEditor } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneCodeEditor.js';
5
+ import { StandaloneEditor, StandaloneDiffEditor2 } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneCodeEditor.js';
6
6
  import { isObject } from 'monaco-editor/esm/vs/base/common/types.js';
7
7
  import { distinct, deepClone } from 'monaco-editor/esm/vs/base/common/objects.js';
8
8
  export { errorHandler } from 'monaco-editor/esm/vs/base/common/errors.js';
@@ -67,25 +67,40 @@ ExtensionPoints = __decorate([
67
67
  ( __param(0, IInstantiationService))
68
68
  ], ExtensionPoints);
69
69
  ( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(ExtensionPoints, 1 );
70
- function computeConfiguration(configuration, isDiffEditor, overrides) {
70
+ function computeConfiguration(configuration, overrides) {
71
71
  const editorConfiguration = isObject(configuration.editor) ? deepClone(configuration.editor) : Object.create(null);
72
- if (isDiffEditor && isObject(configuration.diffEditor)) {
73
- Object.assign(editorConfiguration, deepClone(configuration.diffEditor));
72
+ Object.assign(editorConfiguration, deepClone(overrides));
73
+ return editorConfiguration;
74
+ }
75
+ function computeDiffConfiguration(configuration, overrides) {
76
+ const editorConfiguration = computeConfiguration(configuration);
77
+ if (isObject(configuration.diffEditor)) {
78
+ const diffEditorConfiguration = deepClone(configuration.diffEditor);
79
+ diffEditorConfiguration.diffCodeLens = diffEditorConfiguration.codeLens;
80
+ delete diffEditorConfiguration.codeLens;
81
+ diffEditorConfiguration.diffWordWrap = diffEditorConfiguration.wordWrap;
82
+ delete diffEditorConfiguration.wordWrap;
83
+ Object.assign(editorConfiguration, diffEditorConfiguration);
74
84
  }
85
+ editorConfiguration.accessibilityVerbose = configuration.accessibility?.verbosity?.diffEditor ?? false;
75
86
  Object.assign(editorConfiguration, deepClone(overrides));
76
87
  return editorConfiguration;
77
88
  }
78
89
  let ConfiguredStandaloneEditor = class ConfiguredStandaloneEditor extends createInjectedClass(StandaloneEditor) {
79
- constructor(domElement, isDiffEditor, _options = {}, instantiationService, textResourceConfigurationService) {
90
+ constructor(domElement, _options = {}, instantiationService, textResourceConfigurationService) {
80
91
  const { theme, autoDetectHighContrast, model, value, language, accessibilityHelpUrl, ariaContainerElement, overflowWidgetsDomNode, dimension, ...options } = _options;
81
- const computedOptions = computeConfiguration(textResourceConfigurationService.getValue(_options.model?.uri), isDiffEditor, options);
92
+ const computedOptions = computeConfiguration(textResourceConfigurationService.getValue(_options.model?.uri), options);
82
93
  super(instantiationService, domElement, { ...computedOptions, overflowWidgetsDomNode, dimension, theme, autoDetectHighContrast, model, value, language, accessibilityHelpUrl, ariaContainerElement });
83
- this.isDiffEditor = isDiffEditor;
84
94
  this.textResourceConfigurationService = textResourceConfigurationService;
85
95
  this.optionsOverrides = {};
86
96
  this.lastAppliedEditorOptions = computedOptions;
87
97
  this.optionsOverrides = options;
88
- this._register(textResourceConfigurationService.onDidChangeConfiguration(() => this.updateEditorConfiguration()));
98
+ this._register(textResourceConfigurationService.onDidChangeConfiguration((e) => {
99
+ const resource = this.getModel()?.uri;
100
+ if (resource != null && e.affectsConfiguration(resource, 'editor')) {
101
+ this.updateEditorConfiguration();
102
+ }
103
+ }));
89
104
  this._register(this.onDidChangeModelLanguage(() => this.updateEditorConfiguration()));
90
105
  this._register(this.onDidChangeModel(() => this.updateEditorConfiguration()));
91
106
  this.updateEditorConfiguration();
@@ -99,7 +114,7 @@ let ConfiguredStandaloneEditor = class ConfiguredStandaloneEditor extends create
99
114
  if (configuration == null) {
100
115
  return;
101
116
  }
102
- const editorConfiguration = computeConfiguration(configuration, this.isDiffEditor, this.optionsOverrides);
117
+ const editorConfiguration = computeConfiguration(configuration, this.optionsOverrides);
103
118
  let editorSettingsToApply = editorConfiguration;
104
119
  if (this.lastAppliedEditorOptions != null) {
105
120
  editorSettingsToApply = distinct(this.lastAppliedEditorOptions, editorSettingsToApply);
@@ -119,9 +134,63 @@ let ConfiguredStandaloneEditor = class ConfiguredStandaloneEditor extends create
119
134
  }
120
135
  };
121
136
  ConfiguredStandaloneEditor = __decorate([
122
- ( __param(3, IInstantiationService)),
123
- ( __param(4, ITextResourceConfigurationService))
137
+ ( __param(2, IInstantiationService)),
138
+ ( __param(3, ITextResourceConfigurationService))
124
139
  ], ConfiguredStandaloneEditor);
140
+ let ConfiguredStandaloneDiffEditor = class ConfiguredStandaloneDiffEditor extends createInjectedClass(StandaloneDiffEditor2) {
141
+ constructor(domElement, _options = {}, instantiationService, textResourceConfigurationService) {
142
+ const { theme, autoDetectHighContrast, modifiedAriaLabel, originalAriaLabel, overflowWidgetsDomNode, dimension, ...options } = _options;
143
+ const computedOptions = computeDiffConfiguration(textResourceConfigurationService.getValue(undefined), options);
144
+ super(instantiationService, domElement, { ...computedOptions, overflowWidgetsDomNode, dimension, theme, autoDetectHighContrast, modifiedAriaLabel, originalAriaLabel });
145
+ this.textResourceConfigurationService = textResourceConfigurationService;
146
+ this.optionsOverrides = {};
147
+ this.lastAppliedEditorOptions = computedOptions;
148
+ this.optionsOverrides = options;
149
+ this._register(textResourceConfigurationService.onDidChangeConfiguration((e) => {
150
+ const resource = this._targetEditor.getModel()?.uri;
151
+ if (resource != null && (e.affectsConfiguration(resource, 'editor') || e.affectsConfiguration(resource, 'diffEditor') || e.affectsConfiguration(resource, 'accessibility.verbosity.diffEditor'))) {
152
+ this.updateEditorConfiguration();
153
+ }
154
+ }));
155
+ this._register(this._targetEditor.onDidChangeModelLanguage(() => this.updateEditorConfiguration()));
156
+ this._register(this.onDidChangeModel(() => this.updateEditorConfiguration()));
157
+ this.updateEditorConfiguration();
158
+ }
159
+ updateEditorConfiguration() {
160
+ if (this.getModel() == null || this.textResourceConfigurationService == null) {
161
+ return;
162
+ }
163
+ const resource = this._targetEditor.getModel()?.uri;
164
+ const configuration = this.textResourceConfigurationService.getValue(resource);
165
+ if (configuration == null) {
166
+ return;
167
+ }
168
+ const editorConfiguration = computeDiffConfiguration(configuration, this.optionsOverrides);
169
+ let editorSettingsToApply = editorConfiguration;
170
+ if (this.lastAppliedEditorOptions != null) {
171
+ editorSettingsToApply = distinct(this.lastAppliedEditorOptions, editorSettingsToApply);
172
+ }
173
+ if (( Object.keys(editorSettingsToApply)).length > 0) {
174
+ this.lastAppliedEditorOptions = editorConfiguration;
175
+ super.updateOptions(editorSettingsToApply);
176
+ }
177
+ }
178
+ updateOptions(newOptions) {
179
+ this.optionsOverrides ?? (this.optionsOverrides = {});
180
+ this.optionsOverrides = {
181
+ ...this.optionsOverrides,
182
+ ...newOptions
183
+ };
184
+ this.updateEditorConfiguration();
185
+ }
186
+ _createInnerEditor(instantiationService, container, options) {
187
+ return instantiationService.createInstance(ConfiguredStandaloneEditor, container, options);
188
+ }
189
+ };
190
+ ConfiguredStandaloneDiffEditor = __decorate([
191
+ ( __param(2, IInstantiationService)),
192
+ ( __param(3, ITextResourceConfigurationService))
193
+ ], ConfiguredStandaloneDiffEditor);
125
194
  let DelegateStandaloneKeybindingService = class DelegateStandaloneKeybindingService extends StandaloneKeybindingService {
126
195
  constructor(delegate, contextKeyService, commandService, telemetryService, notificationService, logService, codeEditorService) {
127
196
  super(contextKeyService, commandService, telemetryService, notificationService, logService, codeEditorService);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-keybindings-service-override",
3
- "version": "1.83.9",
3
+ "version": "1.83.10-next.0",
4
4
  "keywords": [],
5
5
  "author": {
6
6
  "name": "CodinGame",
@@ -18,8 +18,8 @@
18
18
  "module": "index.js",
19
19
  "types": "index.d.ts",
20
20
  "dependencies": {
21
- "vscode": "npm:@codingame/monaco-vscode-api@1.83.9",
21
+ "vscode": "npm:@codingame/monaco-vscode-api@1.83.10-next.0",
22
22
  "monaco-editor": "0.44.0",
23
- "@codingame/monaco-vscode-files-service-override": "1.83.9"
23
+ "@codingame/monaco-vscode-files-service-override": "1.83.10-next.0"
24
24
  }
25
25
  }