wikilint 2.16.1 → 2.16.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.
@@ -764,7 +764,7 @@
764
764
  }
765
765
  ]
766
766
  ],
767
- "description": "The unexpanded wikitext is rendered (more or less, for details see [Help:Templates](https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Templates#Usage))."
767
+ "description": "The unexpanded wikitext is rendered (more or less, for details see [help](https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Templates#Usage))."
768
768
  },
769
769
  {
770
770
  "aliases": [
@@ -848,7 +848,7 @@
848
848
  }
849
849
  ]
850
850
  ],
851
- "description": "Alias for XML-style MediaWiki parser tags or extension tags. It allows a [pre-save transform of wiki code](https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Tag_extensions#How_do_I_render_wikitext_in_my_extension?) and [Extension:ParserFunctions](https://www.mediawiki.org/wiki/Special:MyLanguage/Extension:ParserFunctions) within tags before the tag is processed. It also prevents parsing of tags in conditional paths that aren't executed (like in `#if` statements). Content between tags is passed as the first parameter, and any attributes for the tags can be passed as subsequent parameters."
851
+ "description": "Alias for XML-style MediaWiki parser tags or extension tags. It allows a [pre-save transform of wiki code](https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Tag_extensions#How_do_I_render_wikitext_in_my_extension?) and parser functions within tags before the tag is processed. It also prevents parsing of tags in conditional paths that aren't executed (like in `#if` statements). Content between tags is passed as the first parameter, and any attributes for the tags can be passed as subsequent parameters."
852
852
  },
853
853
  {
854
854
  "aliases": [
@@ -1550,6 +1550,84 @@
1550
1550
  ],
1551
1551
  "description": "This function will output the final, last value a variable has at the end of the page rendering. Naturally, the value will be inserted after the parser went over the entire wiki markup, so this function can't be used in other functions, expecting the right value is being used.\n\nThe `default value` will be used if the variable doesn't exist at the final page rendering stage or if its value is an empty string. The default will be expanded right where the function is used, so the parameter will be expanded, even if it won't be needed."
1552
1552
  },
