@bhsd/codemirror-mediawiki 3.5.0 → 3.5.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/codemirror.d.ts +1 -1
- package/dist/codemirror.js +15 -5
- package/dist/escape.js +3 -5
- package/dist/fold.js +8 -14
- package/dist/hover.js +2 -3
- package/dist/inlay.js +2 -4
- package/dist/lintsource.d.ts +6 -1
- package/dist/lintsource.js +4 -2
- package/dist/lua.js +4 -0
- package/dist/main.min.js +25 -25
- package/dist/mediawiki.d.ts +1 -1
- package/dist/mediawiki.js +4 -3
- package/dist/mw.min.js +29 -29
- package/dist/mwConfig.js +22 -4
- package/dist/ref.js +2 -2
- package/dist/static.js +3 -2
- package/dist/statusBar.js +11 -27
- package/dist/token.d.ts +1 -1
- package/dist/token.js +18 -13
- package/dist/wiki.min.js +28 -28
- package/i18n/en.json +1 -1
- package/i18n/zh-hans.json +1 -1
- package/i18n/zh-hant.json +1 -1
- package/package.json +7 -10
package/dist/mediawiki.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { MediaWiki } from './token';
|
|
|
8
8
|
import type { StreamParser, TagStyle } from '@codemirror/language';
|
|
9
9
|
import type { CompletionSource, Completion } from '@codemirror/autocomplete';
|
|
10
10
|
import type { MwConfig } from './token';
|
|
11
|
-
export declare const
|
|
11
|
+
export declare const isWMF: boolean;
|
|
12
12
|
/**
|
|
13
13
|
* 判断节点是否包含指定类型
|
|
14
14
|
* @param types 节点类型
|
package/dist/mediawiki.js
CHANGED
|
@@ -6,12 +6,13 @@
|
|
|
6
6
|
import { HighlightStyle, LanguageSupport, StreamLanguage, syntaxHighlighting, syntaxTree, } from '@codemirror/language';
|
|
7
7
|
import { insertCompletionText, pickedCompletion } from '@codemirror/autocomplete';
|
|
8
8
|
import { wmf } from '@bhsd/common';
|
|
9
|
+
import { isUnderscore } from '@bhsd/cm-util';
|
|
9
10
|
import { commonHtmlAttrs, htmlAttrs, extAttrs } from 'wikiparser-node/dist/util/sharable.mjs';
|
|
10
11
|
import { MediaWiki } from './token';
|
|
11
12
|
import { htmlTags, tokens } from './config';
|
|
12
13
|
import { braceStackUpdate } from './fold';
|
|
13
14
|
import { EditorView } from '@codemirror/view';
|
|
14
|
-
export const
|
|
15
|
+
export const isWMF = /* @__PURE__ */ (() => typeof location === 'object' && new RegExp(String.raw `\.(?:${wmf})\.org$`, 'u').test(location.hostname))();
|
|
15
16
|
/**
|
|
16
17
|
* 检查首字母大小写并插入正确的自动填充内容
|
|
17
18
|
* @param view
|
|
@@ -45,7 +46,7 @@ export class FullMediaWiki extends MediaWiki {
|
|
|
45
46
|
type: i ? 'constant' : 'function',
|
|
46
47
|
label,
|
|
47
48
|
})));
|
|
48
|
-
this.doubleUnderscore = doubleUnderscore.flatMap(Object.keys).map((label) => ({
|
|
49
|
+
this.doubleUnderscore = doubleUnderscore.flatMap(Object.keys).filter(isUnderscore).map((label) => ({
|
|
49
50
|
type: 'constant',
|
|
50
51
|
label,
|
|
51
52
|
}));
|
|
@@ -162,7 +163,7 @@ export class FullMediaWiki extends MediaWiki {
|
|
|
162
163
|
get completionSource() {
|
|
163
164
|
return async (context) => {
|
|
164
165
|
const { state, pos, explicit } = context, node = syntaxTree(state).resolve(pos, -1), types = new Set(node.name.split('_')), isParserFunction = hasTag(types, 'parserFunctionName'),
|
|
165
|
-
/** 开头不包含` `,但可能包含`_` */ search = state.sliceDoc(node.from, pos).trimStart(), start = pos - search.length
|
|
166
|
+
/** 开头不包含` `,但可能包含`_` */ search = state.sliceDoc(node.from, pos).trimStart(), start = pos - search.length;
|
|
166
167
|
let { prevSibling } = node;
|
|
167
168
|
if (explicit || isParserFunction && search.includes('#') || isWMF) {
|
|
168
169
|
const validFor = isWMF ? null : { validFor: /^[^|{}<>[\]#]*$/u };
|