Repository navigation
Promote snippets over other suggestions - #5121
Stanislav Sysoev (d4rkr00t) wants to merge 1 commit into
Conversation
|
Hi Stanislav Sysoev (@d4rkr00t), I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution! TTYL, MSBOT; |
|
Stanislav Sysoev (@d4rkr00t), Thanks for signing the contribution license agreement so quickly! Actual humans will now validate the agreement and then evaluate the PR. |
450eb8f to
c565c26
Compare
c565c26 to
57c80ae
Compare
|
Thank you Stanislav Sysoev (@d4rkr00t) for that PR! ❤️ I really hope this gets merged soon. |
|
te (@te1) glad to here that you find it useful. |
|
I’d hate this for CSS. The snippets are almost never what I want to use, especially when completing CSS values (the predefined are all properties), so this would worsen the user experience. |
|
In CSS it's usually more convenient to use emmet shortcuts then autocompletion. But in JS it's so annoying that you have to type things again and again. Especially things like However with last vscode update it became better, I don't know why. But now, in maybe half cases, vscode suggests me snippets, but not always. Example down below: |
|
Sorry I didn't reply earlier on this PR, I was on vacation for a couple of weeks. I think Johannes Rieken (@jrieken) owns the experience in this area more than I do. |
|
It's okay. Vacation is important :) |
|
Very unlikely that we merge this. As already mentioned people are very sensitive to this and changing the sort order to boost snippets isn't what everyone wants. I can think of a special command that only suggest snippets or an extension that does that. |
|
I tend to agree that there will be situations where you don't want snippets to show up first in the suggestion list (e.g. CSS). Still every other editor in recent memory I tried is more productive for me when using snippets because it works as I would expect. Sublime Text has the concept of a tab trigger that activates if you press tab and the sequence of letters matches exactly. VS Code's prefix is more like a name for the snippet that is used to place it somewhere appropriate in the suggestion list along with all the other names (keywords, symbols, ...). If your prefix is long and unique there is no problem. But if your prefix is short and similar or even identical to other names there is a good chance you have to manually select the snippet from the suggestion list which for me reduces productivity immensely. Example: In an empty JavaScript file write This PR basically implements the tab trigger mechanism but has the side effect that the suggestion list priorities are changed as well. Maybe there is a way to implement the tab trigger in addition to the existing suggestion list approach and make it optional? A special command probably wouldn't work for me because I still want to invoke both snippet insertion and code completion by pressing tab. I would prefer a built in solution for this common problem but would be fine with an extension as well. My understanding of the VS Code extension API is unfortunately very limited so I can't even tell if an extension would be able to do what I want. I realize there are different opinions on this topic but this is a real pain point for me. Other editors appear to have solved this in a way that makes most users happy. |
|
Johannes Rieken (@jrieken) I see. It's ok :) Idea about extension sounds great to me. I'll definitely try to implement it. I'm not sure if I can get all snippets for current language inside extension, but I'll find out :). Moreover a special command wouldn't be convenient way for me, I would prefer to use tab trigger. Because, in my opinion, it should be the same mechanism as in suggestions and should work seamlessly to other editors. |
|
Just a quick note about this PR: It only promotes snippets to the top if there is an exact match between what has been typed and the prefix for a certain snippet from what I understand. This is not made clear in the description. Instead it sounds like all snippets are given priority all the time which would indeed bother some people. So in the end this PR is not as invasive as it may seem. Just something to consider before a final decision is made. |
|
It actually changes order of suggestions https://github.com/Microsoft/vscode/pull/5121/files#diff-518e736f78c3288400a5d064bb875c59L71. But I can remove this code and It'll still work and than there is no need to change tests. |
|
I will bring this up in the team discussion and then we'll see how we go forward. Snippets mixed with suggestions is a point of discussion. Expect a little delay cos public holiday and long weekend is around the corner. |
|
Just wating for this PR merged ❤️ |
|
Johannes Rieken (@jrieken) for me the ordering of the suggestions is mostly not useful when I'm writing react code. For example, I write Can we have a better listing which learns by usage and is atleast 80% useful, rather than a fixed list which is not so useful? |
|
Johannes Rieken (@jrieken) perhaps a configurable option to always have them on top/bottom/auto would satisfy everyone? |
|
yes - it might something like that in the end |
|
We will tackle this in #9286. Closing this PR in favour of configuration options for snippets, like |
|
Wow, great 👍 |
|
Everyone, please feel free to provide feedback for
Thanks |



What do you think about promoting snippets over other suggestions?
I think it might be useful because:
Examples:
Current behaviour:

After changes from pull request:

Atom for comparison:

Possibly issue in another place:
Because in empty file snippets already in the most top of suggestions:

I've tested in:
Code 0.10.14-insider, 0.10.11 (stable) and manual build from master branch.
OSX: 10.11.3