@bhsd/codemirror-mediawiki 3.12.2 → 3.12.3
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/codemirror.d.ts +2 -1
- package/dist/constants.d.ts +2 -1
- package/dist/constants.js +1 -1
- package/dist/css.js +2 -2
- package/dist/escape.js +6 -7
- package/dist/fold.d.ts +1 -4
- package/dist/javascript.d.ts +1 -1
- package/dist/json.js +17 -24
- package/dist/keymap.d.ts +7 -0
- package/dist/keymap.js +82 -15
- package/dist/lilypond.d.ts +14 -0
- package/dist/lilypond.js +240 -0
- package/dist/lintsource.d.ts +1 -1
- package/dist/lua.d.ts +1 -1
- package/dist/lua.js +32 -56
- package/dist/main.min.js +32 -32
- package/dist/matchBrackets.js +6 -8
- package/dist/math.d.ts +3 -0
- package/dist/math.js +58 -0
- package/dist/mediawiki.d.ts +1 -1
- package/dist/mediawiki.js +30 -17
- package/dist/mw.min.js +36 -36
- package/dist/static.d.ts +4 -0
- package/dist/static.js +4 -0
- package/dist/token.d.ts +5 -4
- package/dist/token.js +40 -19
- package/dist/util.d.ts +32 -8
- package/dist/util.js +36 -9
- package/dist/wiki.min.js +36 -36
- package/i18n/en.json +1 -1
- package/i18n/zh-hans.json +1 -1
- package/i18n/zh-hant.json +1 -1
- package/package.json +5 -4
package/dist/lua.js
CHANGED
|
@@ -4,7 +4,7 @@ import { ViewPlugin, Decoration } from '@codemirror/view';
|
|
|
4
4
|
import { syntaxTree, LanguageSupport, StreamLanguage, foldService, HighlightStyle, syntaxHighlighting, } from '@codemirror/language';
|
|
5
5
|
import { snippetCompletion } from '@codemirror/autocomplete';
|
|
6
6
|
import { tags } from '@lezer/highlight';
|
|
7
|
-
import { leadingSpaces, sliceDoc, markDocTagType } from './util.js';
|
|
7
|
+
import { leadingSpaces, sliceDoc, markDocTagType, getCompletions } from './util.js';
|
|
8
8
|
import { lightHighlightStyle } from './theme.js';
|
|
9
9
|
const map = {
|
|
10
10
|
1: 'constant',
|
|
@@ -218,12 +218,9 @@ const map = {
|
|
|
218
218
|
},
|
|
219
219
|
ext: 4,
|
|
220
220
|
},
|
|
221
|
-
}, luaBuiltin = ['false', 'nil', 'true'], luaBuiltins = luaBuiltin
|
|
222
|
-
'_G',
|
|
223
|
-
...Object.keys(globals),
|
|
224
|
-
].map(label => ({ label, type: 'namespace' })), constants = [
|
|
221
|
+
}, luaBuiltin = ['false', 'nil', 'true'], luaBuiltins = getCompletions(luaBuiltin, 'constant'), tables = getCompletions(['_G', ...Object.keys(globals)], 'namespace'), constants = [
|
|
225
222
|
{ label: '_VERSION', type: 'constant' },
|
|
226
|
-
...[
|
|
223
|
+
...getCompletions([
|
|
227
224
|
'assert',
|
|
228
225
|
'error',
|
|
229
226
|
'getfenv',
|
|
@@ -243,22 +240,15 @@ const map = {
|
|
|
243
240
|
'unpack',
|
|
244
241
|
'xpcall',
|
|
245
242
|
'require',
|
|
246
|
-
]
|
|
247
|
-
], binary = [
|
|
248
|
-
'
|
|
249
|
-
'or',
|
|
250
|
-
'in',
|
|
251
|
-
].map(label => ({ label, type: 'keyword' })), unary = [
|
|
252
|
-
...[
|
|
253
|
-
'not',
|
|
254
|
-
'function',
|
|
255
|
-
].map(label => ({ label, type: 'keyword' })),
|
|
243
|
+
], 'function'),
|
|
244
|
+
], binary = getCompletions(['and', 'or', 'in']), unary = [
|
|
245
|
+
...getCompletions(['not', 'function']),
|
|
256
246
|
snippetCompletion('function ${name}(${})\n\t${}\nend', {
|
|
257
247
|
label: 'function',
|
|
258
248
|
detail: 'definition',
|
|
259
249
|
type: 'keyword',
|
|
260
250
|
}),
|
|
261
|
-
], blocks = [
|
|
251
|
+
], blocks = getCompletions([
|
|
262
252
|
'break',
|
|
263
253
|
'elseif',
|
|
264
254
|
'return',
|
|
@@ -268,14 +258,14 @@ const map = {
|
|
|
268
258
|
'do',
|
|
269
259
|
'until',
|
|
270
260
|
'goto',
|
|
271
|
-
]
|
|
272
|
-
...[
|
|
261
|
+
]), luaKeywords = [
|
|
262
|
+
...getCompletions([
|
|
273
263
|
'if',
|
|
274
264
|
'while',
|
|
275
265
|
'repeat',
|
|
276
266
|
'for',
|
|
277
267
|
'local',
|
|
278
|
-
]
|
|
268
|
+
]),
|
|
279
269
|
snippetCompletion('if ${condition} then\n\t${}\nend', {
|
|
280
270
|
label: 'if',
|
|
281
271
|
detail: 'block',
|
|
@@ -358,41 +348,6 @@ const source = context => {
|
|
|
358
348
|
};
|
|
359
349
|
}
|
|
360
350
|
break;
|
|
361
|
-
case '..':
|
|
362
|
-
case '+':
|
|
363
|
-
case '-':
|
|
364
|
-
case '*':
|
|
365
|
-
case '/':
|
|
366
|
-
case '%':
|
|
367
|
-
case '^':
|
|
368
|
-
case '&':
|
|
369
|
-
case '|':
|
|
370
|
-
case '~':
|
|
371
|
-
case '<':
|
|
372
|
-
case '>':
|
|
373
|
-
case '[':
|
|
374
|
-
return {
|
|
375
|
-
from,
|
|
376
|
-
options: [...constants, ...tables],
|
|
377
|
-
validFor,
|
|
378
|
-
};
|
|
379
|
-
case '=':
|
|
380
|
-
case '{':
|
|
381
|
-
case '(':
|
|
382
|
-
case ',':
|
|
383
|
-
return {
|
|
384
|
-
from,
|
|
385
|
-
options: [...luaBuiltins, ...constants, ...tables, ...unary],
|
|
386
|
-
validFor,
|
|
387
|
-
};
|
|
388
|
-
case '}':
|
|
389
|
-
case ']':
|
|
390
|
-
case ')':
|
|
391
|
-
return {
|
|
392
|
-
from,
|
|
393
|
-
options: [...binary, ...blocks],
|
|
394
|
-
validFor,
|
|
395
|
-
};
|
|
396
351
|
case ';':
|
|
397
352
|
case '':
|
|
398
353
|
return {
|
|
@@ -401,7 +356,28 @@ const source = context => {
|
|
|
401
356
|
validFor,
|
|
402
357
|
};
|
|
403
358
|
default:
|
|
404
|
-
if (
|
|
359
|
+
if (/\.\.|[-+*/%^&|~<>[]/u.test(char)) {
|
|
360
|
+
return {
|
|
361
|
+
from,
|
|
362
|
+
options: [...constants, ...tables],
|
|
363
|
+
validFor,
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
else if (/[={(,]/u.test(char)) {
|
|
367
|
+
return {
|
|
368
|
+
from,
|
|
369
|
+
options: [...luaBuiltins, ...constants, ...tables, ...unary],
|
|
370
|
+
validFor,
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
else if (/[}\])]/u.test(char)) {
|
|
374
|
+
return {
|
|
375
|
+
from,
|
|
376
|
+
options: [...binary, ...blocks],
|
|
377
|
+
validFor,
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
else if (pre !== char) {
|
|
405
381
|
const { prevSibling } = node;
|
|
406
382
|
return {
|
|
407
383
|
from,
|