@mojir/lits 2.1.27 → 2.1.28

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/lits.iife.js CHANGED
@@ -15132,27 +15132,47 @@ var Lits = (function (exports) {
15132
15132
  };
15133
15133
  AutoCompleter.prototype.generateSuggestions = function (params) {
15134
15134
  var _this = this;
15135
+ var blacklist = new Set(['0_def', '0_defn', '0_fn']);
15136
+ var startsWithCaseSensitive = this.generateWithPredicate(params, function (suggestion) {
15137
+ return !blacklist.has(suggestion) && suggestion.startsWith(_this.searchString);
15138
+ });
15139
+ startsWithCaseSensitive.forEach(function (suggestion) { return blacklist.add(suggestion); });
15140
+ var startsWithCaseInsensitive = this.generateWithPredicate(params, function (suggestion) {
15141
+ return !blacklist.has(suggestion) && suggestion.toLowerCase().startsWith(_this.searchString.toLowerCase());
15142
+ });
15143
+ startsWithCaseInsensitive.forEach(function (suggestion) { return blacklist.add(suggestion); });
15144
+ var includesCaseSensitive = this.generateWithPredicate(params, function (suggestion) {
15145
+ return !blacklist.has(suggestion) && suggestion.includes(_this.searchString);
15146
+ });
15147
+ includesCaseSensitive.forEach(function (suggestion) { return blacklist.add(suggestion); });
15148
+ var includesCaseInsensitive = this.generateWithPredicate(params, function (suggestion) {
15149
+ return !blacklist.has(suggestion) && suggestion.includes(_this.searchString.toLowerCase());
15150
+ });
15151
+ includesCaseInsensitive.forEach(function (suggestion) { return blacklist.add(suggestion); });
15152
+ return __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(startsWithCaseSensitive), false), __read(startsWithCaseInsensitive), false), __read(includesCaseSensitive), false), __read(includesCaseInsensitive), false);
15153
+ };
15154
+ AutoCompleter.prototype.generateWithPredicate = function (params, shouldInclude) {
15135
15155
  var _a, _b, _c, _d;
15136
15156
  var suggestions = new Set();
15137
- litsCommands.forEach(function (name) {
15138
- if (name.startsWith(_this.searchString)) {
15139
- suggestions.add(name);
15157
+ litsCommands.forEach(function (suggestion) {
15158
+ if (shouldInclude(suggestion)) {
15159
+ suggestions.add(suggestion);
15140
15160
  }
15141
15161
  });
15142
15162
  Object.keys((_a = params.globalContext) !== null && _a !== void 0 ? _a : {})
15143
- .filter(function (name) { return name.startsWith(_this.searchString); })
15144
- .forEach(function (name) { return suggestions.add(name); });
15163
+ .filter(shouldInclude)
15164
+ .forEach(function (suggestion) { return suggestions.add(suggestion); });
15145
15165
  (_b = params.contexts) === null || _b === void 0 ? void 0 : _b.forEach(function (context) {
15146
15166
  Object.keys(context)
15147
- .filter(function (name) { return name.startsWith(_this.searchString); })
15148
- .forEach(function (name) { return suggestions.add(name); });
15167
+ .filter(shouldInclude)
15168
+ .forEach(function (suggestion) { return suggestions.add(suggestion); });
15149
15169
  });
15150
15170
  Object.keys((_c = params.jsFunctions) !== null && _c !== void 0 ? _c : {})
15151
- .filter(function (name) { return name.startsWith(_this.searchString); })
15152
- .forEach(function (name) { return suggestions.add(name); });
15171
+ .filter(shouldInclude)
15172
+ .forEach(function (suggestion) { return suggestions.add(suggestion); });
15153
15173
  Object.keys((_d = params.values) !== null && _d !== void 0 ? _d : {})
15154
- .filter(function (name) { return name.startsWith(_this.searchString); })
15155
- .forEach(function (name) { return suggestions.add(name); });
15174
+ .filter(shouldInclude)
15175
+ .forEach(function (suggestion) { return suggestions.add(suggestion); });
15156
15176
  return __spreadArray([], __read(suggestions), false).sort(function (a, b) { return a.localeCompare(b); });
15157
15177
  };
15158
15178
  return AutoCompleter;