@codingame/monaco-editor-wrapper 1.15.0 → 2.0.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.
package/dist/main.js
CHANGED
|
@@ -5,6 +5,8 @@ import onigFile from 'vscode-oniguruma/release/onig.wasm';
|
|
|
5
5
|
import { loadWASM, createOnigScanner, createOnigString } from 'vscode-oniguruma';
|
|
6
6
|
import { e as extensions, g as getConfiguration$1, o as onConfigurationChanged } from './index.js';
|
|
7
7
|
export { g as getConfiguration, o as onConfigurationChanged, r as registerConfigurations, a as registerDefaultConfigurations, u as updateUserConfiguration } from './index.js';
|
|
8
|
+
import getModelEditorServiceOverride from 'vscode/service-override/modelEditor';
|
|
9
|
+
import getMessageServiceOverride from 'vscode/service-override/messages';
|
|
8
10
|
import './worker.js';
|
|
9
11
|
import 'monaco-editor/esm/vs/editor/editor.all';
|
|
10
12
|
import 'monaco-editor/esm/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp';
|
|
@@ -4080,326 +4082,6 @@ for (const themeExtensionPoint of defaultThemes) {
|
|
|
4080
4082
|
});
|
|
4081
4083
|
}
|
|
4082
4084
|
|
|
4083
|
-
let popupEditorDisposable = null;
|
|
4084
|
-
|
|
4085
|
-
function openNewCodeEditor(model) {
|
|
4086
|
-
if (popupEditorDisposable != null) {
|
|
4087
|
-
popupEditorDisposable.dispose();
|
|
4088
|
-
popupEditorDisposable = null;
|
|
4089
|
-
}
|
|
4090
|
-
|
|
4091
|
-
const container = document.createElement('div');
|
|
4092
|
-
container.style.position = 'fixed';
|
|
4093
|
-
container.style.zIndex = '10000';
|
|
4094
|
-
container.style.backgroundColor = 'rgba(0, 0, 0, 0.5)';
|
|
4095
|
-
container.style.top = container.style.bottom = container.style.left = container.style.right = '0';
|
|
4096
|
-
container.style.cursor = 'pointer';
|
|
4097
|
-
const editorElem = document.createElement('div');
|
|
4098
|
-
editorElem.style.position = 'absolute';
|
|
4099
|
-
editorElem.style.top = editorElem.style.bottom = editorElem.style.left = editorElem.style.right = '0';
|
|
4100
|
-
editorElem.style.margin = 'auto';
|
|
4101
|
-
editorElem.style.width = '80%';
|
|
4102
|
-
editorElem.style.height = '80%';
|
|
4103
|
-
container.appendChild(editorElem);
|
|
4104
|
-
document.body.appendChild(container);
|
|
4105
|
-
const editor = createEditor(editorElem, _objectSpread2({
|
|
4106
|
-
model,
|
|
4107
|
-
readOnly: true,
|
|
4108
|
-
automaticLayout: true
|
|
4109
|
-
}, getConfiguration$1(model.getLanguageId(), 'editor')));
|
|
4110
|
-
popupEditorDisposable = {
|
|
4111
|
-
dispose: () => {
|
|
4112
|
-
editor.dispose();
|
|
4113
|
-
document.body.removeChild(container);
|
|
4114
|
-
popupEditorDisposable = null;
|
|
4115
|
-
}
|
|
4116
|
-
};
|
|
4117
|
-
container.addEventListener('mousedown', event => {
|
|
4118
|
-
var _popupEditorDisposabl;
|
|
4119
|
-
|
|
4120
|
-
if (event.target !== container) {
|
|
4121
|
-
return;
|
|
4122
|
-
}
|
|
4123
|
-
|
|
4124
|
-
(_popupEditorDisposabl = popupEditorDisposable) === null || _popupEditorDisposabl === void 0 ? void 0 : _popupEditorDisposabl.dispose();
|
|
4125
|
-
});
|
|
4126
|
-
return editor;
|
|
4127
|
-
}
|
|
4128
|
-
|
|
4129
|
-
class MultiEditorStandaloneCodeEditorServiceImpl extends monaco$2.extra.StandaloneCodeEditorService {
|
|
4130
|
-
constructor(contextKeyService, themeService, textModelService) {
|
|
4131
|
-
super(contextKeyService, themeService);
|
|
4132
|
-
|
|
4133
|
-
_defineProperty(this, "textModelService", void 0);
|
|
4134
|
-
|
|
4135
|
-
_defineProperty(this, "handlers", []);
|
|
4136
|
-
|
|
4137
|
-
this.textModelService = textModelService;
|
|
4138
|
-
}
|
|
4139
|
-
|
|
4140
|
-
registerEditorOpenHandler(handler) {
|
|
4141
|
-
this.handlers.push(handler);
|
|
4142
|
-
return {
|
|
4143
|
-
dispose: () => {
|
|
4144
|
-
const index = this.handlers.indexOf(handler);
|
|
4145
|
-
|
|
4146
|
-
if (index >= 0) {
|
|
4147
|
-
this.handlers.splice(index, 1);
|
|
4148
|
-
}
|
|
4149
|
-
}
|
|
4150
|
-
};
|
|
4151
|
-
}
|
|
4152
|
-
|
|
4153
|
-
async openCodeEditor(input, editor, sideBySide) {
|
|
4154
|
-
var _modelEditor$getDomNo;
|
|
4155
|
-
|
|
4156
|
-
const reference = await this.textModelService.createModelReference(input.resource);
|
|
4157
|
-
const model = reference.object.textEditorModel;
|
|
4158
|
-
let modelEditor;
|
|
4159
|
-
|
|
4160
|
-
if (editor != null && editor.getModel() === model) {
|
|
4161
|
-
modelEditor = editor;
|
|
4162
|
-
}
|
|
4163
|
-
|
|
4164
|
-
if (modelEditor == null) {
|
|
4165
|
-
const codeEditors = monaco$2.extra.StandaloneServices.get(monaco$2.extra.ICodeEditorService).listCodeEditors();
|
|
4166
|
-
modelEditor = codeEditors.find(editor => editor.getModel() === model);
|
|
4167
|
-
}
|
|
4168
|
-
|
|
4169
|
-
if (modelEditor == null) {
|
|
4170
|
-
for (const handler of this.handlers) {
|
|
4171
|
-
const handlerEditor = await handler(model, input, editor, sideBySide);
|
|
4172
|
-
|
|
4173
|
-
if (handlerEditor != null) {
|
|
4174
|
-
modelEditor = handlerEditor;
|
|
4175
|
-
break;
|
|
4176
|
-
}
|
|
4177
|
-
}
|
|
4178
|
-
}
|
|
4179
|
-
|
|
4180
|
-
if (modelEditor == null) {
|
|
4181
|
-
modelEditor = openNewCodeEditor(model);
|
|
4182
|
-
}
|
|
4183
|
-
|
|
4184
|
-
super.doOpenEditor(modelEditor, input);
|
|
4185
|
-
modelEditor.focus();
|
|
4186
|
-
|
|
4187
|
-
if (((_modelEditor$getDomNo = modelEditor.getDomNode()) === null || _modelEditor$getDomNo === void 0 ? void 0 : _modelEditor$getDomNo.scrollIntoView) != null) {
|
|
4188
|
-
var _modelEditor$getDomNo2;
|
|
4189
|
-
|
|
4190
|
-
(_modelEditor$getDomNo2 = modelEditor.getDomNode()) === null || _modelEditor$getDomNo2 === void 0 ? void 0 : _modelEditor$getDomNo2.scrollIntoView({
|
|
4191
|
-
block: 'nearest',
|
|
4192
|
-
inline: 'nearest'
|
|
4193
|
-
});
|
|
4194
|
-
}
|
|
4195
|
-
|
|
4196
|
-
const onModelUnmount = () => {
|
|
4197
|
-
reference.dispose();
|
|
4198
|
-
};
|
|
4199
|
-
|
|
4200
|
-
const onDidDisposeDisposable = modelEditor.onDidDispose(() => {
|
|
4201
|
-
onModelUnmount();
|
|
4202
|
-
});
|
|
4203
|
-
const onDidChangeModelDisposable = modelEditor.onDidChangeModel(e => {
|
|
4204
|
-
if (e.newModelUrl == null || e.newModelUrl.toString() !== model.uri.toString()) {
|
|
4205
|
-
onModelUnmount();
|
|
4206
|
-
onDidDisposeDisposable.dispose();
|
|
4207
|
-
onDidChangeModelDisposable.dispose();
|
|
4208
|
-
}
|
|
4209
|
-
});
|
|
4210
|
-
return modelEditor;
|
|
4211
|
-
}
|
|
4212
|
-
|
|
4213
|
-
}
|
|
4214
|
-
|
|
4215
|
-
class SimpleResolvedModel {
|
|
4216
|
-
constructor(model, readonly) {
|
|
4217
|
-
this.model = model;
|
|
4218
|
-
this.readonly = readonly;
|
|
4219
|
-
|
|
4220
|
-
_defineProperty(this, "_onWillDispose", void 0);
|
|
4221
|
-
|
|
4222
|
-
_defineProperty(this, "disposed", false);
|
|
4223
|
-
|
|
4224
|
-
this._onWillDispose = new monaco$2.Emitter();
|
|
4225
|
-
}
|
|
4226
|
-
|
|
4227
|
-
getLanguageId() {
|
|
4228
|
-
return this.model.getLanguageId();
|
|
4229
|
-
}
|
|
4230
|
-
|
|
4231
|
-
get onWillDispose() {
|
|
4232
|
-
return this._onWillDispose.event;
|
|
4233
|
-
}
|
|
4234
|
-
|
|
4235
|
-
resolve() {
|
|
4236
|
-
return Promise.resolve();
|
|
4237
|
-
}
|
|
4238
|
-
|
|
4239
|
-
get textEditorModel() {
|
|
4240
|
-
return this.model;
|
|
4241
|
-
}
|
|
4242
|
-
|
|
4243
|
-
createSnapshot() {
|
|
4244
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4245
|
-
return this.model.createSnapshot();
|
|
4246
|
-
}
|
|
4247
|
-
|
|
4248
|
-
isReadonly() {
|
|
4249
|
-
return this.readonly;
|
|
4250
|
-
}
|
|
4251
|
-
|
|
4252
|
-
dispose() {
|
|
4253
|
-
this.disposed = true;
|
|
4254
|
-
|
|
4255
|
-
this._onWillDispose.fire();
|
|
4256
|
-
}
|
|
4257
|
-
|
|
4258
|
-
isDisposed() {
|
|
4259
|
-
return this.disposed;
|
|
4260
|
-
}
|
|
4261
|
-
|
|
4262
|
-
isResolved() {
|
|
4263
|
-
return true;
|
|
4264
|
-
}
|
|
4265
|
-
|
|
4266
|
-
getMode() {
|
|
4267
|
-
return this.model.getLanguageId();
|
|
4268
|
-
}
|
|
4269
|
-
|
|
4270
|
-
}
|
|
4271
|
-
|
|
4272
|
-
class ResourceModelCollection extends monaco$2.extra.ReferenceCollection {
|
|
4273
|
-
constructor() {
|
|
4274
|
-
super(...arguments);
|
|
4275
|
-
|
|
4276
|
-
_defineProperty(this, "providers", new Map());
|
|
4277
|
-
|
|
4278
|
-
_defineProperty(this, "modelsToDispose", new Set());
|
|
4279
|
-
}
|
|
4280
|
-
|
|
4281
|
-
async createReferencedObject(key) {
|
|
4282
|
-
// Untrack as being disposed
|
|
4283
|
-
this.modelsToDispose.delete(key);
|
|
4284
|
-
const resource = monaco$2.Uri.parse(key);
|
|
4285
|
-
const existingModel = monaco$2.editor.getModel(resource);
|
|
4286
|
-
|
|
4287
|
-
if (existingModel != null) {
|
|
4288
|
-
return new SimpleResolvedModel(existingModel, false);
|
|
4289
|
-
}
|
|
4290
|
-
|
|
4291
|
-
if (this.providers.has(resource.scheme)) {
|
|
4292
|
-
const model = await this.resolveTextModelContent(key);
|
|
4293
|
-
const resolvedModel = new SimpleResolvedModel(model, true);
|
|
4294
|
-
resolvedModel.onWillDispose(() => {
|
|
4295
|
-
model.dispose();
|
|
4296
|
-
});
|
|
4297
|
-
return resolvedModel;
|
|
4298
|
-
}
|
|
4299
|
-
|
|
4300
|
-
throw new Error("Unable to resolve resource ".concat(key));
|
|
4301
|
-
}
|
|
4302
|
-
|
|
4303
|
-
destroyReferencedObject(key, modelPromise) {
|
|
4304
|
-
const resource = monaco$2.Uri.parse(key);
|
|
4305
|
-
|
|
4306
|
-
if (resource.scheme === 'untitled' || resource.scheme === 'inMemory') {
|
|
4307
|
-
return;
|
|
4308
|
-
}
|
|
4309
|
-
|
|
4310
|
-
this.modelsToDispose.add(key);
|
|
4311
|
-
(async () => {
|
|
4312
|
-
try {
|
|
4313
|
-
const model = await modelPromise;
|
|
4314
|
-
|
|
4315
|
-
if (!this.modelsToDispose.has(key)) {
|
|
4316
|
-
// return if model has been acquired again meanwhile
|
|
4317
|
-
return;
|
|
4318
|
-
} // Finally we can dispose the model
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
model.dispose();
|
|
4322
|
-
} finally {
|
|
4323
|
-
this.modelsToDispose.delete(key); // Untrack as being disposed
|
|
4324
|
-
}
|
|
4325
|
-
})().catch(() => {// ignore
|
|
4326
|
-
});
|
|
4327
|
-
}
|
|
4328
|
-
|
|
4329
|
-
registerTextModelContentProvider(scheme, provider) {
|
|
4330
|
-
let providers = this.providers.get(scheme);
|
|
4331
|
-
|
|
4332
|
-
if (providers == null) {
|
|
4333
|
-
providers = [];
|
|
4334
|
-
this.providers.set(scheme, providers);
|
|
4335
|
-
}
|
|
4336
|
-
|
|
4337
|
-
providers.unshift(provider);
|
|
4338
|
-
return monaco$2.extra.toDisposable(() => {
|
|
4339
|
-
const providersForScheme = this.providers.get(scheme);
|
|
4340
|
-
|
|
4341
|
-
if (providersForScheme == null) {
|
|
4342
|
-
return;
|
|
4343
|
-
}
|
|
4344
|
-
|
|
4345
|
-
const index = providersForScheme.indexOf(provider);
|
|
4346
|
-
|
|
4347
|
-
if (index === -1) {
|
|
4348
|
-
return;
|
|
4349
|
-
}
|
|
4350
|
-
|
|
4351
|
-
providersForScheme.splice(index, 1);
|
|
4352
|
-
|
|
4353
|
-
if (providersForScheme.length === 0) {
|
|
4354
|
-
this.providers.delete(scheme);
|
|
4355
|
-
}
|
|
4356
|
-
});
|
|
4357
|
-
}
|
|
4358
|
-
|
|
4359
|
-
hasTextModelContentProvider(scheme) {
|
|
4360
|
-
return this.providers.get(scheme) !== undefined;
|
|
4361
|
-
}
|
|
4362
|
-
|
|
4363
|
-
async resolveTextModelContent(key) {
|
|
4364
|
-
var _this$providers$get;
|
|
4365
|
-
|
|
4366
|
-
const resource = monaco$2.Uri.parse(key);
|
|
4367
|
-
const providersForScheme = (_this$providers$get = this.providers.get(resource.scheme)) !== null && _this$providers$get !== void 0 ? _this$providers$get : [];
|
|
4368
|
-
|
|
4369
|
-
for (const provider of providersForScheme) {
|
|
4370
|
-
const value = await provider.provideTextContent(resource);
|
|
4371
|
-
|
|
4372
|
-
if (value != null) {
|
|
4373
|
-
return value;
|
|
4374
|
-
}
|
|
4375
|
-
}
|
|
4376
|
-
|
|
4377
|
-
throw new Error("Unable to resolve text model content for resource ".concat(key));
|
|
4378
|
-
}
|
|
4379
|
-
|
|
4380
|
-
}
|
|
4381
|
-
|
|
4382
|
-
class TextModelService extends monaco$2.extra.StandaloneTextModelService {
|
|
4383
|
-
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
4384
|
-
constructor(modelService) {
|
|
4385
|
-
super(modelService);
|
|
4386
|
-
|
|
4387
|
-
_defineProperty(this, "resourceModelCollection", new ResourceModelCollection());
|
|
4388
|
-
|
|
4389
|
-
_defineProperty(this, "asyncModelCollection", new monaco$2.extra.AsyncReferenceCollection(this.resourceModelCollection));
|
|
4390
|
-
}
|
|
4391
|
-
|
|
4392
|
-
registerTextModelContentProvider(scheme, provider) {
|
|
4393
|
-
return this.resourceModelCollection.registerTextModelContentProvider(scheme, provider);
|
|
4394
|
-
}
|
|
4395
|
-
|
|
4396
|
-
async createModelReference(resource) {
|
|
4397
|
-
const result = await this.asyncModelCollection.acquire(resource.toString());
|
|
4398
|
-
return result;
|
|
4399
|
-
}
|
|
4400
|
-
|
|
4401
|
-
}
|
|
4402
|
-
|
|
4403
4085
|
const fixedPositions = [0, 6, 7, 11];
|
|
4404
4086
|
const lastFixedPosition = fixedPositions[fixedPositions.length - 1];
|
|
4405
4087
|
|
|
@@ -4519,16 +4201,136 @@ function setup(editor) {
|
|
|
4519
4201
|
setup$1(editor);
|
|
4520
4202
|
}
|
|
4521
4203
|
|
|
4522
|
-
|
|
4523
|
-
get textModelService() {
|
|
4524
|
-
return new TextModelService(monaco$2.extra.StandaloneServices.get(monaco$2.extra.IModelService));
|
|
4525
|
-
},
|
|
4204
|
+
let currentEditor = null;
|
|
4526
4205
|
|
|
4527
|
-
|
|
4528
|
-
|
|
4206
|
+
function openNewCodeEditor(model) {
|
|
4207
|
+
if (currentEditor != null && model === currentEditor.model) {
|
|
4208
|
+
return currentEditor.editor;
|
|
4209
|
+
}
|
|
4210
|
+
|
|
4211
|
+
if (currentEditor != null) {
|
|
4212
|
+
currentEditor.dispose();
|
|
4213
|
+
currentEditor = null;
|
|
4529
4214
|
}
|
|
4530
4215
|
|
|
4531
|
-
|
|
4216
|
+
const container = document.createElement('div');
|
|
4217
|
+
container.style.position = 'fixed';
|
|
4218
|
+
container.style.zIndex = '10000';
|
|
4219
|
+
container.style.backgroundColor = 'rgba(0, 0, 0, 0.5)';
|
|
4220
|
+
container.style.top = container.style.bottom = container.style.left = container.style.right = '0';
|
|
4221
|
+
container.style.cursor = 'pointer';
|
|
4222
|
+
const editorElem = document.createElement('div');
|
|
4223
|
+
editorElem.style.position = 'absolute';
|
|
4224
|
+
editorElem.style.top = editorElem.style.bottom = editorElem.style.left = editorElem.style.right = '0';
|
|
4225
|
+
editorElem.style.margin = 'auto';
|
|
4226
|
+
editorElem.style.width = '80%';
|
|
4227
|
+
editorElem.style.height = '80%';
|
|
4228
|
+
container.appendChild(editorElem);
|
|
4229
|
+
document.body.appendChild(container);
|
|
4230
|
+
|
|
4231
|
+
try {
|
|
4232
|
+
const editor = createEditor(editorElem, _objectSpread2({
|
|
4233
|
+
model,
|
|
4234
|
+
readOnly: true,
|
|
4235
|
+
automaticLayout: true
|
|
4236
|
+
}, getConfiguration$1(model.getLanguageId(), 'editor')));
|
|
4237
|
+
currentEditor = {
|
|
4238
|
+
dispose: () => {
|
|
4239
|
+
editor.dispose();
|
|
4240
|
+
document.body.removeChild(container);
|
|
4241
|
+
currentEditor = null;
|
|
4242
|
+
},
|
|
4243
|
+
model,
|
|
4244
|
+
editor
|
|
4245
|
+
};
|
|
4246
|
+
container.addEventListener('mousedown', event => {
|
|
4247
|
+
var _currentEditor;
|
|
4248
|
+
|
|
4249
|
+
if (event.target !== container) {
|
|
4250
|
+
return;
|
|
4251
|
+
}
|
|
4252
|
+
|
|
4253
|
+
(_currentEditor = currentEditor) === null || _currentEditor === void 0 ? void 0 : _currentEditor.dispose();
|
|
4254
|
+
});
|
|
4255
|
+
return editor;
|
|
4256
|
+
} catch (error) {
|
|
4257
|
+
document.body.removeChild(container);
|
|
4258
|
+
currentEditor = null;
|
|
4259
|
+
throw error;
|
|
4260
|
+
}
|
|
4261
|
+
}
|
|
4262
|
+
|
|
4263
|
+
class EditorOpenHandlerRegistry {
|
|
4264
|
+
constructor() {
|
|
4265
|
+
_defineProperty(this, "handlers", []);
|
|
4266
|
+
|
|
4267
|
+
_defineProperty(this, "openCodeEditor", async (model, options, sideBySide) => {
|
|
4268
|
+
var _modelEditor$getDomNo;
|
|
4269
|
+
|
|
4270
|
+
let modelEditor;
|
|
4271
|
+
|
|
4272
|
+
for (const handler of this.handlers) {
|
|
4273
|
+
const handlerEditor = await handler(model, options, null, sideBySide);
|
|
4274
|
+
|
|
4275
|
+
if (handlerEditor != null) {
|
|
4276
|
+
modelEditor = handlerEditor;
|
|
4277
|
+
break;
|
|
4278
|
+
}
|
|
4279
|
+
}
|
|
4280
|
+
|
|
4281
|
+
if (modelEditor == null) {
|
|
4282
|
+
modelEditor = openNewCodeEditor(model); // Destroy model ref when we close the editor popup
|
|
4283
|
+
|
|
4284
|
+
const onModelUnmount = () => {
|
|
4285
|
+
model.dispose();
|
|
4286
|
+
};
|
|
4287
|
+
|
|
4288
|
+
const onDidDisposeDisposable = modelEditor.onDidDispose(() => {
|
|
4289
|
+
onModelUnmount();
|
|
4290
|
+
});
|
|
4291
|
+
const onDidChangeModelDisposable = modelEditor.onDidChangeModel(e => {
|
|
4292
|
+
if (e.newModelUrl == null || e.newModelUrl.toString() !== model.uri.toString()) {
|
|
4293
|
+
onModelUnmount();
|
|
4294
|
+
onDidDisposeDisposable.dispose();
|
|
4295
|
+
onDidChangeModelDisposable.dispose();
|
|
4296
|
+
}
|
|
4297
|
+
});
|
|
4298
|
+
}
|
|
4299
|
+
|
|
4300
|
+
modelEditor.focus();
|
|
4301
|
+
|
|
4302
|
+
if (((_modelEditor$getDomNo = modelEditor.getDomNode()) === null || _modelEditor$getDomNo === void 0 ? void 0 : _modelEditor$getDomNo.scrollIntoView) != null) {
|
|
4303
|
+
var _modelEditor$getDomNo2;
|
|
4304
|
+
|
|
4305
|
+
(_modelEditor$getDomNo2 = modelEditor.getDomNode()) === null || _modelEditor$getDomNo2 === void 0 ? void 0 : _modelEditor$getDomNo2.scrollIntoView({
|
|
4306
|
+
block: 'nearest',
|
|
4307
|
+
inline: 'nearest'
|
|
4308
|
+
});
|
|
4309
|
+
}
|
|
4310
|
+
|
|
4311
|
+
return modelEditor;
|
|
4312
|
+
});
|
|
4313
|
+
}
|
|
4314
|
+
|
|
4315
|
+
registerEditorOpenHandler(handler) {
|
|
4316
|
+
this.handlers.push(handler);
|
|
4317
|
+
return {
|
|
4318
|
+
dispose: () => {
|
|
4319
|
+
const index = this.handlers.indexOf(handler);
|
|
4320
|
+
|
|
4321
|
+
if (index >= 0) {
|
|
4322
|
+
this.handlers.splice(index, 1);
|
|
4323
|
+
}
|
|
4324
|
+
}
|
|
4325
|
+
};
|
|
4326
|
+
}
|
|
4327
|
+
|
|
4328
|
+
}
|
|
4329
|
+
|
|
4330
|
+
const editorOpenHandlerRegistry = new EditorOpenHandlerRegistry();
|
|
4331
|
+
monaco$2.extra.StandaloneServices.initialize(_objectSpread2(_objectSpread2({}, getModelEditorServiceOverride((model, input, sideBySide) => {
|
|
4332
|
+
return editorOpenHandlerRegistry.openCodeEditor(model, input, sideBySide);
|
|
4333
|
+
})), getMessageServiceOverride(document.body))); // Disable high contrast autodetection because it fallbacks on the hc-black no matter what
|
|
4532
4334
|
|
|
4533
4335
|
monaco$2.extra.StandaloneServices.get(monaco$2.editor.IStandaloneThemeService).setAutoDetectHighContrast(false); // Force EOL to be '\n' even on Windows
|
|
4534
4336
|
|
|
@@ -4554,8 +4356,7 @@ function registerTextModelContentProvider(scheme, provider) {
|
|
|
4554
4356
|
}
|
|
4555
4357
|
|
|
4556
4358
|
function registerEditorOpenHandler(handler) {
|
|
4557
|
-
|
|
4558
|
-
return codeEditorService.registerEditorOpenHandler(handler);
|
|
4359
|
+
return editorOpenHandlerRegistry.registerEditorOpenHandler(handler);
|
|
4559
4360
|
}
|
|
4560
4361
|
|
|
4561
4362
|
var lib$1 = {};
|
|
@@ -16393,8 +16194,8 @@ function initVimMode(editor, statusBarElement) {
|
|
|
16393
16194
|
return lib.initVimMode(editor, statusBarElement);
|
|
16394
16195
|
}
|
|
16395
16196
|
|
|
16396
|
-
const keybindingService = monaco$2.extra.StandaloneServices.get(monaco$2.extra.IKeybindingService);
|
|
16397
16197
|
function updateKeybindings(bindings) {
|
|
16198
|
+
const keybindingService = monaco$2.extra.StandaloneServices.get(monaco$2.extra.IKeybindingService);
|
|
16398
16199
|
keybindingService.setUserKeybindings(bindings);
|
|
16399
16200
|
}
|
|
16400
16201
|
function updateEditorKeybindingsMode(editor) {
|
package/dist/monaco.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as monaco from 'monaco-editor';
|
|
2
2
|
import './languages';
|
|
3
3
|
import './theme';
|
|
4
|
-
import { EditorOpenHandler } from './services/MultiEditorStandaloneCodeEditorService';
|
|
5
4
|
import './worker';
|
|
6
5
|
import 'monaco-editor/esm/vs/editor/editor.all';
|
|
7
6
|
import 'monaco-editor/esm/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp';
|
|
@@ -12,6 +11,7 @@ import 'monaco-editor/esm/vs/editor/standalone/browser/quickAccess/standaloneGot
|
|
|
12
11
|
import 'monaco-editor/esm/vs/editor/standalone/browser/quickAccess/standaloneGotoSymbolQuickAccess';
|
|
13
12
|
import 'monaco-editor/esm/vs/editor/standalone/browser/quickAccess/standaloneCommandsQuickAccess';
|
|
14
13
|
import 'monaco-editor/esm/vs/editor/standalone/browser/referenceSearch/standaloneReferenceSearch';
|
|
14
|
+
import { EditorOpenHandler } from './tools/EditorOpenHandlerRegistry';
|
|
15
15
|
declare function createEditor(domElement: HTMLElement, options?: monaco.editor.IStandaloneEditorConstructionOptions): monaco.editor.IStandaloneCodeEditor;
|
|
16
16
|
declare function registerTextModelContentProvider(scheme: string, provider: monaco.extra.ITextModelContentProvider): monaco.IDisposable;
|
|
17
17
|
declare function registerEditorOpenHandler(handler: EditorOpenHandler): monaco.IDisposable;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as monaco from 'monaco-editor';
|
|
2
|
+
import { OpenEditor, IEditorOptions } from 'vscode/service-override/modelEditor';
|
|
3
|
+
export declare type EditorOpenHandler = (model: monaco.editor.ITextModel, input: IEditorOptions | undefined, editor: monaco.editor.ICodeEditor | null, sideBySide?: boolean) => Promise<monaco.editor.ICodeEditor | null>;
|
|
4
|
+
export default class EditorOpenHandlerRegistry {
|
|
5
|
+
private handlers;
|
|
6
|
+
registerEditorOpenHandler(handler: EditorOpenHandler): monaco.IDisposable;
|
|
7
|
+
openCodeEditor: OpenEditor;
|
|
8
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-editor-wrapper",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Enhanced Monaco editor with TextMate grammars and more",
|
|
6
6
|
"scripts": {
|
|
@@ -16,6 +16,50 @@
|
|
|
16
16
|
"moduleResolution": "node",
|
|
17
17
|
"main": "dist/main.js",
|
|
18
18
|
"module": "dist/main.js",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"default": "./dist/main.js"
|
|
22
|
+
},
|
|
23
|
+
"./features/jsonContribution": {
|
|
24
|
+
"types": "./dist/features/jsonContribution.d.ts",
|
|
25
|
+
"default": "./dist/features/jsonContribution.js"
|
|
26
|
+
},
|
|
27
|
+
"./features/cssContribution": {
|
|
28
|
+
"types": "./dist/features/cssContribution.d.ts",
|
|
29
|
+
"default": "./dist/features/cssContribution.js"
|
|
30
|
+
},
|
|
31
|
+
"./features/htmlContribution": {
|
|
32
|
+
"types": "./dist/features/htmlContribution.d.ts",
|
|
33
|
+
"default": "./dist/features/htmlContribution.js"
|
|
34
|
+
},
|
|
35
|
+
"./features/typescriptContribution": {
|
|
36
|
+
"types": "./dist/features/typescriptContribution.d.ts",
|
|
37
|
+
"default": "./dist/features/typescriptContribution.js"
|
|
38
|
+
},
|
|
39
|
+
"./features/extensionConfigurations": {
|
|
40
|
+
"types": "./dist/features/extensionConfigurations.d.ts",
|
|
41
|
+
"default": "./dist/features/extensionConfigurations.js"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"typesVersions": {
|
|
45
|
+
"*": {
|
|
46
|
+
"./features/jsonContribution": [
|
|
47
|
+
"./dist/features/jsonContribution.d.ts"
|
|
48
|
+
],
|
|
49
|
+
"./features/cssContribution": [
|
|
50
|
+
"./dist/features/cssContribution.d.ts"
|
|
51
|
+
],
|
|
52
|
+
"./features/htmlContribution": [
|
|
53
|
+
"./dist/features/htmlContribution.d.ts"
|
|
54
|
+
],
|
|
55
|
+
"./features/typescriptContribution": [
|
|
56
|
+
"./dist/features/typescriptContribution.d.ts"
|
|
57
|
+
],
|
|
58
|
+
"./features/extensionConfigurations": [
|
|
59
|
+
"./dist/features/extensionConfigurations.d.ts"
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
},
|
|
19
63
|
"files": [
|
|
20
64
|
"dist/",
|
|
21
65
|
"stats.html"
|
|
@@ -23,6 +67,7 @@
|
|
|
23
67
|
"types": "dist/index.d.ts",
|
|
24
68
|
"dependencies": {
|
|
25
69
|
"monaco-editor": "npm:@codingame/monaco-editor@^0.33.6",
|
|
70
|
+
"vscode": "npm:@codingame/monaco-vscode-api@~1.67.9",
|
|
26
71
|
"vscode-oniguruma": "^1.6.2"
|
|
27
72
|
},
|
|
28
73
|
"devDependencies": {
|