-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
when writing a new CompletionItemProvider it is very hard debug as to why the item is not being offered #41022
Comments
Yeah, I was thinking about something similar a while back. We could always show all items, without sorting or filtering, and then show their assigned rank and the word that have been matched against... |
Is there a way to start to understand what VS Code is doing? I have a situation with a custom extension where we're providing completions for after an
And if the user then types an
And highlights the It might well be something that we're doing but I can't understand it from our perspective. The completions only seem to be asked for once and then the narrowing down with addition keypresses seems to be down by VS Code so it seems that VS Code is matching after the underscore instead of the start. Of course, general completions don't seem to be doing that but I am struggling to understand why this one would be. I would welcome any information. Perhaps there is a bit of the code base where the narrowing is done that I might try to understand? |
Sorry, as ever, you figure it out after posting for help. I didn't have the |
Shout to this related (may duplicated) issue that is actually implemented since a while: #75500 There is the "explain mode" for suggest. Do this
You will see something similar to the screen shot below:
What's not implemented is a way to get this information for items that aren't showing in suggest, e.g those that have been filtered out because no match has been computed. |
Hi, can you provide example on the |
I've not worked on that code for a while now. Here is a slice of it: // If the string before the completion ends in an '&' then we assume that the characters that the user is typing to
// match against the label do not include the initial '&' so we make sure not to include it in the filtering and
// insert logic
const filterTextIncludesAmp = !before?.endsWith('&');
return labels.map((l) => {
const ampersandLabel = `&${l.label}`;
const completion = new vscode.CompletionItem(
ampersandLabel,
vscode.CompletionItemKind.Class
);
if (!filterTextIncludesAmp) {
// Handle completion based off the label name without the initial '&' as that '&' is already in the
// document. We want to include the '&' in the labels though as it is clearer for users what they are
// completing.
completion.filterText = l.label;
} Where I guess the main completion value should include the |
Whenever I try to write a new CompletionItemProvider, I always have to bang my head against the table many times because there are many rules which hide your item from the completion menu.
I get that these rules are needed, but it is often frustrating for a developer to just see his completion items disappear. Could we get some kind of
debug
mode for CompletionItemProvider so that we can more easily see what is going on with our Completion items?It would be great to have it something like:
then VSCode would log all reasons why any completion item from this provider was hidden.
Could we have this feature please?
The text was updated successfully, but these errors were encountered: