wikilint 2.16.0 → 2.16.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/config/default.json +0 -2
- package/config/zhwiki.json +0 -2
- package/data/.schema.json +56 -0
- package/data/signatures.json +2673 -0
- package/dist/base.d.mts +49 -9
- package/dist/base.d.ts +49 -9
- package/dist/index.d.ts +1 -1
- package/dist/lib/lsp.d.ts +31 -12
- package/dist/lib/lsp.js +241 -62
- package/dist/src/transclude.js +3 -2
- package/package.json +3 -2
package/dist/base.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Range, Position, ColorInformation, ColorPresentation, CompletionItem,
|
|
1
|
+
import type { Range, Position, ColorInformation, ColorPresentation, CompletionItem as CompletionItemBase, CompletionItemKind, FoldingRange, DocumentLink, Location, WorkspaceEdit, Diagnostic, Hover, DocumentSymbol, CodeAction, SignatureHelp } from 'vscode-languageserver-types';
|
|
2
2
|
export interface Config {
|
|
3
3
|
ext: string[];
|
|
4
4
|
readonly html: [string[], string[], string[]];
|
|
@@ -83,7 +83,26 @@ interface Token extends AstNode {
|
|
|
83
83
|
*/
|
|
84
84
|
querySelectorAll<T = Token>(selector: string): T[];
|
|
85
85
|
}
|
|
86
|
+
interface SignatureParameter {
|
|
87
|
+
label: string;
|
|
88
|
+
const?: boolean;
|
|
89
|
+
rest?: boolean;
|
|
90
|
+
}
|
|
91
|
+
export interface SignatureInfo {
|
|
92
|
+
aliases: string[];
|
|
93
|
+
description: string;
|
|
94
|
+
signatures?: SignatureParameter[][];
|
|
95
|
+
}
|
|
96
|
+
export interface SignatureData {
|
|
97
|
+
behaviorSwitches: SignatureInfo[];
|
|
98
|
+
parserFunctions: SignatureInfo[];
|
|
99
|
+
}
|
|
100
|
+
export type CompletionItem = Omit<CompletionItemBase, 'kind'> & {
|
|
101
|
+
kind: keyof typeof CompletionItemKind;
|
|
102
|
+
};
|
|
86
103
|
export interface LanguageService {
|
|
104
|
+
/** 销毁实例 */
|
|
105
|
+
destroy(): void;
|
|
87
106
|
/**
|
|
88
107
|
* 提供颜色指示
|
|
89
108
|
* @param rgba 颜色解析函数
|
|
@@ -93,10 +112,9 @@ export interface LanguageService {
|
|
|
93
112
|
provideDocumentColors(rgba: (s: string) => [number, number, number, number] | [], text: string, hsl?: boolean): Promise<ColorInformation[]>;
|
|
94
113
|
/**
|
|
95
114
|
* 颜色选择器
|
|
96
|
-
* @
|
|
115
|
+
* @param color 颜色信息
|
|
97
116
|
*/
|
|
98
|
-
provideColorPresentations(
|
|
99
|
-
{ color: { red, green, blue, alpha }, range }: ColorInformation): ColorPresentation[];
|
|
117
|
+
provideColorPresentations(color: ColorInformation): ColorPresentation[];
|
|
100
118
|
/**
|
|
101
119
|
* 提供自动补全
|
|
102
120
|
* @param text 源代码
|
|
@@ -104,15 +122,15 @@ export interface LanguageService {
|
|
|
104
122
|
*/
|
|
105
123
|
provideCompletionItems(text: string, position: Position): Promise<CompletionItem[] | undefined>;
|
|
106
124
|
/**
|
|
107
|
-
*
|
|
108
|
-
* @param
|
|
125
|
+
* 提供语法检查
|
|
126
|
+
* @param wikitext 源代码
|
|
109
127
|
*/
|
|
110
|
-
|
|
128
|
+
provideDiagnostics(wikitext: string): Promise<Diagnostic[]>;
|
|
111
129
|
/**
|
|
112
|
-
*
|
|
130
|
+
* 提供折叠范围
|
|
113
131
|
* @param text 源代码
|
|
114
132
|
*/
|
|
115
|
-
|
|
133
|
+
provideFoldingRanges(text: string): Promise<FoldingRange[]>;
|
|
116
134
|
/**
|
|
117
135
|
* 提供链接
|
|
118
136
|
* @param text 源代码
|
|
@@ -143,6 +161,28 @@ export interface LanguageService {
|
|
|
143
161
|
* @param newName 新名称
|
|
144
162
|
*/
|
|
145
163
|
provideRenameEdits(text: string, position: Position, newName: string): Promise<WorkspaceEdit | undefined>;
|
|
164
|
+
/**
|
|
165
|
+
* 提供悬停信息
|
|
166
|
+
* @param text 源代码
|
|
167
|
+
* @param position 位置
|
|
168
|
+
*/
|
|
169
|
+
provideHover(text: string, position: Position): Promise<Hover | undefined>;
|
|
170
|
+
/**
|
|
171
|
+
* 提供魔术字帮助
|
|
172
|
+
* @param text 源代码
|
|
173
|
+
* @param position 位置
|
|
174
|
+
*/
|
|
175
|
+
provideSignatureHelp(text: string, position: Position): Promise<SignatureHelp | undefined>;
|
|
176
|
+
/**
|
|
177
|
+
* 提供快速修复建议
|
|
178
|
+
* @param diagnostics 语法诊断信息
|
|
179
|
+
*/
|
|
180
|
+
provideCodeAction(diagnostics: Diagnostic[]): CodeAction[];
|
|
181
|
+
/**
|
|
182
|
+
* 提供章节
|
|
183
|
+
* @param text 源代码
|
|
184
|
+
*/
|
|
185
|
+
provideDocumentSymbols(text: string): Promise<DocumentSymbol[]>;
|
|
146
186
|
}
|
|
147
187
|
export interface Parser {
|
|
148
188
|
config: Config | string;
|
package/dist/base.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Range, Position, ColorInformation, ColorPresentation, CompletionItem,
|
|
1
|
+
import type { Range, Position, ColorInformation, ColorPresentation, CompletionItem as CompletionItemBase, CompletionItemKind, FoldingRange, DocumentLink, Location, WorkspaceEdit, Diagnostic, Hover, DocumentSymbol, CodeAction, SignatureHelp } from 'vscode-languageserver-types';
|
|
2
2
|
export interface Config {
|
|
3
3
|
ext: string[];
|
|
4
4
|
readonly html: [string[], string[], string[]];
|
|
@@ -83,7 +83,26 @@ interface Token extends AstNode {
|
|
|
83
83
|
*/
|
|
84
84
|
querySelectorAll<T = Token>(selector: string): T[];
|
|
85
85
|
}
|
|
86
|
+
interface SignatureParameter {
|
|
87
|
+
label: string;
|
|
88
|
+
const?: boolean;
|
|
89
|
+
rest?: boolean;
|
|
90
|
+
}
|
|
91
|
+
export interface SignatureInfo {
|
|
92
|
+
aliases: string[];
|
|
93
|
+
description: string;
|
|
94
|
+
signatures?: SignatureParameter[][];
|
|
95
|
+
}
|
|
96
|
+
export interface SignatureData {
|
|
97
|
+
behaviorSwitches: SignatureInfo[];
|
|
98
|
+
parserFunctions: SignatureInfo[];
|
|
99
|
+
}
|
|
100
|
+
export type CompletionItem = Omit<CompletionItemBase, 'kind'> & {
|
|
101
|
+
kind: keyof typeof CompletionItemKind;
|
|
102
|
+
};
|
|
86
103
|
export interface LanguageService {
|
|
104
|
+
/** 销毁实例 */
|
|
105
|
+
destroy(): void;
|
|
87
106
|
/**
|
|
88
107
|
* 提供颜色指示
|
|
89
108
|
* @param rgba 颜色解析函数
|
|
@@ -93,10 +112,9 @@ export interface LanguageService {
|
|
|
93
112
|
provideDocumentColors(rgba: (s: string) => [number, number, number, number] | [], text: string, hsl?: boolean): Promise<ColorInformation[]>;
|
|
94
113
|
/**
|
|
95
114
|
* 颜色选择器
|
|
96
|
-
* @
|
|
115
|
+
* @param color 颜色信息
|
|
97
116
|
*/
|
|
98
|
-
provideColorPresentations(
|
|
99
|
-
{ color: { red, green, blue, alpha }, range }: ColorInformation): ColorPresentation[];
|
|
117
|
+
provideColorPresentations(color: ColorInformation): ColorPresentation[];
|
|
100
118
|
/**
|
|
101
119
|
* 提供自动补全
|
|
102
120
|
* @param text 源代码
|
|
@@ -104,15 +122,15 @@ export interface LanguageService {
|
|
|
104
122
|
*/
|
|
105
123
|
provideCompletionItems(text: string, position: Position): Promise<CompletionItem[] | undefined>;
|
|
106
124
|
/**
|
|
107
|
-
*
|
|
108
|
-
* @param
|
|
125
|
+
* 提供语法检查
|
|
126
|
+
* @param wikitext 源代码
|
|
109
127
|
*/
|
|
110
|
-
|
|
128
|
+
provideDiagnostics(wikitext: string): Promise<Diagnostic[]>;
|
|
111
129
|
/**
|
|
112
|
-
*
|
|
130
|
+
* 提供折叠范围
|
|
113
131
|
* @param text 源代码
|
|
114
132
|
*/
|
|
115
|
-
|
|
133
|
+
provideFoldingRanges(text: string): Promise<FoldingRange[]>;
|
|
116
134
|
/**
|
|
117
135
|
* 提供链接
|
|
118
136
|
* @param text 源代码
|
|
@@ -143,6 +161,28 @@ export interface LanguageService {
|
|
|
143
161
|
* @param newName 新名称
|
|
144
162
|
*/
|
|
145
163
|
provideRenameEdits(text: string, position: Position, newName: string): Promise<WorkspaceEdit | undefined>;
|
|
164
|
+
/**
|
|
165
|
+
* 提供悬停信息
|
|
166
|
+
* @param text 源代码
|
|
167
|
+
* @param position 位置
|
|
168
|
+
*/
|
|
169
|
+
provideHover(text: string, position: Position): Promise<Hover | undefined>;
|
|
170
|
+
/**
|
|
171
|
+
* 提供魔术字帮助
|
|
172
|
+
* @param text 源代码
|
|
173
|
+
* @param position 位置
|
|
174
|
+
*/
|
|
175
|
+
provideSignatureHelp(text: string, position: Position): Promise<SignatureHelp | undefined>;
|
|
176
|
+
/**
|
|
177
|
+
* 提供快速修复建议
|
|
178
|
+
* @param diagnostics 语法诊断信息
|
|
179
|
+
*/
|
|
180
|
+
provideCodeAction(diagnostics: Diagnostic[]): CodeAction[];
|
|
181
|
+
/**
|
|
182
|
+
* 提供章节
|
|
183
|
+
* @param text 源代码
|
|
184
|
+
*/
|
|
185
|
+
provideDocumentSymbols(text: string): Promise<DocumentSymbol[]>;
|
|
146
186
|
}
|
|
147
187
|
export interface Parser {
|
|
148
188
|
config: Config | string;
|
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,6 @@ declare const Parser: Parser;
|
|
|
22
22
|
// @ts-expect-error mixed export styles
|
|
23
23
|
export = Parser;
|
|
24
24
|
export default Parser;
|
|
25
|
-
export type { Config, LintError, TokenTypes, };
|
|
25
|
+
export type { Config, LintError, TokenTypes, LanguageService, };
|
|
26
26
|
export type * from './internal';
|
|
27
27
|
declare global { type Acceptable = unknown; }
|
package/dist/lib/lsp.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
3
|
-
|
|
1
|
+
import Parser from '../index';
|
|
2
|
+
import type { Range, Position, ColorInformation, ColorPresentation, FoldingRange, DocumentSymbol, DocumentLink, Location, WorkspaceEdit, Diagnostic, Hover, CodeAction, SignatureHelp } from 'vscode-languageserver-types';
|
|
3
|
+
import type { LanguageService as LanguageServiceBase, CompletionItem, SignatureData } from '../base';
|
|
4
|
+
export declare const tasks: WeakMap<object, Parser.LanguageService>;
|
|
4
5
|
/** VSCode-style language service */
|
|
5
6
|
export declare class LanguageService implements LanguageServiceBase {
|
|
6
7
|
#private;
|
|
7
8
|
/** @param uri 任务标识 */
|
|
8
9
|
constructor(uri: object);
|
|
10
|
+
/** @implements */
|
|
11
|
+
destroy(): void;
|
|
9
12
|
/**
|
|
10
13
|
* 提供颜色指示
|
|
11
14
|
* @param rgba 颜色解析函数
|
|
@@ -13,10 +16,7 @@ export declare class LanguageService implements LanguageServiceBase {
|
|
|
13
16
|
* @param hsl 是否允许HSL颜色
|
|
14
17
|
*/
|
|
15
18
|
provideDocumentColors(rgba: (s: string) => [number, number, number, number] | [], text: string, hsl?: boolean): Promise<ColorInformation[]>;
|
|
16
|
-
/**
|
|
17
|
-
* 颜色选择器
|
|
18
|
-
* @ignore
|
|
19
|
-
*/
|
|
19
|
+
/** @implements */
|
|
20
20
|
provideColorPresentations(// eslint-disable-line @typescript-eslint/class-methods-use-this
|
|
21
21
|
{ color: { red, green, blue, alpha }, range }: ColorInformation): ColorPresentation[];
|
|
22
22
|
/**
|
|
@@ -26,15 +26,15 @@ export declare class LanguageService implements LanguageServiceBase {
|
|
|
26
26
|
*/
|
|
27
27
|
provideCompletionItems(text: string, position: Position): Promise<CompletionItem[] | undefined>;
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
30
|
-
* @param
|
|
29
|
+
* 提供语法诊断
|
|
30
|
+
* @param wikitext 源代码
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
provideDiagnostics(wikitext: string): Promise<Diagnostic[]>;
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
34
|
+
* 提供折叠范围
|
|
35
35
|
* @param text 源代码
|
|
36
36
|
*/
|
|
37
|
-
|
|
37
|
+
provideFoldingRanges(text: string): Promise<FoldingRange[]>;
|
|
38
38
|
/**
|
|
39
39
|
* 提供链接
|
|
40
40
|
* @param text 源代码
|
|
@@ -65,4 +65,23 @@ export declare class LanguageService implements LanguageServiceBase {
|
|
|
65
65
|
* @param newName 新名称
|
|
66
66
|
*/
|
|
67
67
|
provideRenameEdits(text: string, position: Position, newName: string): Promise<WorkspaceEdit | undefined>;
|
|
68
|
+
/**
|
|
69
|
+
* 提供悬停信息
|
|
70
|
+
* @param text 源代码
|
|
71
|
+
* @param position 位置
|
|
72
|
+
*/
|
|
73
|
+
provideHover(text: string, position: Position): Promise<Hover | undefined>;
|
|
74
|
+
/**
|
|
75
|
+
* 提供魔术字帮助
|
|
76
|
+
* @param text 源代码
|
|
77
|
+
* @param position 位置
|
|
78
|
+
*/
|
|
79
|
+
provideSignatureHelp(text: string, position: Position): Promise<SignatureHelp | undefined>;
|
|
80
|
+
/** @implements */
|
|
81
|
+
provideCodeAction(diagnostics: Diagnostic[]): CodeAction[];
|
|
82
|
+
/**
|
|
83
|
+
* 提供章节
|
|
84
|
+
* @param text 源代码
|
|
85
|
+
*/
|
|
86
|
+
provideDocumentSymbols(text: string): Promise<DocumentSymbol[]>;
|
|
68
87
|
}
|