@sunshj/vscode-ab5x-utils 0.0.7 → 0.0.8
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/index.cjs +4 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +4 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -21,7 +21,10 @@ function createRegexCollector(regex, setupContextOrTransform, transform) {
|
|
|
21
21
|
};
|
|
22
22
|
if (transformFn) {
|
|
23
23
|
const item = transformFn(match, Object.assign({ _item }, context));
|
|
24
|
-
if (item) items.push(
|
|
24
|
+
if (item) items.push({
|
|
25
|
+
..._item,
|
|
26
|
+
...item
|
|
27
|
+
});
|
|
25
28
|
} else items.push(_item);
|
|
26
29
|
}
|
|
27
30
|
return items;
|
package/dist/index.d.mts
CHANGED
|
@@ -3,7 +3,7 @@ import { CodeLens, CodeLensProvider, CompletionItem, CompletionItemProvider, Dec
|
|
|
3
3
|
|
|
4
4
|
//#region src/index.d.ts
|
|
5
5
|
/** 匹配结果项 */
|
|
6
|
-
interface MatchItem<TExtra = unknown> {
|
|
6
|
+
interface MatchItem<TExtra = unknown> extends Record<string, unknown> {
|
|
7
7
|
/** 匹配的文本 */
|
|
8
8
|
text: string;
|
|
9
9
|
/** 匹配开始索引 */
|
|
@@ -109,9 +109,9 @@ type ContextWithMatchItem<TContext> = TContext & {
|
|
|
109
109
|
_item: MatchItem;
|
|
110
110
|
};
|
|
111
111
|
/** 创建基于正则的收集函数 - 无 context */
|
|
112
|
-
declare function createRegexCollector<TExtra = unknown>(regex: RegExp, transform?: (match: RegExpExecArray, context: ContextWithMatchItem<unknown>) => MatchItem<TExtra
|
|
112
|
+
declare function createRegexCollector<TExtra = unknown>(regex: RegExp, transform?: (match: RegExpExecArray, context: ContextWithMatchItem<unknown>) => Partial<MatchItem<TExtra>> | undefined): CollectFn<TExtra>;
|
|
113
113
|
/** 创建基于正则的收集函数 - 带 context */
|
|
114
|
-
declare function createRegexCollector<TContext = object, TExtra = unknown>(regex: RegExp, setupContext: () => TContext, transform: (match: RegExpExecArray, context: ContextWithMatchItem<TContext>) => MatchItem<TExtra
|
|
114
|
+
declare function createRegexCollector<TContext = object, TExtra = unknown>(regex: RegExp, setupContext: () => TContext, transform: (match: RegExpExecArray, context: ContextWithMatchItem<TContext>) => Partial<MatchItem<TExtra>> | undefined): CollectFn<TExtra>;
|
|
115
115
|
/** 从匹配项创建 Range */
|
|
116
116
|
declare function createRange(document: TextDocument, item: MatchItem): Range;
|
|
117
117
|
/** 获取匹配项的 extra 数据 */
|
package/dist/index.mjs
CHANGED
|
@@ -21,7 +21,10 @@ function createRegexCollector(regex, setupContextOrTransform, transform) {
|
|
|
21
21
|
};
|
|
22
22
|
if (transformFn) {
|
|
23
23
|
const item = transformFn(match, Object.assign({ _item }, context));
|
|
24
|
-
if (item) items.push(
|
|
24
|
+
if (item) items.push({
|
|
25
|
+
..._item,
|
|
26
|
+
...item
|
|
27
|
+
});
|
|
25
28
|
} else items.push(_item);
|
|
26
29
|
}
|
|
27
30
|
return items;
|