提交 37ebb445 编写于 作者: J Johannes Rieken

re-trigger completions when typing into a new word,...

re-trigger completions when typing into a new word, https://github.com/microsoft/vscode/issues/99504
上级 5e4f1b08
......@@ -556,6 +556,12 @@ export class SuggestModel implements IDisposable {
return;
}
if (ctx.leadingWord.word.length !== 0 && ctx.leadingWord.startColumn > this._context.leadingWord.startColumn) {
// started a new word while IntelliSense shows -> retrigger
this.trigger({ auto: this._context.auto, shy: false }, true);
return;
}
if (ctx.column > this._context.column && this._completionModel.incomplete.size > 0 && ctx.leadingWord.word.length !== 0) {
// typed -> moved cursor RIGHT & incomple model & still on a word -> retrigger
const { incomplete } = this._completionModel;
......
......@@ -794,12 +794,15 @@ suite('SuggestModel - TriggerAndCancelOracle', function () {
test('Trigger (full) completions when (incomplete) completions are already active #99504', function () {
this.skip();
let countA = 0;
let countB = 0;
disposables.push(CompletionProviderRegistry.register({ scheme: 'test' }, {
provideCompletionItems(doc, pos) {
countA += 1;
return {
incomplete: true,
incomplete: false, // doesn't matter if incomplete or not
suggestions: [{
kind: CompletionItemKind.Class,
label: 'Z aaa',
......@@ -811,6 +814,7 @@ suite('SuggestModel - TriggerAndCancelOracle', function () {
}));
disposables.push(CompletionProviderRegistry.register({ scheme: 'test' }, {
provideCompletionItems(doc, pos) {
countB += 1;
return {
incomplete: false,
suggestions: [{
......@@ -845,6 +849,9 @@ suite('SuggestModel - TriggerAndCancelOracle', function () {
assert.equal(event.completionModel.items.length, 2);
assert.equal(event.completionModel.items[0].textLabel, 'Z aaa');
assert.equal(event.completionModel.items[1].textLabel, 'aaa');
assert.equal(countA, 2); // should we keep the suggestions from the "active" provider?
assert.equal(countB, 2);
});
});
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册