@bhsd/codemirror-mediawiki 2.24.1 → 2.24.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/hover.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Tooltip } from '@codemirror/view';
1
+ import type { Tooltip, TooltipView, EditorView } from '@codemirror/view';
2
2
  import type { Text } from '@codemirror/state';
3
3
  import type { Position } from 'vscode-languageserver-types';
4
4
  /**
@@ -13,6 +13,12 @@ export declare const indexToPos: (doc: Text, index: number) => Position;
13
13
  * @param pos 位置
14
14
  */
15
15
  export declare const posToIndex: (doc: Text, pos: Position) => number;
16
+ /**
17
+ * 创建 TooltipView
18
+ * @param view EditorView 实例
19
+ * @param innerHTML 提示内容
20
+ */
21
+ export declare const createTooltipView: (view: EditorView, innerHTML: string) => TooltipView;
16
22
  declare const _default: import("@codemirror/state").Extension & {
17
23
  active: import("@codemirror/state").StateField<readonly Tooltip[]>;
18
24
  };
@@ -0,0 +1,40 @@
1
+ import type { Diagnostic as DiagnosticBase, Range } from 'vscode-languageserver-types';
2
+ import type { Linter } from 'eslint';
3
+ import type { Warning } from 'stylelint';
4
+ import type { Diagnostic } from 'luacheck-browserify';
5
+ export type Option = Record<string, unknown> | null | undefined;
6
+ export type LiveOption = (runtime?: true) => Option;
7
+ declare type getLinter<T> = () => (text: string) => T;
8
+ /**
9
+ * @param opt 初始化选项
10
+ * @param obj 仅用于wikiparse.LanguageService
11
+ * @param config runtime设置
12
+ */
13
+ declare type getAsyncLinter<T, S = never, R = never> = (opt?: S, obj?: R) => Promise<(text: string, config?: Option) => T>;
14
+ declare interface MixedDiagnostic extends Omit<DiagnosticBase, 'range'> {
15
+ range?: Range;
16
+ from?: number;
17
+ to?: number;
18
+ }
19
+ /**
20
+ * 获取 Wikitext LSP
21
+ * @param opt 选项
22
+ * @param obj 对象
23
+ */
24
+ export declare const getWikiLinter: getAsyncLinter<Promise<MixedDiagnostic[]>, Option, object>;
25
+ /** 获取 ESLint */
26
+ export declare const getJsLinter: getAsyncLinter<Linter.LintMessage[]>;
27
+ /** 获取 Stylelint */
28
+ export declare const getCssLinter: getAsyncLinter<Promise<Warning[]>>;
29
+ /** 获取 Luacheck */
30
+ export declare const getLuaLinter: getAsyncLinter<Promise<Diagnostic[]>>;
31
+ declare interface JsonError {
32
+ message: string;
33
+ severity: 'error';
34
+ line: string | undefined;
35
+ column: string | undefined;
36
+ position: string | undefined;
37
+ }
38
+ /** JSON.parse */
39
+ export declare const getJsonLinter: getLinter<JsonError[]>;
40
+ export {};
package/dist/linter.mjs CHANGED
@@ -66,7 +66,12 @@ const getJsLinter = async () => {
66
66
  };
67
67
  const getCssLinter = async () => {
68
68
  await loadScript("npm/stylelint-bundle", "stylelint");
69
- return (code, opt) => styleLint(stylelint, code, opt == null ? void 0 : opt["rules"]);
69
+ return (code, opt) => styleLint(
70
+ stylelint,
71
+ code,
72
+ opt == null ? void 0 : opt["rules"],
73
+ true
74
+ );
70
75
  };
71
76
  const getLuaLinter = async () => {
72
77
  await loadScript("npm/luacheck-browserify/dist/index.min.js", "luacheck");