@mojir/dvala 0.0.28 → 0.0.29
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/cli/cli.js +32 -1
- package/package.json +1 -1
package/dist/cli/cli.js
CHANGED
|
@@ -478,7 +478,7 @@ function findAllOccurrences(input, pattern) {
|
|
|
478
478
|
}
|
|
479
479
|
//#endregion
|
|
480
480
|
//#region package.json
|
|
481
|
-
var version = "0.0.
|
|
481
|
+
var version = "0.0.29";
|
|
482
482
|
//#endregion
|
|
483
483
|
//#region src/typeGuards/string.ts
|
|
484
484
|
function isString(value, options = {}) {
|
|
@@ -26010,10 +26010,12 @@ const dvalaCommands = new Set([
|
|
|
26010
26010
|
...specialExpressionKeys,
|
|
26011
26011
|
...Object.keys(reservedSymbolRecord)
|
|
26012
26012
|
]);
|
|
26013
|
+
const DOT_PREFIX_RE = /((?:[a-zA-Z][a-zA-Z0-9_-]*\.)+)$/;
|
|
26013
26014
|
var AutoCompleter = class {
|
|
26014
26015
|
prefixProgram = "";
|
|
26015
26016
|
suffixProgram = "";
|
|
26016
26017
|
searchString = "";
|
|
26018
|
+
dotPrefix = "";
|
|
26017
26019
|
suggestions = [];
|
|
26018
26020
|
suggestionIndex = null;
|
|
26019
26021
|
constructor(originalProgram, originalPosition, params = {}) {
|
|
@@ -26026,6 +26028,12 @@ var AutoCompleter = class {
|
|
|
26026
26028
|
this.prefixProgram = this.originalProgram.slice(0, this.originalPosition - this.searchString.length);
|
|
26027
26029
|
this.suffixProgram = this.originalProgram.slice(this.prefixProgram.length + this.searchString.length);
|
|
26028
26030
|
this.originalProgram.slice(this.prefixProgram.length + this.searchString.length);
|
|
26031
|
+
if (lastToken[0] === "Operator" && this.searchString === ".") {
|
|
26032
|
+
this.prefixProgram = this.originalProgram.slice(0, this.originalPosition);
|
|
26033
|
+
this.suffixProgram = this.originalProgram.slice(this.originalPosition);
|
|
26034
|
+
this.searchString = "";
|
|
26035
|
+
}
|
|
26036
|
+
this.dotPrefix = DOT_PREFIX_RE.exec(this.prefixProgram)?.[1] ?? "";
|
|
26029
26037
|
this.suggestions = this.generateSuggestions(params);
|
|
26030
26038
|
}
|
|
26031
26039
|
getNextSuggestion() {
|
|
@@ -26067,6 +26075,8 @@ var AutoCompleter = class {
|
|
|
26067
26075
|
}
|
|
26068
26076
|
generateSuggestions(params) {
|
|
26069
26077
|
const blacklist = new Set(["0_defn", "0_lambda"]);
|
|
26078
|
+
const fullSearch = this.dotPrefix + this.searchString;
|
|
26079
|
+
if (this.dotPrefix) return this.generateDottedEffectSuggestions(params.effectNames ?? [], fullSearch);
|
|
26070
26080
|
const startsWithCaseSensitive = this.generateWithPredicate(params, (suggestion) => !blacklist.has(suggestion) && suggestion.startsWith(this.searchString));
|
|
26071
26081
|
startsWithCaseSensitive.forEach((suggestion) => blacklist.add(suggestion));
|
|
26072
26082
|
const startsWithCaseInsensitive = this.generateWithPredicate(params, (suggestion) => !blacklist.has(suggestion) && suggestion.toLowerCase().startsWith(this.searchString.toLowerCase()));
|
|
@@ -26082,12 +26092,33 @@ var AutoCompleter = class {
|
|
|
26082
26092
|
...includesCaseInsensitive
|
|
26083
26093
|
];
|
|
26084
26094
|
}
|
|
26095
|
+
generateDottedEffectSuggestions(effectNames, fullSearch) {
|
|
26096
|
+
const seen = /* @__PURE__ */ new Set();
|
|
26097
|
+
const results = [];
|
|
26098
|
+
const predicates = [
|
|
26099
|
+
(name) => name.startsWith(fullSearch),
|
|
26100
|
+
(name) => name.toLowerCase().startsWith(fullSearch.toLowerCase()),
|
|
26101
|
+
(name) => name.includes(fullSearch),
|
|
26102
|
+
(name) => name.toLowerCase().includes(fullSearch.toLowerCase())
|
|
26103
|
+
];
|
|
26104
|
+
for (const pred of predicates) for (const name of effectNames) {
|
|
26105
|
+
const insertText = name.slice(this.dotPrefix.length);
|
|
26106
|
+
if (insertText && !seen.has(insertText) && pred(name)) {
|
|
26107
|
+
results.push(insertText);
|
|
26108
|
+
seen.add(insertText);
|
|
26109
|
+
}
|
|
26110
|
+
}
|
|
26111
|
+
return results;
|
|
26112
|
+
}
|
|
26085
26113
|
generateWithPredicate(params, shouldInclude) {
|
|
26086
26114
|
const suggestions = /* @__PURE__ */ new Set();
|
|
26087
26115
|
dvalaCommands.forEach((suggestion) => {
|
|
26088
26116
|
if (shouldInclude(suggestion)) suggestions.add(suggestion);
|
|
26089
26117
|
});
|
|
26090
26118
|
Object.keys(params.bindings ?? {}).filter(shouldInclude).forEach((suggestion) => suggestions.add(suggestion));
|
|
26119
|
+
params.effectNames?.forEach((name) => {
|
|
26120
|
+
if (shouldInclude(name)) suggestions.add(name);
|
|
26121
|
+
});
|
|
26091
26122
|
return [...suggestions].sort((a, b) => a.localeCompare(b));
|
|
26092
26123
|
}
|
|
26093
26124
|
};
|
package/package.json
CHANGED