提交 14aa8e71 编写于 作者: J Johannes Rieken

fix #16380

上级 5e78562e
......@@ -122,7 +122,7 @@ export class CompletionModel {
// differnet word, but in practice not - that's why we cache
const wordLen = suggestion.overwriteBefore + characterCountDelta - (item.position.column - this._column);
if (word.length !== wordLen) {
word = leadingLineContent.slice(-wordLen);
word = wordLen === 0 ? '' : leadingLineContent.slice(-wordLen);
}
let match = false;
......
......@@ -148,4 +148,27 @@ suite('CompletionModel', function () {
// dupe, issue #14942
assertTopScore('is', 0, 'isValidViewletId', 'import statement');
});
test('proper current word when length=0, #16380', function () {
model = new CompletionModel([
createSuggestItem(' </div', 4),
createSuggestItem('a', 0),
createSuggestItem('p', 0),
createSuggestItem(' </tag', 4),
createSuggestItem(' XYZ', 4),
], 1, {
leadingLineContent: ' <',
characterCountDelta: 0
});
assert.equal(model.items.length, 4);
const [a, b, c, d] = model.items;
assert.equal(a.suggestion.label, ' </div');
assert.equal(b.suggestion.label, 'a');
assert.equal(c.suggestion.label, 'p');
assert.equal(d.suggestion.label, ' </tag');
});
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册