@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.
@@ -20,4 +20,5 @@ export declare class AutoCompleter {
20
20
  getSuggestions(): string[];
21
21
  getSearchString(): string;
22
22
  private generateSuggestions;
23
+ private generateWithPredicate;
23
24
  }
@@ -15096,27 +15096,47 @@ var AutoCompleter = /** @class */ (function () {
15096
15096
  };
15097
15097
  AutoCompleter.prototype.generateSuggestions = function (params) {
15098
15098
  var _this = this;
15099
+ var blacklist = new Set(['0_def', '0_defn', '0_fn']);
15100
+ var startsWithCaseSensitive = this.generateWithPredicate(params, function (suggestion) {
15101
+ return !blacklist.has(suggestion) && suggestion.startsWith(_this.searchString);
15102
+ });
15103
+ startsWithCaseSensitive.forEach(function (suggestion) { return blacklist.add(suggestion); });
15104
+ var startsWithCaseInsensitive = this.generateWithPredicate(params, function (suggestion) {
15105
+ return !blacklist.has(suggestion) && suggestion.toLowerCase().startsWith(_this.searchString.toLowerCase());
15106
+ });
15107
+ startsWithCaseInsensitive.forEach(function (suggestion) { return blacklist.add(suggestion); });
15108
+ var includesCaseSensitive = this.generateWithPredicate(params, function (suggestion) {
15109
+ return !blacklist.has(suggestion) && suggestion.includes(_this.searchString);
15110
+ });
15111
+ includesCaseSensitive.forEach(function (suggestion) { return blacklist.add(suggestion); });
15112
+ var includesCaseInsensitive = this.generateWithPredicate(params, function (suggestion) {
15113
+ return !blacklist.has(suggestion) && suggestion.includes(_this.searchString.toLowerCase());
15114
+ });
15115
+ includesCaseInsensitive.forEach(function (suggestion) { return blacklist.add(suggestion); });
15116
+ return __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(startsWithCaseSensitive), false), __read(startsWithCaseInsensitive), false), __read(includesCaseSensitive), false), __read(includesCaseInsensitive), false);
15117
+ };
15118
+ AutoCompleter.prototype.generateWithPredicate = function (params, shouldInclude) {
15099
15119
  var _a, _b, _c, _d;
15100
15120
  var suggestions = new Set();
15101
- litsCommands.forEach(function (name) {
15102
- if (name.startsWith(_this.searchString)) {
15103
- suggestions.add(name);
15121
+ litsCommands.forEach(function (suggestion) {
15122
+ if (shouldInclude(suggestion)) {
15123
+ suggestions.add(suggestion);
15104
15124
  }
15105
15125
  });
15106
15126
  Object.keys((_a = params.globalContext) !== null && _a !== void 0 ? _a : {})
15107
- .filter(function (name) { return name.startsWith(_this.searchString); })
15108
- .forEach(function (name) { return suggestions.add(name); });
15127
+ .filter(shouldInclude)
15128
+ .forEach(function (suggestion) { return suggestions.add(suggestion); });
15109
15129
  (_b = params.contexts) === null || _b === void 0 ? void 0 : _b.forEach(function (context) {
15110
15130
  Object.keys(context)
15111
- .filter(function (name) { return name.startsWith(_this.searchString); })
15112
- .forEach(function (name) { return suggestions.add(name); });
15131
+ .filter(shouldInclude)
15132
+ .forEach(function (suggestion) { return suggestions.add(suggestion); });
15113
15133
  });
15114
15134
  Object.keys((_c = params.jsFunctions) !== null && _c !== void 0 ? _c : {})
15115
- .filter(function (name) { return name.startsWith(_this.searchString); })
15116
- .forEach(function (name) { return suggestions.add(name); });
15135
+ .filter(shouldInclude)
15136
+ .forEach(function (suggestion) { return suggestions.add(suggestion); });
15117
15137
  Object.keys((_d = params.values) !== null && _d !== void 0 ? _d : {})
15118
- .filter(function (name) { return name.startsWith(_this.searchString); })
15119
- .forEach(function (name) { return suggestions.add(name); });
15138
+ .filter(shouldInclude)
15139
+ .forEach(function (suggestion) { return suggestions.add(suggestion); });
15120
15140
  return __spreadArray([], __read(suggestions), false).sort(function (a, b) { return a.localeCompare(b); });
15121
15141
  };
15122
15142
  return AutoCompleter;