@tellaro/tql 0.1.12 → 0.1.14
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.
|
@@ -289,6 +289,38 @@ function G(e, t, a) {
|
|
|
289
289
|
}
|
|
290
290
|
return { type: "after_paren" };
|
|
291
291
|
}
|
|
292
|
+
// Check if we're typing inside mutator params (e.g., "geo(for" while typing "force")
|
|
293
|
+
// Pattern: field token, preceded by "(", preceded by mutator
|
|
294
|
+
if (n.type === "field" && r && r.type === "paren" && r.value === "(") {
|
|
295
|
+
const mutatorToken = o.length > 2 ? o[o.length - 3] : null;
|
|
296
|
+
if (mutatorToken && mutatorToken.type === "mutator") {
|
|
297
|
+
const mutatorName = mutatorToken.value.toLowerCase();
|
|
298
|
+
return { type: "mutator_params", mutatorName: mutatorName, usedParams: [], partialText: n.value };
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
// Check if we're after a comma inside mutator params (e.g., "geo(force=true, ")
|
|
302
|
+
if (n.type === "comma") {
|
|
303
|
+
// Look back for the pattern: mutator, "(", ...params..., ","
|
|
304
|
+
let foundMutator = null;
|
|
305
|
+
let usedParams = [];
|
|
306
|
+
for (let i = o.length - 2; i >= 0; i--) {
|
|
307
|
+
const tok = o[i];
|
|
308
|
+
if (tok.type === "paren" && tok.value === "(") {
|
|
309
|
+
// Check if token before ( is a mutator
|
|
310
|
+
if (i > 0 && o[i - 1].type === "mutator") {
|
|
311
|
+
foundMutator = o[i - 1].value.toLowerCase();
|
|
312
|
+
}
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
// Collect used parameter names (tokens that look like param=value)
|
|
316
|
+
if (tok.type === "field") {
|
|
317
|
+
usedParams.push(tok.value.toLowerCase());
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
if (foundMutator) {
|
|
321
|
+
return { type: "mutator_params", mutatorName: foundMutator, usedParams: usedParams, partialText: s };
|
|
322
|
+
}
|
|
323
|
+
}
|
|
292
324
|
if (n.type === "arrow")
|
|
293
325
|
return { type: "after_arrow", partialText: s };
|
|
294
326
|
if (n.type === "doubleColon")
|
|
@@ -629,9 +661,21 @@ function W(e) {
|
|
|
629
661
|
return D.filter((t) => !e || t.toLowerCase().includes(e.toLowerCase())).map(
|
|
630
662
|
(t, a) => {
|
|
631
663
|
const i = z[t] || { detail: "Field mutator", documentation: "" };
|
|
664
|
+
// Check if this is an enrichment mutator that supports parameters
|
|
665
|
+
const isEnrichment = ENRICHMENT_MUTATORS.includes(t);
|
|
666
|
+
const hasParams = MUTATOR_PARAMETERS[t] && MUTATOR_PARAMETERS[t].length > 0;
|
|
667
|
+
// Enrichment mutators with params get () inserted, cursor inside
|
|
668
|
+
// Enrichment mutators without params get () inserted, cursor after
|
|
669
|
+
// Regular mutators get no parens
|
|
670
|
+
let insertText = t;
|
|
671
|
+
if (isEnrichment && hasParams) {
|
|
672
|
+
insertText = `${t}($1)`;
|
|
673
|
+
} else if (isEnrichment) {
|
|
674
|
+
insertText = `${t}()`;
|
|
675
|
+
}
|
|
632
676
|
return {
|
|
633
677
|
label: t,
|
|
634
|
-
insertText:
|
|
678
|
+
insertText: insertText,
|
|
635
679
|
kind: "mutator",
|
|
636
680
|
detail: i.detail,
|
|
637
681
|
documentation: i.documentation,
|
|
@@ -104,8 +104,7 @@ const U = ["id", "aria-activedescendant"], V = { class: "tql-completion-list" },
|
|
|
104
104
|
role: "listbox",
|
|
105
105
|
"aria-label": "TQL completions",
|
|
106
106
|
"aria-activedescendant": o.items[e.value] ? `${o.id}-option-${e.value}` : void 0,
|
|
107
|
-
onPointerdown: r[0] || (r[0] = A(() => {
|
|
108
|
-
}, ["stop"]))
|
|
107
|
+
onPointerdown: r[0] || (r[0] = A((evt) => { evt.preventDefault(); }, ["stop", "prevent"]))
|
|
109
108
|
}, [
|
|
110
109
|
u("div", V, [
|
|
111
110
|
(l(!0), s(I, null, K(o.items, (n, p) => (l(), s("div", {
|
|
@@ -114,7 +113,7 @@ const U = ["id", "aria-activedescendant"], V = { class: "tql-completion-list" },
|
|
|
114
113
|
class: f(["tql-completion-item", { selected: p === e.value }]),
|
|
115
114
|
role: "option",
|
|
116
115
|
"aria-selected": p === e.value,
|
|
117
|
-
onClick: (E) => a("select", n),
|
|
116
|
+
onClick: (E) => { E.preventDefault(); E.stopPropagation(); a("select", n); },
|
|
118
117
|
onMouseenter: (E) => e.value = p
|
|
119
118
|
}, [
|
|
120
119
|
u("span", {
|