提交 115ab2d6 编写于 作者: J Johannes Rieken

fix #49895

上级 be10a116
......@@ -106,13 +106,16 @@ export class CompletionModel {
adopt(except: Set<ISuggestSupport>): ISuggestionItem[] {
let res = new Array<ISuggestionItem>();
for (let i = 0; i < this._items.length; i++) {
for (let i = 0; i < this._items.length;) {
if (!except.has(this._items[i].support)) {
res.push(this._items[i]);
// unordered removed
this._items[i] = this._items[this._items.length - 1];
this._items.pop();
} else {
// continue with next item
i++;
}
}
this._refilterKind = Refilter.All;
......
......@@ -107,6 +107,35 @@ suite('CompletionModel', function () {
assert.ok(complete[0] === completeItem);
});
test('Fuzzy matching of snippets stopped working with inline snippet suggestions #49895', function () {
const completeItem1 = createSuggestItem('foobar1', 1, undefined, false, { lineNumber: 1, column: 2 });
const completeItem2 = createSuggestItem('foobar2', 1, undefined, false, { lineNumber: 1, column: 2 });
const completeItem3 = createSuggestItem('foobar3', 1, undefined, false, { lineNumber: 1, column: 2 });
const completeItem4 = createSuggestItem('foobar4', 1, undefined, false, { lineNumber: 1, column: 2 });
const completeItem5 = createSuggestItem('foobar5', 1, undefined, false, { lineNumber: 1, column: 2 });
const incompleteItem1 = createSuggestItem('foofoo1', 1, undefined, true, { lineNumber: 1, column: 2 });
const model = new CompletionModel(
[
completeItem1,
completeItem2,
completeItem3,
completeItem4,
completeItem5,
incompleteItem1,
], 2, { leadingLineContent: 'f', characterCountDelta: 0 }
);
assert.equal(model.incomplete.size, 1);
assert.equal(model.items.length, 6);
const { incomplete } = model;
const complete = model.adopt(incomplete);
assert.equal(incomplete.size, 1);
assert.ok(incomplete.has(incompleteItem1.support));
assert.equal(complete.length, 5);
});
test('proper current word when length=0, #16380', function () {
model = new CompletionModel([
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册