Janne252 / vscode-fontawesome-auto-complete

Auto-complete & preview Font Awesome icons in any language.
https://marketplace.visualstudio.com/items?itemName=Janne252.fontawesome-autocomplete
GNU General Public License v3.0
16 stars 2 forks source link

Suggestions appear at bottom position #15

Closed NahuelVila closed 3 years ago

NahuelVila commented 4 years ago

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.

Janne252 commented 4 years ago

Could you provide a screenshot, please?

Do you know the origin of the other suggestions, i.e. another extension?

NahuelVila commented 4 years ago

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: first_suggestions_without_extensions

"fa-" suggestions placement: icons_suggestions_without_extensions

Suggestions with bootsrap 4 extension and Font Awesome extension: image (note that the filter is being applied to those extensions...)

First suggestions with bootsrap 4 extension and Font Awesome extension: image (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. image

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!

Janne252 commented 4 years ago

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. image

However if I type fa-, I get the following expected auto completion results: image

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: image

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.

Janne252 commented 4 years ago

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.

NahuelVila commented 4 years ago

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".

suggestions_with_extensions_typing_after (comparison of highlighted and not highlighted text ^)

Janne252 commented 4 years ago

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.

Janne252 commented 4 years ago

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.

Janne252 commented 4 years ago

@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.

Janne252 commented 3 years ago

@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"?

NahuelVila commented 3 years ago

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!

NahuelVila commented 3 years ago

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 !

Janne252 commented 3 years ago

Thanks for reporting the issue. I likely wouldn't have become aware of suggestion sorting issues otherwise.