@getpaseo/protocol 0.4.0 → 0.5.0-beta.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/binary-frames/terminal.d.ts +1 -1
- package/dist/generated/validation/ws-outbound.aot.js +34992 -32088
- package/dist/messages.d.ts +3861 -352
- package/dist/messages.js +458 -4
- package/dist/search/text-match.d.ts +2 -0
- package/dist/search/text-match.js +28 -0
- package/dist/validation/ws-outbound-schema-metadata.d.ts +607 -39
- package/dist/workspace-labels.d.ts +9 -0
- package/dist/workspace-labels.js +19 -0
- package/package.json +1 -1
|
@@ -28,6 +28,8 @@ export interface FuzzyPolicy {
|
|
|
28
28
|
}
|
|
29
29
|
export declare function fuzzyPolicyForToken(token: string): FuzzyPolicy | null;
|
|
30
30
|
export declare function scoreMatch(query: string, text: string, options?: MatchOptions): MatchScore | null;
|
|
31
|
+
/** Match a query against a complete displayed path, including its separators. */
|
|
32
|
+
export declare function scorePathMatch(query: string, path: string): MatchScore | null;
|
|
31
33
|
export interface MatchRange {
|
|
32
34
|
start: number;
|
|
33
35
|
length: number;
|
|
@@ -174,6 +174,34 @@ export function scoreMatch(query, text, options = {}) {
|
|
|
174
174
|
const fuzzy = options.fuzzy;
|
|
175
175
|
return fuzzy ? scoreFuzzyMatch(q, t, fuzzy) : null;
|
|
176
176
|
}
|
|
177
|
+
function compactText(value) {
|
|
178
|
+
let compact = "";
|
|
179
|
+
const offsets = [];
|
|
180
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
181
|
+
if (!/[a-z0-9]/i.test(value[index]))
|
|
182
|
+
continue;
|
|
183
|
+
compact += value[index].toLowerCase();
|
|
184
|
+
offsets.push(index);
|
|
185
|
+
}
|
|
186
|
+
return { value: compact, offsets };
|
|
187
|
+
}
|
|
188
|
+
/** Match a query against a complete displayed path, including its separators. */
|
|
189
|
+
export function scorePathMatch(query, path) {
|
|
190
|
+
const direct = scoreMatch(query, path);
|
|
191
|
+
if (direct)
|
|
192
|
+
return direct;
|
|
193
|
+
const compactQuery = compactText(query);
|
|
194
|
+
const compactPath = compactText(path);
|
|
195
|
+
if (!compactQuery.value || !compactPath.value)
|
|
196
|
+
return null;
|
|
197
|
+
const compactScore = scoreMatch(compactQuery.value, compactPath.value);
|
|
198
|
+
if (!compactScore)
|
|
199
|
+
return null;
|
|
200
|
+
return {
|
|
201
|
+
...compactScore,
|
|
202
|
+
offset: compactPath.offsets[compactScore.offset] ?? compactScore.offset,
|
|
203
|
+
};
|
|
204
|
+
}
|
|
177
205
|
function mergeAdjacentRanges(indices) {
|
|
178
206
|
const ranges = [];
|
|
179
207
|
for (const index of indices) {
|