@codingame/monaco-editor-wrapper 2.1.1 → 2.2.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/LICENSE.txt +21 -0
- package/README.md +6 -5
- package/dist/configuration/files.d.ts +6 -0
- package/dist/configuration/index.d.ts +6 -2
- package/dist/features/extensionConfigurations.d.ts +0 -6
- package/dist/features/extensionConfigurations.js +1 -62
- package/dist/features/htmlContribution.js +21 -11
- package/dist/index.js +82 -8
- package/dist/main.js +33 -27
- package/package.json +3 -2
- package/stats.html +1 -1
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 - CodinGame
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -56,10 +56,10 @@ Instead of using `monaco.editor.create`, you should use the `createEditor` expos
|
|
|
56
56
|
By default, monaco-editor contains worker to achieve IntelliSense in CSS, SCSS, JavaScript, TypeScript, JSON and HTML.
|
|
57
57
|
|
|
58
58
|
To enable them, import the following files:
|
|
59
|
-
- JSON: `import '@codingame/monaco-editor-wrapper/
|
|
60
|
-
- JavaScript/TypeScript: `import '@codingame/monaco-editor-wrapper/
|
|
61
|
-
- CSS/SCSS: `import '@codingame/monaco-editor-wrapper/
|
|
62
|
-
- HTML: `import '@codingame/monaco-editor-wrapper/
|
|
59
|
+
- JSON: `import '@codingame/monaco-editor-wrapper/features/jsonContribution'`
|
|
60
|
+
- JavaScript/TypeScript: `import '@codingame/monaco-editor-wrapper/features/typescriptContribution'`
|
|
61
|
+
- CSS/SCSS: `import '@codingame/monaco-editor-wrapper/features/cssContribution'`
|
|
62
|
+
- HTML: `import '@codingame/monaco-editor-wrapper/features/htmlContribution'`
|
|
63
63
|
|
|
64
64
|
#### Additional apis
|
|
65
65
|
|
|
@@ -79,4 +79,5 @@ This library exposed some functions to manage the user global configuration:
|
|
|
79
79
|
- `updateUserConfiguration` Update the user configuration, overrides the default configuration, uses the same syntax as VS Code configuration
|
|
80
80
|
- `getConfiguration` allows to get a given configuration key in a given language
|
|
81
81
|
- `onConfigurationChanged` listen to configuration change
|
|
82
|
-
- `
|
|
82
|
+
- `updateKeybindings` allows to update the editor keybindings with the same syntax as in VS Code
|
|
83
|
+
- `updateEditorKeybindingsMode` switch between `vim`, `emacs` or `classic` keybindings
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* comes from https://github.com/microsoft/vscode/blob/16d0a319b28caa4b6cf4e6801fd508282b7533e0/src/vs/workbench/contrib/files/browser/files.contribution.ts#L132
|
|
3
|
+
* files.exclude and files.associations are required by the Lua language server
|
|
4
|
+
*/
|
|
5
|
+
export declare const FILES_EXCLUDE_CONFIG = "files.exclude";
|
|
6
|
+
export declare const FILES_ASSOCIATIONS_CONFIG = "files.associations";
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import * as monaco from 'monaco-editor';
|
|
2
|
-
|
|
2
|
+
import { IConfigurationChangeEvent } from 'vscode/services';
|
|
3
|
+
import * as vscode from 'vscode';
|
|
4
|
+
import { updateUserConfiguration } from 'vscode/service-override/configuration';
|
|
5
|
+
import './files';
|
|
6
|
+
export declare function onConfigurationChanged(listener: (e: IConfigurationChangeEvent) => void): vscode.Disposable;
|
|
3
7
|
export declare function getConfiguration<C = Partial<monaco.editor.IEditorOptions>>(language?: string, section?: string): C | undefined;
|
|
4
|
-
export
|
|
8
|
+
export { updateUserConfiguration };
|
|
5
9
|
export declare function registerConfigurations(configurations: monaco.extra.IConfigurationNode[], validate?: boolean): void;
|
|
6
10
|
export declare function registerDefaultConfigurations(defaultConfigurations: monaco.extra.IStringDictionary<unknown>[]): void;
|
|
@@ -1,7 +1 @@
|
|
|
1
1
|
export declare function loadConfigurationForExtension(extensionId: string): Promise<void>;
|
|
2
|
-
/**
|
|
3
|
-
* comes from https://github.com/microsoft/vscode/blob/16d0a319b28caa4b6cf4e6801fd508282b7533e0/src/vs/workbench/contrib/files/browser/files.contribution.ts#L132
|
|
4
|
-
* Required by the Lua language server
|
|
5
|
-
*/
|
|
6
|
-
export declare const FILES_EXCLUDE_CONFIG = "files.exclude";
|
|
7
|
-
export declare const FILES_ASSOCIATIONS_CONFIG = "files.associations";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { _ as _objectSpread2 } from '../_rollupPluginBabelHelpers.js';
|
|
2
1
|
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
|
3
2
|
|
|
4
3
|
// Generated file, do not modify
|
|
@@ -138,65 +137,5 @@ async function loadConfigurationForExtension(extensionId) {
|
|
|
138
137
|
const configuration = await loader$1();
|
|
139
138
|
configurationRegistry.registerConfigurations(configuration);
|
|
140
139
|
}
|
|
141
|
-
/**
|
|
142
|
-
* comes from https://github.com/microsoft/vscode/blob/16d0a319b28caa4b6cf4e6801fd508282b7533e0/src/vs/workbench/contrib/files/browser/files.contribution.ts#L132
|
|
143
|
-
* Required by the Lua language server
|
|
144
|
-
*/
|
|
145
|
-
|
|
146
|
-
const FILES_EXCLUDE_CONFIG = 'files.exclude';
|
|
147
|
-
const FILES_ASSOCIATIONS_CONFIG = 'files.associations';
|
|
148
|
-
const ConfigurationScope = monaco.extra.ConfigurationScope;
|
|
149
|
-
const nls = {
|
|
150
|
-
localize: (key, defaultValue) => defaultValue
|
|
151
|
-
};
|
|
152
|
-
configurationRegistry.registerConfiguration({
|
|
153
|
-
id: 'files',
|
|
154
|
-
order: 9,
|
|
155
|
-
title: 'Files',
|
|
156
|
-
type: 'object',
|
|
157
|
-
properties: {
|
|
158
|
-
[FILES_EXCLUDE_CONFIG]: {
|
|
159
|
-
type: 'object',
|
|
160
|
-
markdownDescription: nls.localize('exclude', 'Configure glob patterns for excluding files and folders. For example, the file Explorer decides which files and folders to show or hide based on this setting. Refer to the `#search.exclude#` setting to define search specific excludes. Read more about glob patterns [here](https://code.visualstudio.com/docs/editor/codebasics#_advanced-search-options).'),
|
|
161
|
-
default: _objectSpread2(_objectSpread2({}, {
|
|
162
|
-
'**/.git': true,
|
|
163
|
-
'**/.svn': true,
|
|
164
|
-
'**/.hg': true,
|
|
165
|
-
'**/CVS': true,
|
|
166
|
-
'**/.DS_Store': true,
|
|
167
|
-
'**/Thumbs.db': true
|
|
168
|
-
}), {
|
|
169
|
-
'**/*.crswap': true
|
|
170
|
-
/* filter out swap files used for local file access */
|
|
171
|
-
|
|
172
|
-
} ),
|
|
173
|
-
scope: ConfigurationScope.RESOURCE,
|
|
174
|
-
additionalProperties: {
|
|
175
|
-
anyOf: [{
|
|
176
|
-
type: 'boolean',
|
|
177
|
-
description: nls.localize('files.exclude.boolean', 'The glob pattern to match file paths against. Set to true or false to enable or disable the pattern.')
|
|
178
|
-
}, {
|
|
179
|
-
type: 'object',
|
|
180
|
-
properties: {
|
|
181
|
-
when: {
|
|
182
|
-
type: 'string',
|
|
183
|
-
// expression ({ "**/*.js": { "when": "$(basename).js" } })
|
|
184
|
-
pattern: '\\w*\\$\\(basename\\)\\w*',
|
|
185
|
-
default: '$(basename).ext',
|
|
186
|
-
description: nls.localize('files.exclude.when', 'Additional check on the siblings of a matching file. Use $(basename) as variable for the matching file name.')
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}]
|
|
190
|
-
}
|
|
191
|
-
},
|
|
192
|
-
[FILES_ASSOCIATIONS_CONFIG]: {
|
|
193
|
-
type: 'object',
|
|
194
|
-
markdownDescription: nls.localize('associations', 'Configure file associations to languages (e.g. `"*.extension": "html"`). These have precedence over the default associations of the languages installed.'),
|
|
195
|
-
additionalProperties: {
|
|
196
|
-
type: 'string'
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
});
|
|
201
140
|
|
|
202
|
-
export {
|
|
141
|
+
export { loadConfigurationForExtension };
|
|
@@ -2,6 +2,9 @@ import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
|
|
2
2
|
import 'monaco-editor/esm/vs/language/html/monaco.contribution';
|
|
3
3
|
import { r as registerConfigurations, g as getConfiguration, o as onConfigurationChanged } from '../index.js';
|
|
4
4
|
import { r as registerWorkerLoader } from '../worker.js';
|
|
5
|
+
import 'vscode/services';
|
|
6
|
+
import 'vscode/service-override/configuration';
|
|
7
|
+
import '../_rollupPluginBabelHelpers.js';
|
|
5
8
|
|
|
6
9
|
const workerLoader = async () => (await import(
|
|
7
10
|
/* webpackChunkName: "MonacoHtmlWorker" */
|
|
@@ -30,11 +33,15 @@ registerConfigurations([{
|
|
|
30
33
|
}
|
|
31
34
|
}
|
|
32
35
|
}]);
|
|
33
|
-
let autoClosingTags =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
let autoClosingTags = false;
|
|
37
|
+
setTimeout(() => {
|
|
38
|
+
// In a timeout so the service can be overriden
|
|
39
|
+
autoClosingTags = getConfiguration(undefined, 'html.autoClosingTags');
|
|
40
|
+
onConfigurationChanged(e => {
|
|
41
|
+
if (e.affectsConfiguration('html.autoClosingTags')) {
|
|
42
|
+
autoClosingTags = getConfiguration(undefined, 'html.autoClosingTags');
|
|
43
|
+
}
|
|
44
|
+
});
|
|
38
45
|
});
|
|
39
46
|
|
|
40
47
|
function autoCloseHtmlTags(editor) {
|
|
@@ -101,14 +108,17 @@ function autoCloseHtmlTags(editor) {
|
|
|
101
108
|
return disposableStore;
|
|
102
109
|
}
|
|
103
110
|
|
|
104
|
-
|
|
111
|
+
setTimeout(() => {
|
|
112
|
+
// In a timeout so the service can be overriden
|
|
113
|
+
const codeEditors = monaco.extra.StandaloneServices.get(monaco.extra.ICodeEditorService).listCodeEditors();
|
|
105
114
|
|
|
106
|
-
for (const editor of codeEditors) {
|
|
107
|
-
|
|
108
|
-
}
|
|
115
|
+
for (const editor of codeEditors) {
|
|
116
|
+
autoCloseHtmlTags(editor);
|
|
117
|
+
}
|
|
109
118
|
|
|
110
|
-
monaco.editor.onDidCreateEditor(editor => {
|
|
111
|
-
|
|
119
|
+
monaco.editor.onDidCreateEditor(editor => {
|
|
120
|
+
autoCloseHtmlTags(editor);
|
|
121
|
+
});
|
|
112
122
|
});
|
|
113
123
|
/**
|
|
114
124
|
* End autoclosing html tags
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
|
2
|
+
import { IConfigurationService } from 'vscode/services';
|
|
3
|
+
import 'vscode/service-override/configuration';
|
|
4
|
+
import { _ as _objectSpread2 } from './_rollupPluginBabelHelpers.js';
|
|
2
5
|
|
|
3
6
|
var configurationDefaults = {
|
|
4
7
|
"[go]": {
|
|
@@ -1216,29 +1219,100 @@ var extensions = {
|
|
|
1216
1219
|
semanticTokenModifiers: semanticTokenModifiers
|
|
1217
1220
|
};
|
|
1218
1221
|
|
|
1222
|
+
const configurationRegistry$1 = monaco.extra.Registry.as(monaco.extra.ConfigurationExtensions.Configuration);
|
|
1223
|
+
/**
|
|
1224
|
+
* comes from https://github.com/microsoft/vscode/blob/16d0a319b28caa4b6cf4e6801fd508282b7533e0/src/vs/workbench/contrib/files/browser/files.contribution.ts#L132
|
|
1225
|
+
* files.exclude and files.associations are required by the Lua language server
|
|
1226
|
+
*/
|
|
1227
|
+
|
|
1228
|
+
const FILES_EXCLUDE_CONFIG = 'files.exclude';
|
|
1229
|
+
const FILES_ASSOCIATIONS_CONFIG = 'files.associations';
|
|
1230
|
+
const ConfigurationScope = monaco.extra.ConfigurationScope;
|
|
1231
|
+
const nls = {
|
|
1232
|
+
localize: (key, defaultValue) => defaultValue
|
|
1233
|
+
};
|
|
1234
|
+
configurationRegistry$1.registerConfiguration({
|
|
1235
|
+
id: 'files',
|
|
1236
|
+
order: 9,
|
|
1237
|
+
title: 'Files',
|
|
1238
|
+
type: 'object',
|
|
1239
|
+
properties: {
|
|
1240
|
+
'files.eol': {
|
|
1241
|
+
type: 'string',
|
|
1242
|
+
enum: ['\n', '\r\n', 'auto'],
|
|
1243
|
+
enumDescriptions: [nls.localize('eol.LF', 'LF'), nls.localize('eol.CRLF', 'CRLF'), nls.localize('eol.auto', 'Uses operating system specific end of line character.')],
|
|
1244
|
+
default: 'auto',
|
|
1245
|
+
description: nls.localize('eol', 'The default end of line character.'),
|
|
1246
|
+
scope: ConfigurationScope.LANGUAGE_OVERRIDABLE
|
|
1247
|
+
},
|
|
1248
|
+
[FILES_EXCLUDE_CONFIG]: {
|
|
1249
|
+
type: 'object',
|
|
1250
|
+
markdownDescription: nls.localize('exclude', 'Configure glob patterns for excluding files and folders. For example, the file Explorer decides which files and folders to show or hide based on this setting. Refer to the `#search.exclude#` setting to define search specific excludes. Read more about glob patterns [here](https://code.visualstudio.com/docs/editor/codebasics#_advanced-search-options).'),
|
|
1251
|
+
default: _objectSpread2(_objectSpread2({}, {
|
|
1252
|
+
'**/.git': true,
|
|
1253
|
+
'**/.svn': true,
|
|
1254
|
+
'**/.hg': true,
|
|
1255
|
+
'**/CVS': true,
|
|
1256
|
+
'**/.DS_Store': true,
|
|
1257
|
+
'**/Thumbs.db': true
|
|
1258
|
+
}), {
|
|
1259
|
+
'**/*.crswap': true
|
|
1260
|
+
/* filter out swap files used for local file access */
|
|
1261
|
+
|
|
1262
|
+
} ),
|
|
1263
|
+
scope: ConfigurationScope.RESOURCE,
|
|
1264
|
+
additionalProperties: {
|
|
1265
|
+
anyOf: [{
|
|
1266
|
+
type: 'boolean',
|
|
1267
|
+
description: nls.localize('files.exclude.boolean', 'The glob pattern to match file paths against. Set to true or false to enable or disable the pattern.')
|
|
1268
|
+
}, {
|
|
1269
|
+
type: 'object',
|
|
1270
|
+
properties: {
|
|
1271
|
+
when: {
|
|
1272
|
+
type: 'string',
|
|
1273
|
+
// expression ({ "**/*.js": { "when": "$(basename).js" } })
|
|
1274
|
+
pattern: '\\w*\\$\\(basename\\)\\w*',
|
|
1275
|
+
default: '$(basename).ext',
|
|
1276
|
+
description: nls.localize('files.exclude.when', 'Additional check on the siblings of a matching file. Use $(basename) as variable for the matching file name.')
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
}]
|
|
1280
|
+
}
|
|
1281
|
+
},
|
|
1282
|
+
[FILES_ASSOCIATIONS_CONFIG]: {
|
|
1283
|
+
type: 'object',
|
|
1284
|
+
markdownDescription: nls.localize('associations', 'Configure file associations to languages (e.g. `"*.extension": "html"`). These have precedence over the default associations of the languages installed.'),
|
|
1285
|
+
additionalProperties: {
|
|
1286
|
+
type: 'string'
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
});
|
|
1291
|
+
|
|
1219
1292
|
const configurationRegistry = monaco.extra.Registry.as(monaco.extra.ConfigurationExtensions.Configuration);
|
|
1220
1293
|
configurationRegistry.registerDefaultConfigurations([{
|
|
1221
1294
|
overrides: {
|
|
1222
1295
|
'editor.codeLens': false,
|
|
1223
1296
|
'editor.fontSize': 12,
|
|
1224
1297
|
'editor.maxTokenizationLineLength': 1000,
|
|
1225
|
-
'editor.quickSuggestions': false
|
|
1298
|
+
'editor.quickSuggestions': false,
|
|
1299
|
+
'files.eol': '\n'
|
|
1226
1300
|
}
|
|
1227
1301
|
}]);
|
|
1228
1302
|
configurationRegistry.registerDefaultConfigurations([{
|
|
1229
1303
|
overrides: extensions.configurationDefaults
|
|
1230
1304
|
}]);
|
|
1231
|
-
|
|
1232
|
-
const
|
|
1305
|
+
function onConfigurationChanged(listener) {
|
|
1306
|
+
const configurationService = monaco.extra.StandaloneServices.get(IConfigurationService);
|
|
1307
|
+
return configurationService.onDidChangeConfiguration(listener);
|
|
1308
|
+
}
|
|
1233
1309
|
function getConfiguration(language) {
|
|
1234
1310
|
let section = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'editor';
|
|
1235
|
-
|
|
1311
|
+
const configurationService = monaco.extra.StandaloneServices.get(IConfigurationService);
|
|
1312
|
+
return configurationService.getValue(section, {
|
|
1236
1313
|
overrideIdentifier: language
|
|
1237
1314
|
});
|
|
1238
1315
|
}
|
|
1239
|
-
function updateUserConfiguration(configurationJson) {
|
|
1240
|
-
simpleConfigurationService.updateUserConfiguration(configurationJson);
|
|
1241
|
-
}
|
|
1242
1316
|
function registerConfigurations(configurations, validate) {
|
|
1243
1317
|
configurationRegistry.registerConfigurations(configurations, validate);
|
|
1244
1318
|
}
|
|
@@ -1248,4 +1322,4 @@ function registerDefaultConfigurations(defaultConfigurations) {
|
|
|
1248
1322
|
})));
|
|
1249
1323
|
}
|
|
1250
1324
|
|
|
1251
|
-
export { registerDefaultConfigurations as a, extensions as e, getConfiguration as g, onConfigurationChanged as o, registerConfigurations as r
|
|
1325
|
+
export { registerDefaultConfigurations as a, extensions as e, getConfiguration as g, onConfigurationChanged as o, registerConfigurations as r };
|
package/dist/main.js
CHANGED
|
@@ -4,10 +4,13 @@ import { _ as _objectSpread2, a as _defineProperty } from './_rollupPluginBabelH
|
|
|
4
4
|
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
|
-
export { g as getConfiguration, o as onConfigurationChanged, r as registerConfigurations, a as registerDefaultConfigurations
|
|
7
|
+
export { g as getConfiguration, o as onConfigurationChanged, r as registerConfigurations, a as registerDefaultConfigurations } from './index.js';
|
|
8
8
|
import getModelEditorServiceOverride from 'vscode/service-override/modelEditor';
|
|
9
9
|
import getMessageServiceOverride from 'vscode/service-override/messages';
|
|
10
|
+
import getConfigurationServiceOverride from 'vscode/service-override/configuration';
|
|
11
|
+
export { updateUserConfiguration } from 'vscode/service-override/configuration';
|
|
10
12
|
import './worker.js';
|
|
13
|
+
import { createConfiguredEditor } from 'vscode/monaco';
|
|
11
14
|
import 'monaco-editor/esm/vs/editor/editor.all';
|
|
12
15
|
import 'monaco-editor/esm/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp';
|
|
13
16
|
import 'monaco-editor/esm/vs/editor/standalone/browser/iPadShowKeyboard/iPadShowKeyboard';
|
|
@@ -18,6 +21,7 @@ import 'monaco-editor/esm/vs/editor/standalone/browser/quickAccess/standaloneGot
|
|
|
18
21
|
import 'monaco-editor/esm/vs/editor/standalone/browser/quickAccess/standaloneCommandsQuickAccess';
|
|
19
22
|
import 'monaco-editor/esm/vs/editor/standalone/browser/referenceSearch/standaloneReferenceSearch';
|
|
20
23
|
import * as shiftCommand from 'monaco-editor/esm/vs/editor/common/commands/shiftCommand';
|
|
24
|
+
import 'vscode/services';
|
|
21
25
|
|
|
22
26
|
function _mergeNamespaces(n, m) {
|
|
23
27
|
m.forEach(function (e) {
|
|
@@ -1852,11 +1856,10 @@ function getOrCreateGrammarFactory() {
|
|
|
1852
1856
|
return textMateGrammarFactory;
|
|
1853
1857
|
}
|
|
1854
1858
|
|
|
1855
|
-
const languageService$2 = monaco$2.extra.StandaloneServices.get(monaco$2.languages.ILanguageService);
|
|
1856
|
-
|
|
1857
1859
|
async function createTextMateTokensProvider(languageId) {
|
|
1860
|
+
const languageService = monaco$2.extra.StandaloneServices.get(monaco$2.languages.ILanguageService);
|
|
1858
1861
|
const grammarFactory = getOrCreateGrammarFactory();
|
|
1859
|
-
const encodedLanguageId = languageService
|
|
1862
|
+
const encodedLanguageId = languageService.languageIdCodec.encodeLanguageId(languageId);
|
|
1860
1863
|
|
|
1861
1864
|
if (!grammarFactory.has(languageId)) {
|
|
1862
1865
|
return null;
|
|
@@ -1875,7 +1878,7 @@ async function createTextMateTokensProvider(languageId) {
|
|
|
1875
1878
|
const tokenization = new monaco$2.extra.TMTokenization(grammar, initialState, containsEmbeddedLanguages);
|
|
1876
1879
|
tokenization.onDidEncounterLanguage(encodedLanguageId => {
|
|
1877
1880
|
// Force monaco to load this language and trigger the global `onDidEncounterLanguage`
|
|
1878
|
-
languageService
|
|
1881
|
+
languageService.createById(languageService.languageIdCodec.decodeLanguageId(encodedLanguageId));
|
|
1879
1882
|
});
|
|
1880
1883
|
return new CGTMTokenizationSupport(languageId, encodedLanguageId, tokenization, grammar);
|
|
1881
1884
|
}
|
|
@@ -4108,9 +4111,12 @@ class SimpleSnippetService {
|
|
|
4108
4111
|
|
|
4109
4112
|
}
|
|
4110
4113
|
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
monaco$2.extra.
|
|
4114
|
+
setTimeout(() => {
|
|
4115
|
+
// In a timeout so the service can be overriden
|
|
4116
|
+
const languageService = monaco$2.extra.StandaloneServices.get(monaco$2.languages.ILanguageService);
|
|
4117
|
+
const languageConfigurationService = monaco$2.extra.StandaloneServices.get(monaco$2.languages.ILanguageConfigurationService);
|
|
4118
|
+
monaco$2.extra.setSnippetSuggestSupport(new monaco$2.extra.SnippetCompletionProvider(languageService, new SimpleSnippetService(), languageConfigurationService));
|
|
4119
|
+
});
|
|
4114
4120
|
|
|
4115
4121
|
/* Add custom blocks parsing (for tech.io):
|
|
4116
4122
|
// { [autofold]
|
|
@@ -4153,7 +4159,6 @@ for (const [languageId, aliases] of Object.entries(customAliases)) {
|
|
|
4153
4159
|
});
|
|
4154
4160
|
}
|
|
4155
4161
|
|
|
4156
|
-
const languageService = monaco$2.extra.StandaloneServices.get(monaco$2.languages.ILanguageService);
|
|
4157
4162
|
const languagesIds = Array.from(new Set([...Object.keys(languageLoader), ...textMateLanguages.map(rawLanguage => rawLanguage.id)]));
|
|
4158
4163
|
|
|
4159
4164
|
for (const textMateLanguage of textMateLanguages) {
|
|
@@ -4218,19 +4223,24 @@ async function loadLanguageConfiguration(languageId) {
|
|
|
4218
4223
|
}
|
|
4219
4224
|
}
|
|
4220
4225
|
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4226
|
+
setTimeout(() => {
|
|
4227
|
+
// In a timeout so the service can be overriden
|
|
4228
|
+
const languageService = monaco$2.extra.StandaloneServices.get(monaco$2.languages.ILanguageService);
|
|
4229
|
+
languageService.onDidEncounterLanguage(async languageId => {
|
|
4230
|
+
if (languageId === 'plaintext') {
|
|
4231
|
+
return;
|
|
4232
|
+
}
|
|
4225
4233
|
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4234
|
+
loadLanguageConfiguration(languageId).catch(error => {
|
|
4235
|
+
monaco$2.errorHandler.onUnexpectedError(new Error("Unable to load language configuration for language ".concat(languageId), {
|
|
4236
|
+
cause: error
|
|
4237
|
+
}));
|
|
4238
|
+
});
|
|
4230
4239
|
});
|
|
4231
4240
|
});
|
|
4232
4241
|
|
|
4233
4242
|
function getMonacoLanguage(languageOrModeId) {
|
|
4243
|
+
const languageService = monaco$2.extra.StandaloneServices.get(monaco$2.languages.ILanguageService);
|
|
4234
4244
|
const modeId = languageService.getLanguageIdByLanguageName(languageOrModeId.toLowerCase());
|
|
4235
4245
|
|
|
4236
4246
|
if (modeId != null) {
|
|
@@ -4626,24 +4636,20 @@ class EditorOpenHandlerRegistry {
|
|
|
4626
4636
|
}
|
|
4627
4637
|
|
|
4628
4638
|
const editorOpenHandlerRegistry = new EditorOpenHandlerRegistry();
|
|
4629
|
-
monaco$2.extra.StandaloneServices.initialize(_objectSpread2(_objectSpread2({}, getModelEditorServiceOverride((model, input, sideBySide) => {
|
|
4639
|
+
monaco$2.extra.StandaloneServices.initialize(_objectSpread2(_objectSpread2(_objectSpread2({}, getModelEditorServiceOverride((model, input, sideBySide) => {
|
|
4630
4640
|
return editorOpenHandlerRegistry.openCodeEditor(model, input, sideBySide);
|
|
4631
|
-
})), getMessageServiceOverride(document.body))); // Disable high contrast autodetection because it fallbacks on the hc-black no matter what
|
|
4632
|
-
|
|
4633
|
-
monaco$2.extra.StandaloneServices.get(monaco$2.editor.IStandaloneThemeService).setAutoDetectHighContrast(false); // Force EOL to be '\n' even on Windows
|
|
4641
|
+
})), getMessageServiceOverride(document.body)), getConfigurationServiceOverride())); // Disable high contrast autodetection because it fallbacks on the hc-black no matter what
|
|
4634
4642
|
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
monaco$2.
|
|
4638
|
-
cause: error
|
|
4639
|
-
}));
|
|
4643
|
+
setTimeout(() => {
|
|
4644
|
+
// In a timeout so the service can be overriden
|
|
4645
|
+
monaco$2.extra.StandaloneServices.get(monaco$2.editor.IStandaloneThemeService).setAutoDetectHighContrast(false);
|
|
4640
4646
|
});
|
|
4641
4647
|
monaco$2.errorHandler.setUnexpectedErrorHandler(error => {
|
|
4642
4648
|
console.warn('Unexpected error', error);
|
|
4643
4649
|
});
|
|
4644
4650
|
|
|
4645
4651
|
function createEditor(domElement, options) {
|
|
4646
|
-
const editor =
|
|
4652
|
+
const editor = createConfiguredEditor(domElement, options);
|
|
4647
4653
|
setup(editor);
|
|
4648
4654
|
return editor;
|
|
4649
4655
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-editor-wrapper",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Enhanced Monaco editor with TextMate grammars and more",
|
|
6
6
|
"scripts": {
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
],
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"monaco-editor": "npm:@codingame/monaco-editor@^0.33.6",
|
|
69
|
-
"vscode": "npm:@codingame/monaco-vscode-api@~1.67.
|
|
69
|
+
"vscode": "npm:@codingame/monaco-vscode-api@~1.67.19",
|
|
70
70
|
"vscode-oniguruma": "^1.6.2"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
@@ -88,6 +88,7 @@
|
|
|
88
88
|
"@types/js-yaml": "^4.0.5",
|
|
89
89
|
"@types/node": "16.11.7",
|
|
90
90
|
"@types/rollup-plugin-node-builtins": "^2.1.2",
|
|
91
|
+
"@types/vscode": "~1.67.0",
|
|
91
92
|
"@typescript-eslint/eslint-plugin": "5.27.1",
|
|
92
93
|
"@typescript-eslint/parser": "5.27.1",
|
|
93
94
|
"conventional-changelog-conventionalcommits": "^4.6.3",
|