Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[completion] CompletionList#isIncomplete ignored on empty or fully filtered items #13735

Closed
svenefftinge opened this issue Oct 14, 2016 · 3 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug *out-of-scope Posted issue is not in scope of VS Code suggest IntelliSense, Auto Complete

Comments

@svenefftinge
Copy link

svenefftinge commented Oct 14, 2016

  • VSCode Version: 1.6.1

When a CompletionList returns an empty array of items but has set isIncomplete: true, the content proposal provider is not asked again on further typing.

I think it is because
https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/suggest/common/completionModel.ts#L167
is not reached if no item exists or all items are filtered.

Is this intentional?

It can be reproduced easily with monaco's playground:
https://microsoft.github.io/monaco-editor/playground.html#extending-language-services-completion-provider-example

Paste the following snippet into it:

function createDependencyProposals(contents) {
    if (contents.length%4 === 0) {
        return {
            isIncomplete: true,
            items: []
        }
    }
    return {
        isIncomplete: true,
        items: [
            {
                label: contents + "!!",
                kind: monaco.languages.CompletionItemKind.Function,
                documentation: contents + "!!",
                insertText: contents + "!!"
            }
        ]
    };
}


monaco.languages.registerCompletionItemProvider('json', {
    provideCompletionItems: function(model, position) {
        // find out if we are completing a property in the 'dependencies' object.
        var textUntilPosition = model.getValueInRange({startLineNumber: 1, startColumn: 1, endLineNumber: position.lineNumber, endColumn: position.column});
        return createDependencyProposals(textUntilPosition);
    }
});

monaco.editor.create(document.getElementById("container"), {
    value: "",
    language: "json"
});
@jrieken
Copy link
Member

jrieken commented Oct 14, 2016

An empty result is considered no result and doesn't even make it into the view model - so, yes that is that is on purpose.

Incomplete but not empty lists will trigger the ask-again-on-type-logic if the very first time the result-set wasn't filtered to empty. I think that is fair because completions should always match the current line value before the position.

@svenefftinge
Copy link
Author

The problem is that if I use the isIncomplete mode, to return different results based on the offset and prefix and there is a position that returns nothing, I don't get retriggered in that same context anymore. E.g. I have a prefix of i where completion returns two elements, then I type s which retriggers, because previous was set toisIncomplete, now I type another character, retriggering happens again and the result is empty. If I now press backspace I no longer get proposals, because VSCode has forgotten about the 'isIncomplete' flag but treats it as the same context.

@jrieken jrieken added suggest IntelliSense, Auto Complete under-discussion Issue is under discussion for relevance, priority, approach labels Apr 21, 2017
@jrieken jrieken added bug Issue identified by VS Code Team member as probable bug and removed under-discussion Issue is under discussion for relevance, priority, approach labels Sep 11, 2018
@jrieken jrieken added the *out-of-scope Posted issue is not in scope of VS Code label Sep 20, 2018
@vscodebot
Copy link

vscodebot bot commented Sep 20, 2018

This iteration we focus on issue grooming. This issue is being closed to keep the number of issues in our inbox on a manageable level, we are closing issues that are not going to be addressed in the foreseeable future: We look at the number of votes the issue has received and the number of duplicate issues filed. More details here. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider.

If you wonder what we are up to, please see our roadmap and issue reporting guidelines.

Thanks for your understanding and happy coding!

@vscodebot vscodebot bot closed this as completed Sep 20, 2018
ckant added a commit to aws/aws-toolkit-vscode that referenced this issue Jul 21, 2020
The snippets are matched by (case-insensitive) prefix
Snippets are only shown if one of the following is true:
  - The first word of the prefix is >= 3 chars and 3 chars of the first word have been typed (foo matches foobar).
  - The first word of the prefix is < 3 chars and the entire first word has been typed (e.g. s3 matches s3).

Caveat: VSCode requires at least 1 snippet to be shown in order for snippets to be shown after more text is typed.
Therefore, if only 1 or 2 chars are typed that match (but don't complete) the first word of the prefix,
1 snippet will always be shown.

See microsoft/vscode#13735
puuuuh pushed a commit to puuuuh/crates that referenced this issue Dec 17, 2021
We need to return non-empty completion list for update the results
microsoft/vscode#13735
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug *out-of-scope Posted issue is not in scope of VS Code suggest IntelliSense, Auto Complete
Projects
None yet
Development

No branches or pull requests

2 participants