-
Notifications
You must be signed in to change notification settings - Fork 29.4k
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
[snippets] Cannot override/disable snippets defined in extensions #10565
Comments
I was just wondering this too. Seems like you can't turn off languages at all. I want to disable javascript snippets, and the language features (like suggestions, hover, etc.) from typescript, so I can run my own language service for javascript. I'd still want to keep the syntax though. |
IMO the best is if snippets are contributed by separate external extensions, so it's possible to uninstall them. |
Sometimes you don't want to shutdown all snippet suggestion, but just override some of them, like the "cw" for C#. the default will write « System.Console.WriteLine(""); », i would like « Console.WriteLine("") », i perfectly know the the first one will work with a charm, but i just LIKE the second syntax, but when i add a snippet it's show 2 suggestion with the same prefix and that is confusing. We know, we are picky, but we like to have to possibilities to custom our editor at our taste. |
I'm using JavaScript snippets extension and I always see 2 |
Also, some snippets just make no sense at all. For example, the for (var index = 0; index < array.length; index++) {
var element = array[index];
} I... I don't even...
I support the above request. Please, either make built-in snippets overridable, or nuke them, and let users create their own, without having to put up with the additional noise. |
Although currently it seems disabling particular snippets is not possible, it is possible to put your custom snippets first in the list in order to avoid skimming through the snippet menu. Just name your snippet so that the sorting algorithm puts it before the unwanted snippets (such a |
Like @Kitanotori mentioned most of the scenarios listed here will be solved with the user defined snippets being sorted above the built-in snippets and the ones from extensions. So if you don't like the There is another scenario where this does not help. Say you have 5 javascript related extensions and all of them have the So it is still valuable to have a way to disable snippets not only built-in but also from extensions. We need to be able to provide the extension id and the snippet prefix and ask to disable it. |
My proposal would be to add a new field while snippet creation "For Loop":{
"prefix": "for",
"body": "",
"disableFromExtension": "typescript"
} When snippets are registered in https://github.com/Microsoft/vscode/blob/1.11.2/src/vs/workbench/parts/snippets/electron-browser/snippetsService.ts#L58 we can maintain a separate map of languageId -> snippets-to-disable And they can be filtered out in https://github.com/Microsoft/vscode/blob/1.11.2/src/vs/workbench/parts/snippets/electron-browser/snippetsService.ts#L65 @jrieken Thoughts? |
Just noticed that identifiers (e.g. import { log } from '...') have preference over snippets, so in such case it seems to be impossible to have custom snippets come first. |
This is incredibly annoying especially coming from Atom Editor. I think we should be able to disable them from the snippet menu, such as a 'hide' option so you can just clean the snippet menu as it gets bad items in it. In the post above mine, imagine the 'hide' option appearing along the right side of the menu for each item. I think this would be the most efficient and noob-user friendly solution, that would make it very intuitive to discover and clean up. I also find it comical how you cannot set user defined snippets as the default (but, I wouldn't care about if I could simply disable them from the snippet menu). While I am mentioning, I also find it annoying how I have to press tab twice to access the snippet. There comes a point where typing at 100WPM, its literally faster to just type it out rather than performing what is essentially some "cryptic video game cheat code input" to use a time saving device. |
@amackintosh What's the "tab twice" scenario you mentioned? |
I added a user snippet for "log", and then after in the code: when I type "log", it displays the snippet menu, then I press tab and nothing happens, then I press tab again and it puts in I am used to Atom, using which I type "log" and then press tab and it puts To confirm my gripe, I cannot find a way to achieve this in VSCode without doing: I was able however, to change the name of my snippet to "1Console Log" and now it sometimes displays as the first and/or only snippet entry for "log". I haven't been able to figure out the logic yet. Sometimes it displays two logs (at which time I need to press tab twice), and other times it works as intended without having to press tab twice. |
Do you mean the suggestion/auto completion list? When no suggestion list is present, When you end up pressing tab twice do you get the snippet you configured or you get ? |
@amackintosh I'm using it now while waiting for this issue to be resolved. |
I get that snippet when I press tab twice. (also, yes I mean't suggestion/auto completion list) Thanks @gluons, that solved my issue 100%. Keep up the good work everyone. |
Related: for some reason, in |
I've tried to edit built-in snippets code, use notepad++ in admin mode and it will work. |
I found the snippet and added:
to my |
All I want is,
So I can choose good one left, bad one hidden. |
This will be a great feature, and helps avoid overloading. |
The plugin wasn't was I was looking for, I didn't want to disable all snippets for a lang, just overwrite the existing one. What I ended up with was just prefixing all my snippets like |
I had the same problem of annoying default snippets. I found a file named javascript.code-snippets there: |
On linux, the default code snippets can be found in |
these are nice workarounds but not the ultimate solution. |
This issue has been open since 2016, seriously, my favovurite editor? All of the options are just work arounds, I really do hope that someone does something about this. 😞 |
I took a stab at it a few years ago. It's non-trivial, unless you already
know your way around the snippet codebase.
…On Sat, 10 Oct 2020 at 13:40, Novachief ***@***.***> wrote:
This issue has been open since 2016, seriously, my favovurite editor? All
of the options are just *work arounds*, I really do hope that someone
does something about this. 😞
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#10565 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB347MBJZKTXCMYJMJYCY2TSKA23JANCNFSM4CMTYEMQ>
.
|
I know it's pretty easy but hey, it wouldn't be too hard to directly implement it. |
There is a major extension that provides a snippet with the prefix This is so bad that many times I wast more time undoing this than doing the task I supposed to. The fact that I can't type |
This will happen for 1.52 and works like so:
Note that hidden snippets are synced across devices when using setting-sync, so this needs to be done only once per extension snippet. |
@jrieken does that also apply to built in extensions? Those are the ones that I find more annoying (all those old-style snippets like for loops, selfs, this, etc) |
@danielo515 Yes - it will apply to all snippets from extensions - builtin or user-extensions. This will be in next |
To verify
|
spam, or gmail thinks so
|
One of the Go Extension users talks about the ability to override/disable the snippets defined in the Go extension.
vscode-go/#385
This applies to all extensions that define snippets and so adding this issue as a feature request
The text was updated successfully, but these errors were encountered: