@bhsd/codemirror-mediawiki 3.6.0 → 3.6.2
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/escape.js +0 -1
- package/dist/fold.js +1 -3
- package/dist/linter.d.ts +1 -1
- package/dist/linter.js +2 -3
- package/dist/lua.js +1 -7
- package/dist/main.min.js +24 -24
- package/dist/matchBrackets.js +2 -4
- package/dist/mediawiki.js +9 -6
- package/dist/mw.min.js +27 -27
- package/dist/openLinks.js +1 -1
- package/dist/signature.js +5 -4
- package/dist/statusBar.js +0 -1
- package/dist/token.js +16 -28
- package/dist/wiki.min.js +26 -26
- package/i18n/en.json +2 -2
- package/i18n/zh-hans.json +2 -2
- package/i18n/zh-hant.json +2 -2
- package/package.json +26 -26
package/dist/escape.js
CHANGED
package/dist/fold.js
CHANGED
|
@@ -48,7 +48,7 @@ const refNames = new Set(['ref', 'references']);
|
|
|
48
48
|
*/
|
|
49
49
|
export const foldable = (state, posOrNode, tree, refOnly = false) => {
|
|
50
50
|
if (typeof posOrNode === 'number') {
|
|
51
|
-
tree = ensureSyntaxTree(state, posOrNode);
|
|
51
|
+
tree = ensureSyntaxTree(state, posOrNode);
|
|
52
52
|
}
|
|
53
53
|
if (!tree) {
|
|
54
54
|
return false;
|
|
@@ -202,7 +202,6 @@ const getAnchor = (state) => Math.max(...state.selection.ranges.map(({ to }) =>
|
|
|
202
202
|
*/
|
|
203
203
|
const traverse = (state, tree, effects, node, end, anchor, update, refOnly) => {
|
|
204
204
|
while (node && node.from <= end) {
|
|
205
|
-
/* eslint-disable no-param-reassign */
|
|
206
205
|
const range = foldable(state, node, tree, refOnly);
|
|
207
206
|
if (range) {
|
|
208
207
|
effects.push(foldEffect.of(range));
|
|
@@ -212,7 +211,6 @@ const traverse = (state, tree, effects, node, end, anchor, update, refOnly) => {
|
|
|
212
211
|
continue;
|
|
213
212
|
}
|
|
214
213
|
node = node.nextSibling;
|
|
215
|
-
/* eslint-enable no-param-reassign */
|
|
216
214
|
}
|
|
217
215
|
return anchor;
|
|
218
216
|
};
|
package/dist/linter.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ declare interface JsonError {
|
|
|
32
32
|
* @param obj 对象
|
|
33
33
|
*/
|
|
34
34
|
export declare const getWikiLinter: getAsyncLinter<Promise<MixedDiagnostic[]>, Option, object>;
|
|
35
|
-
export declare const jsConfig:
|
|
35
|
+
export declare const jsConfig: Option;
|
|
36
36
|
/**
|
|
37
37
|
* 获取 ESLint
|
|
38
38
|
* @param cdn CDN 地址
|
package/dist/linter.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable unicorn/no-unreadable-iife */
|
|
2
1
|
import { sanitizeInlineStyle } from '@bhsd/common';
|
|
3
2
|
import { loadScript, getWikiparse, getLSP } from '@bhsd/browser';
|
|
4
3
|
import { styleLint } from '@bhsd/stylelint-util';
|
|
@@ -63,7 +62,7 @@ export const getWikiLinter = async (opt, obj) => {
|
|
|
63
62
|
...diagnostics,
|
|
64
63
|
...(await cssLint(lines.join('\n'), isConfig ? { ...cssConfig, rules } : rules))
|
|
65
64
|
.map(({ line, column, endLine, endColumn, rule, severity, text: message, fix }) => {
|
|
66
|
-
const i = Math.ceil(line / 3), {
|
|
65
|
+
const i = Math.ceil(line / 3), { range } = tokens[i - 1].childNodes[1].childNodes[0], from = offsetAt(range, line - 3 * i, column - 1), diagnostic = {
|
|
67
66
|
from,
|
|
68
67
|
to: endLine === undefined ? from : offsetAt(range, endLine - 3 * i, endColumn - 1),
|
|
69
68
|
severity: severity === 'error' ? 1 : 2,
|
|
@@ -72,7 +71,7 @@ export const getWikiLinter = async (opt, obj) => {
|
|
|
72
71
|
message,
|
|
73
72
|
};
|
|
74
73
|
if (fix) {
|
|
75
|
-
const before = lines.slice(0, i - 1).join('\n').length + length;
|
|
74
|
+
const { length } = getPrefix(tokens[i - 1], i), before = lines.slice(0, i - 1).join('\n').length + length + (i - 1 && 1);
|
|
76
75
|
diagnostic.data = [
|
|
77
76
|
{
|
|
78
77
|
range: {
|
package/dist/lua.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable no-template-curly-in-string */
|
|
1
2
|
import { lua } from '@codemirror/legacy-modes/mode/lua';
|
|
2
3
|
import { syntaxTree, LanguageSupport, StreamLanguage, foldService } from '@codemirror/language';
|
|
3
4
|
import { snippetCompletion } from '@codemirror/autocomplete';
|
|
@@ -243,7 +244,6 @@ const map = {
|
|
|
243
244
|
'not',
|
|
244
245
|
'function',
|
|
245
246
|
].map(label => ({ label, type: 'keyword' })),
|
|
246
|
-
// eslint-disable-next-line no-template-curly-in-string
|
|
247
247
|
snippetCompletion('function ${name}(${})\n\t${}\nend', {
|
|
248
248
|
label: 'function',
|
|
249
249
|
detail: 'definition',
|
|
@@ -267,37 +267,31 @@ const map = {
|
|
|
267
267
|
'for',
|
|
268
268
|
'local',
|
|
269
269
|
].map(label => ({ label, type: 'keyword' })),
|
|
270
|
-
// eslint-disable-next-line no-template-curly-in-string
|
|
271
270
|
snippetCompletion('if ${condition} then\n\t${}\nend', {
|
|
272
271
|
label: 'if',
|
|
273
272
|
detail: 'block',
|
|
274
273
|
type: 'keyword',
|
|
275
274
|
}),
|
|
276
|
-
// eslint-disable-next-line no-template-curly-in-string
|
|
277
275
|
snippetCompletion('if ${condition} then\n\t${}\nelse\n\t${}\nend', {
|
|
278
276
|
label: 'if',
|
|
279
277
|
detail: '/ else block',
|
|
280
278
|
type: 'keyword',
|
|
281
279
|
}),
|
|
282
|
-
// eslint-disable-next-line no-template-curly-in-string
|
|
283
280
|
snippetCompletion('while ${condition} do\n\t${}\nend', {
|
|
284
281
|
label: 'while',
|
|
285
282
|
detail: 'loop',
|
|
286
283
|
type: 'keyword',
|
|
287
284
|
}),
|
|
288
|
-
// eslint-disable-next-line no-template-curly-in-string
|
|
289
285
|
snippetCompletion('repeat \n\t${}\nuntil ${condition}', {
|
|
290
286
|
label: 'repeat',
|
|
291
287
|
detail: 'loop',
|
|
292
288
|
type: 'keyword',
|
|
293
289
|
}),
|
|
294
|
-
// eslint-disable-next-line no-template-curly-in-string
|
|
295
290
|
snippetCompletion('for ${name} = ${from}, ${to}, ${step} do\n\t${}\nend', {
|
|
296
291
|
label: 'for',
|
|
297
292
|
detail: 'loop',
|
|
298
293
|
type: 'keyword',
|
|
299
294
|
}),
|
|
300
|
-
// eslint-disable-next-line no-template-curly-in-string
|
|
301
295
|
snippetCompletion('for ${...} in ${...} do\n\t${}\nend', {
|
|
302
296
|
label: 'for',
|
|
303
297
|
detail: 'in loop',
|