Closed NahuelVila closed 3 years ago
Could you provide a screenshot, please?
Do you know the origin of the other suggestions, i.e. another extension?
This happens without any other extension but happens even worse if there are any other extension installed. Every other suggestion appears before the "fa-" suggestions, as if those suggestions are not being filtered at all, even though the other extensions sugestions are being filtered.
No other extensions first suggestions:
"fa-" suggestions placement:
Suggestions with bootsrap 4 extension and Font Awesome extension: (note that the filter is being applied to those extensions...)
First suggestions with bootsrap 4 extension and Font Awesome extension: (while "fa-" suggestions are not being filtered and appear after the same suggestions as when using no other extensions)
I just found out in the testing process that you can make appear the correct suggestions first by pressing "ctrl + space" before typing "fa-", though any other extension suggestion will appear before the "fa-" suggestions, as long as they have at least a single character in common with "fa-", which is unfortunate since almost all sugestions have a "-" character.
Anyways, I suppose this was not the intended method since the usage explanation says:
"Default usage Type "fa-" (without quotes) to start auto-completing icons. If the icon preview is not showing up (as shown in the GIFs below), press Ctrl+Space (default hotkey) or press the "Read More..." button to expand the details view."
Thank you for the fast answer!
The issue seems to partially reproduce with the PHP intellisense extension if I press Ctrl+Space
.
It would seem the PHP intellisense extension provides all globals even when not inside of a php block.
However if I type fa-
, I get the following expected auto completion results:
I haven't looked into how completion items are ordered, but in this case I'd assume the PHP symbols, like variables and functions have a higher internal priority than what I use for the icons; Reference
.
It would seem that setting the completion item type to Text
and setting the sortText
to $0
I was able to get the items to appear before PHP Intellisense:
I think I'm going to have to check the vscode related to sorting the completion items. this extension only activates and provides suggestions if the context as the trigger word (defaults to fa-
), meaning that artificially increasing the importance of the completion items of this extension shouldn't cause too much friction. Could be a user setting, enabled by default.
I'm marking this as an enhancement because I suspect the PHP Intellisense extension is providing its suggestions too aggressively. Combination of completionItemKind
and sortText
seems to allow overriding PHP intellisense.
However https://marketplace.visualstudio.com/items?itemName=thekalinga.bootstrap4-vscode requires checking how the completion items are ordered. I can't seem to be able to artificially increase the importance of the completion items provided by this extension to appear before the snippets.
But, if it's only PHP Intellisense (which I tried to disable to test but seemed useless, even after restarting), why does other extensions snippets also appear before this extension suggestions? Even when filtering with "ctrl + space", characters matching "fa-" search are highlighted with a blue font, but this extension suggestions are not. That's very suspicious, as I can see that they actually have to be highlighted in your extension page example ".gif".
(comparison of highlighted and not highlighted text ^)
I meant that I already found a way of artificially getting a higher priority over PHP Intellisense.
It's the snippets from the other extension as shown in your screenshot that seems to get a higher priority over completion item providers.
I'm not sure if you're familiar with vscode extensions, but basically the snippets originate from static YML/JSON files in an extension whereas this extension provides suggestions programmatically by checking the current word at the caret position.
However I'm able to reproduce the issue with the https://marketplace.visualstudio.com/items?itemName=thekalinga.bootstrap4-vscode extension (assuming it's the one you're also using). It's enough to start figuring this out.
@NahuelVila Version 1.0.2 of the extension is now available. I've added instructions to the readme regarding autocompletion items being at the bottom of the list. Could you give that a try, please?
Also I'd like to hear if setting editor.snippetSuggestions
to "bottom"
makes it more difficult to use the other extension.
@NahuelVila Hey, have you had a chance to try the new version & instructions regarding "Autocompletion suggestions of this extension appear at the end of the list"?
Hi! Sorry @Janne252 . I had to stop working with the project I was using this plugin with so I didn't think about checking this. I'll give it a try as soon as I can. Thank you!
Ok, I tested it and it works nicely. I had to change editor.snippetSuffestions to bottom, it was not enough the "Elevated Sort Priority" option. It doesn't seem to affect much the other extensions that I use. Maybe there are some times that I need to be a little more specific for the wanted snippet to appear, but at least in my case is not different from what I was already doing so, it's not a big problem at all. Instead, it makes your extension work beautifuly, I'd mark this issue as closed, thank you for your quick work @Janne252 !
Thanks for reporting the issue. I likely wouldn't have become aware of suggestion sorting issues otherwise.
I just can't get to make good use of this extension because typing "fa-" suggest almost every other snippet instead of this extension suggestions. What can I do to get them to apear at the top? Thank you.