@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/cli/cli.js CHANGED
@@ -92,7 +92,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
92
92
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
93
93
  };
94
94
 
95
- var version = "2.1.27";
95
+ var version = "2.1.28";
96
96
 
97
97
  function getCodeMarker(sourceCodeInfo) {
98
98
  if (!sourceCodeInfo.position || !sourceCodeInfo.code)
@@ -15103,27 +15103,47 @@ var AutoCompleter = /** @class */ (function () {
15103
15103
  };
15104
15104
  AutoCompleter.prototype.generateSuggestions = function (params) {
15105
15105
  var _this = this;
15106
+ var blacklist = new Set(['0_def', '0_defn', '0_fn']);
15107
+ var startsWithCaseSensitive = this.generateWithPredicate(params, function (suggestion) {
15108
+ return !blacklist.has(suggestion) && suggestion.startsWith(_this.searchString);
15109
+ });
15110
+ startsWithCaseSensitive.forEach(function (suggestion) { return blacklist.add(suggestion); });
15111
+ var startsWithCaseInsensitive = this.generateWithPredicate(params, function (suggestion) {
15112
+ return !blacklist.has(suggestion) && suggestion.toLowerCase().startsWith(_this.searchString.toLowerCase());
15113
+ });
15114
+ startsWithCaseInsensitive.forEach(function (suggestion) { return blacklist.add(suggestion); });
15115
+ var includesCaseSensitive = this.generateWithPredicate(params, function (suggestion) {
15116
+ return !blacklist.has(suggestion) && suggestion.includes(_this.searchString);
15117
+ });
15118
+ includesCaseSensitive.forEach(function (suggestion) { return blacklist.add(suggestion); });
15119
+ var includesCaseInsensitive = this.generateWithPredicate(params, function (suggestion) {
15120
+ return !blacklist.has(suggestion) && suggestion.includes(_this.searchString.toLowerCase());
15121
+ });
15122
+ includesCaseInsensitive.forEach(function (suggestion) { return blacklist.add(suggestion); });
15123
+ return __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(startsWithCaseSensitive), false), __read(startsWithCaseInsensitive), false), __read(includesCaseSensitive), false), __read(includesCaseInsensitive), false);
15124
+ };
15125
+ AutoCompleter.prototype.generateWithPredicate = function (params, shouldInclude) {
15106
15126
  var _a, _b, _c, _d;
15107
15127
  var suggestions = new Set();
15108
- litsCommands.forEach(function (name) {
15109
- if (name.startsWith(_this.searchString)) {
15110
- suggestions.add(name);
15128
+ litsCommands.forEach(function (suggestion) {
15129
+ if (shouldInclude(suggestion)) {
15130
+ suggestions.add(suggestion);
15111
15131
  }
15112
15132
  });
15113
15133
  Object.keys((_a = params.globalContext) !== null && _a !== void 0 ? _a : {})
15114
- .filter(function (name) { return name.startsWith(_this.searchString); })
15115
- .forEach(function (name) { return suggestions.add(name); });
15134
+ .filter(shouldInclude)
15135
+ .forEach(function (suggestion) { return suggestions.add(suggestion); });
15116
15136
  (_b = params.contexts) === null || _b === void 0 ? void 0 : _b.forEach(function (context) {
15117
15137
  Object.keys(context)
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
  });
15121
15141
  Object.keys((_c = params.jsFunctions) !== null && _c !== void 0 ? _c : {})
15122
- .filter(function (name) { return name.startsWith(_this.searchString); })
15123
- .forEach(function (name) { return suggestions.add(name); });
15142
+ .filter(shouldInclude)
15143
+ .forEach(function (suggestion) { return suggestions.add(suggestion); });
15124
15144
  Object.keys((_d = params.values) !== null && _d !== void 0 ? _d : {})
15125
- .filter(function (name) { return name.startsWith(_this.searchString); })
15126
- .forEach(function (name) { return suggestions.add(name); });
15145
+ .filter(shouldInclude)
15146
+ .forEach(function (suggestion) { return suggestions.add(suggestion); });
15127
15147
  return __spreadArray([], __read(suggestions), false).sort(function (a, b) { return a.localeCompare(b); });
15128
15148
  };
15129
15149
  return AutoCompleter;
@@ -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
  }
package/dist/index.esm.js CHANGED
@@ -15129,27 +15129,47 @@ var AutoCompleter = /** @class */ (function () {
15129
15129
  };
15130
15130
  AutoCompleter.prototype.generateSuggestions = function (params) {
15131
15131
  var _this = this;
15132
+ var blacklist = new Set(['0_def', '0_defn', '0_fn']);
15133
+ var startsWithCaseSensitive = this.generateWithPredicate(params, function (suggestion) {
15134
+ return !blacklist.has(suggestion) && suggestion.startsWith(_this.searchString);
15135
+ });
15136
+ startsWithCaseSensitive.forEach(function (suggestion) { return blacklist.add(suggestion); });
15137
+ var startsWithCaseInsensitive = this.generateWithPredicate(params, function (suggestion) {
15138
+ return !blacklist.has(suggestion) && suggestion.toLowerCase().startsWith(_this.searchString.toLowerCase());
15139
+ });
15140
+ startsWithCaseInsensitive.forEach(function (suggestion) { return blacklist.add(suggestion); });
15141
+ var includesCaseSensitive = this.generateWithPredicate(params, function (suggestion) {
15142
+ return !blacklist.has(suggestion) && suggestion.includes(_this.searchString);
15143
+ });
15144
+ includesCaseSensitive.forEach(function (suggestion) { return blacklist.add(suggestion); });
15145
+ var includesCaseInsensitive = this.generateWithPredicate(params, function (suggestion) {
15146
+ return !blacklist.has(suggestion) && suggestion.includes(_this.searchString.toLowerCase());
15147
+ });
15148
+ includesCaseInsensitive.forEach(function (suggestion) { return blacklist.add(suggestion); });
15149
+ return __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(startsWithCaseSensitive), false), __read(startsWithCaseInsensitive), false), __read(includesCaseSensitive), false), __read(includesCaseInsensitive), false);
15150
+ };
15151
+ AutoCompleter.prototype.generateWithPredicate = function (params, shouldInclude) {
15132
15152
  var _a, _b, _c, _d;
15133
15153
  var suggestions = new Set();
15134
- litsCommands.forEach(function (name) {
15135
- if (name.startsWith(_this.searchString)) {
15136
- suggestions.add(name);
15154
+ litsCommands.forEach(function (suggestion) {
15155
+ if (shouldInclude(suggestion)) {
15156
+ suggestions.add(suggestion);
15137
15157
  }
15138
15158
  });
15139
15159
  Object.keys((_a = params.globalContext) !== null && _a !== void 0 ? _a : {})
15140
- .filter(function (name) { return name.startsWith(_this.searchString); })
15141
- .forEach(function (name) { return suggestions.add(name); });
15160
+ .filter(shouldInclude)
15161
+ .forEach(function (suggestion) { return suggestions.add(suggestion); });
15142
15162
  (_b = params.contexts) === null || _b === void 0 ? void 0 : _b.forEach(function (context) {
15143
15163
  Object.keys(context)
15144
- .filter(function (name) { return name.startsWith(_this.searchString); })
15145
- .forEach(function (name) { return suggestions.add(name); });
15164
+ .filter(shouldInclude)
15165
+ .forEach(function (suggestion) { return suggestions.add(suggestion); });
15146
15166
  });
15147
15167
  Object.keys((_c = params.jsFunctions) !== null && _c !== void 0 ? _c : {})
15148
- .filter(function (name) { return name.startsWith(_this.searchString); })
15149
- .forEach(function (name) { return suggestions.add(name); });
15168
+ .filter(shouldInclude)
15169
+ .forEach(function (suggestion) { return suggestions.add(suggestion); });
15150
15170
  Object.keys((_d = params.values) !== null && _d !== void 0 ? _d : {})
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
  return __spreadArray([], __read(suggestions), false).sort(function (a, b) { return a.localeCompare(b); });
15154
15174
  };
15155
15175
  return AutoCompleter;