1553
+ {
1554
+ "aliases": [
1555
+ "#lst",
1556
+ "#section"
1557
+ ],
1558
+ "signatures": [
1559
+ [
1560
+ {
1561
+ "label": "article"
1562
+ },
1563
+ {
1564
+ "label": "chapter"
1565
+ }
1566
+ ]
1567
+ ],
1568
+ "description": "Transclude a section called *chapter* from a page called *article*. The target article defines the location of the section."
1569
+ },
1570
+ {
1571
+ "aliases": [
1572
+ "#lstx",
1573
+ "#section-x"
1574
+ ],
1575
+ "signatures": [
1576
+ [
1577
+ {
1578
+ "label": "article"
1579
+ },
1580
+ {
1581
+ "label": "chapter"
1582
+ }
1583
+ ],
1584
+ [
1585
+ {
1586
+ "label": "article"
1587
+ },
1588
+ {
1589
+ "label": "chapter"
1590
+ },
1591
+ {
1592
+ "label": "replacement text"
1593
+ }
1594
+ ]
1595
+ ],
1596
+ "description": "Transclude a page, but exclude a specified section. Optionally, you may add replacement text to the excluded section. The replacement text will appear in the area where the section is skipped (excluded)."
1597
+ },
1598
+ {
1599
+ "aliases": [
1600
+ "#lsth",
1601
+ "#section-h"
1602
+ ],
1603
+ "signatures": [
1604
+ [
1605
+ {
1606
+ "label": "article"
1607
+ }
1608
+ ],
1609
+ [
1610
+ {
1611
+ "label": "article"
1612
+ },
1613
+ {
1614
+ "label": "section X"
1615
+ }
1616
+ ],
1617
+ [
1618
+ {
1619
+ "label": "article"
1620
+ },
1621
+ {
1622
+ "label": "section X"
1623
+ },
1624
+ {
1625
+ "label": "section Y"
1626
+ }
1627
+ ]
1628
+ ],
1629
+ "description": "Transclude the introduction of a page (i.e. the content before the first heading), or the whole content of the first occurrence of the *section X* (which includes all its sub-sections but excludes the heading of *section X* itself), or the content from the first occurrence of *section X* (excluding the heading of *section X* itself) until it reaches the next occurrence of *section Y*. Note that *section Y* acts as a stop point so the transclusion doesn't contain the content of *section Y*."
1630
+ },
1553
1631
  {
1554
1632
  "aliases": [
1555
1633
  "currentyear",
@@ -2637,13 +2715,13 @@
2637
2715
  "aliases": [
2638
2716
  "!"
2639
2717
  ],
2640
- "description": "Used to include a vertical bar (pipe).\n\nSee [Help:Extension:ParserFunctions#Escaping pipe characters in tables](https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Extension:ParserFunctions#Escaping_pipe_characters_in_tables) for further explanation."
2718
+ "description": "Used to include a vertical bar (pipe).\n\nSee [help](https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Extension:ParserFunctions#Escaping_pipe_characters_in_tables) for further explanation."
2641
2719
  },
2642
2720
  {
2643
2721
  "aliases": [
2644
2722
  "="
2645
2723
  ],
2646
- "description": "Used to include an equal sign.\n\nSee [Help:Extension:ParserFunctions#Raw equal signs](https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Extension:ParserFunctions#Raw_equal_signs) for further explanation."
2724
+ "description": "Used to include an equal sign.\n\nSee [help](https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Extension:ParserFunctions#Raw_equal_signs) for further explanation."
2647
2725
  },
2648
2726
  {
2649
2727
  "aliases": [
package/dist/base.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Range, Position, ColorInformation, ColorPresentation, CompletionItem as CompletionItemBase, CompletionItemKind, FoldingRange, DocumentLink, Location, WorkspaceEdit, Diagnostic, Hover, DocumentSymbol, CodeAction, SignatureHelp } from 'vscode-languageserver-types';
1
+ import type { Range, Position, ColorInformation, ColorPresentation, CompletionItem as CompletionItemBase, CompletionItemKind, FoldingRange, DocumentLink, Location, WorkspaceEdit, Diagnostic, Hover, SignatureHelp, InlayHint, DocumentSymbol, CodeAction } from 'vscode-languageserver-types';
2
2
  export interface Config {
3
3
  ext: string[];
4
4
  readonly html: [string[], string[], string[]];
@@ -125,7 +125,7 @@ export interface LanguageService {
125
125
  * 提供语法检查
126
126
  * @param wikitext 源代码
127
127
  */
128
- provideDiagnostics(wikitext: string): Promise<Diagnostic[]>;
128
+ provideDiagnostics(wikitext: string, warning?: boolean): Promise<Diagnostic[]>;
129
129
  /**
130
130
  * 提供折叠范围
131
131
  * @param text 源代码
@@ -173,6 +173,11 @@ export interface LanguageService {
173
173
  * @param position 位置
174
174
  */
175
175
  provideSignatureHelp(text: string, position: Position): Promise<SignatureHelp | undefined>;
176
+ /**
177
+ * 提供 CodeLens
178
+ * @param text 源代码
179
+ */
180
+ provideInlayHints(text: string): Promise<InlayHint[]>;
176
181
  /**
177
182
  * 提供快速修复建议
178
183
  * @param diagnostics 语法诊断信息
package/dist/base.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Range, Position, ColorInformation, ColorPresentation, CompletionItem as CompletionItemBase, CompletionItemKind, FoldingRange, DocumentLink, Location, WorkspaceEdit, Diagnostic, Hover, DocumentSymbol, CodeAction, SignatureHelp } from 'vscode-languageserver-types';
1
+ import type { Range, Position, ColorInformation, ColorPresentation, CompletionItem as CompletionItemBase, CompletionItemKind, FoldingRange, DocumentLink, Location, WorkspaceEdit, Diagnostic, Hover, SignatureHelp, InlayHint, DocumentSymbol, CodeAction } from 'vscode-languageserver-types';
2
2
  export interface Config {
3
3
  ext: string[];
4
4
  readonly html: [string[], string[], string[]];
@@ -125,7 +125,7 @@ export interface LanguageService {
125
125
  * 提供语法检查
126
126
  * @param wikitext 源代码
127
127
  */
128
- provideDiagnostics(wikitext: string): Promise<Diagnostic[]>;
128
+ provideDiagnostics(wikitext: string, warning?: boolean): Promise<Diagnostic[]>;
129
129
  /**
130
130
  * 提供折叠范围
131
131
  * @param text 源代码
@@ -173,6 +173,11 @@ export interface LanguageService {
173
173
  * @param position 位置
174
174
  */
175
175
  provideSignatureHelp(text: string, position: Position): Promise<SignatureHelp | undefined>;
176
+ /**
177
+ * 提供 CodeLens
178
+ * @param text 源代码
179
+ */
180
+ provideInlayHints(text: string): Promise<InlayHint[]>;
176
181
  /**
177
182
  * 提供快速修复建议
178
183
  * @param diagnostics 语法诊断信息
@@ -4,6 +4,7 @@ const fs = require("fs");
4
4
  // eslint-disable-next-line n/no-missing-require
5
5
  const { total: { statements: { pct } } } = require('../../coverage/coverage-summary.json');
6
6
  const colors = ['#4c1', '#dfb317', '#e05d44'];
7
+ const re = new RegExp(colors.join('|'), 'u');
7
8
  let color;
8
9
  if (pct >= 80) {
9
10
  [color] = colors;
@@ -15,5 +16,5 @@ else {
15
16
  [, , color] = colors;
16
17
  }
17
18
  const svg = fs.readFileSync('coverage/badge.svg', 'utf8').replace(/\b\d{2}(?=%)/gu, String(Math.round(pct)))
18
- .replace(new RegExp(colors.join('|'), 'u'), color);
19
+ .replace(re, color);
19
20
  fs.writeFileSync('coverage/badge.svg', svg);
@@ -24,10 +24,12 @@ class AstElement extends node_1.AstNode {
24
24
  */
25
25
  const remove = (i) => {
26
26
  childNodes.splice(i, 1);
27
+ childNodes[i - 1]?.setAttribute('nextSibling', childNodes[i]);
28
+ childNodes[i]?.setAttribute('previousSibling', childNodes[i - 1]);
27
29
  };
28
30
  for (let i = childNodes.length - 1; i >= 0; i--) {
29
31
  const { type, data } = childNodes[i];
30
- if (type !== 'text' || this.getGaps(i - 1)) {
32
+ if (type !== 'text' || childNodes.length === 1 || this.getGaps(i - (i && 1))) {
31
33
  //
32
34
  }
33
35
  else if (data === '') {
package/dist/lib/lsp.d.ts CHANGED
@@ -1,6 +1,13 @@
1
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';
2
+ import type { Range, Position, ColorInformation, ColorPresentation, FoldingRange, DocumentSymbol, DocumentLink, Location, WorkspaceEdit, Diagnostic as DiagnosticBase, TextEdit, Hover, SignatureHelp, InlayHint, CodeAction } from 'vscode-languageserver-types';
3
3
  import type { LanguageService as LanguageServiceBase, CompletionItem, SignatureData } from '../base';
4
+ declare interface QuickFixData extends TextEdit {
5
+ title: string;
6
+ fix: boolean;
7
+ }
8
+ declare interface Diagnostic extends DiagnosticBase {
9
+ data: QuickFixData[];
10
+ }
4
11
  export declare const tasks: WeakMap<object, Parser.LanguageService>;
5
12
  /** VSCode-style language service */
6
13
  export declare class LanguageService implements LanguageServiceBase {
@@ -28,8 +35,9 @@ export declare class LanguageService implements LanguageServiceBase {
28
35
  /**
29
36
  * 提供语法诊断
30
37
  * @param wikitext 源代码
38
+ * @param warning 是否提供警告
31
39
  */
32
- provideDiagnostics(wikitext: string): Promise<Diagnostic[]>;
40
+ provideDiagnostics(wikitext: string, warning?: boolean): Promise<Diagnostic[]>;
33
41
  /**
34
42
  * 提供折叠范围
35
43
  * @param text 源代码
@@ -77,6 +85,11 @@ export declare class LanguageService implements LanguageServiceBase {
77
85
  * @param position 位置
78
86
  */
79
87
  provideSignatureHelp(text: string, position: Position): Promise<SignatureHelp | undefined>;
88
+ /**
89
+ * 提供 CodeLens
90
+ * @param text 源代码
91
+ */
92
+ provideInlayHints(text: string): Promise<InlayHint[]>;
80
93
  /** @implements */
81
94
  provideCodeAction(diagnostics: Diagnostic[]): CodeAction[];
82
95
  /**
@@ -85,3 +98,4 @@ export declare class LanguageService implements LanguageServiceBase {
85
98
  */
86
99
  provideDocumentSymbols(text: string): Promise<DocumentSymbol[]>;
87
100
  }
101
+ export {};