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
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.
Note that if you don't like snippets at all you can disable them in code assist with
"editor.snippetSuggestions": "none"
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 if
snippet, 2 for
, and more....
I can't type prefix and press enter immediately. I have to move arrow key to find snippets.
That really annoy me. 😔
Also, some snippets just make no sense at all. For example, the for
snippet in TypeScript creates _this_:
for (var index = 0; index < array.length; index++) {
var element = array[index];
}
I... I don't even...
for
loop to iterate an array in the first place? (unless I'm iterating MB-sized arrays in a worker)var
for block-scoped variables?index
as a loop counter variable name for a simple iteration?)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 1-<name of your snippet>
).
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 for
snippet, create your own, and that would be sorted before the other for
snippet.
The label for the snippets will include both the name of the snippet and the prefix, making it easy to know which one is yours and which is from built-in or from the extension.
There is another scenario where this does not help. Say you have 5 javascript related extensions and all of them have the for
snippet. Now your suggestion list just bloats up.
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
json
"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.
Also, it would be great to be able to disable keywords suggestions. It basically blocks snippets because we have to use arrow down instead of just hitting enter.
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 <log> </log>
.
I am used to Atom, using which I type "log" and then press tab and it puts console.log()
.
To confirm my gripe, I cannot find a way to achieve this in VSCode without doing:
type "log", press down-arrow key, press tab
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.
@amackintosh
it displays the snippet menu
Do you mean the suggestion/auto completion list?
When no suggestion list is present, log
followed by tab expanding to <log></log>
is due to emmet which gets triggered on tab. You can avoid that by setting emmet.triggerExpansionOnTab
to false
.
We are moving away from this model of tab
being tied to emmet, that will be out in the next update.
When you end up pressing tab twice do you get the snippet you configured or you get
@amackintosh "editor.snippetSuggestions": "top"
may help you to get rid of arrowing down. 🙂
I'm using it now while waiting for this issue to be resolved.
I get that
Thanks @gluons, that solved my issue 100%.
Keep up the good work everyone.
Related: for some reason, in .tsx
(Typescript React) files the built-in import
snippet expands to import $2 = require('$1')
instead of import { $2 } from '$1'
. The possibility to change default snippets would allow me to override the former behaviour.
I've tried to edit built-in snippets code, use notepad++ in admin mode and it will work.
we use a specific code standard that has different spacing rules, and had to constantly change the spaces for the autocompleted code.
by being able to override the default rules, i could copy the php.json to the user snippets with the correct code standards.
+1
edit:
that being said, i just copied over all the default php.json snippets to the user php.json and changed as I needed. with the line suggested by @gluons, i'm happy for now ( despite the duplicated entries, that can be solved by deleting the php.json file every update )
This is super annoying, I'm writing my own snippets to replace the default ones because I have a different coding style, and this is what I get:
I'm not sure what the general solution should be, but if a user defines a snippet with the same prefix and description as one defined by an extension I'm pretty sure it means the one provided by the extension should be overridden.
@ramya-rao-a Looks like there's no ETA for this issue, would you consider a PR for fixing the aforementioned issue about overriding?
PRs are always welcome.
cc @jrieken
Yes, PR welcome tho the idea is a little bigger than just for snippets. Users also complain about certain keybindings, or menu-contributions. So, this should be done such that it allows to disable/enable various bits of the static contributions (those that are read from package.json).
Interestingly snippets don't just override the exact matches, but matched suffixes. For example, a pre-existing golang snippet is:
lp| => log.Println("|")
and if I try to define ;lp
as my new snippet, I'll always get No Suggestions:
;lp| => No Suggestions
Putting aside that "No Suggestions" is probably also a bug, even if I define it as glp
or anything else I continue to get "No suggestions". So it appears to match against all suffixes. At first I thought it was just my settings, but everything works great for snippets that aren't pre-existing.
I find snippets to be a personal preference, so I'd prefer a way to either override default Go snippets or remove all of the pre-existing ones to start fresh.
As an aside, it'd also be wonderful to have an interface to snippets. All the recent snippet interfaces (sublime, atom, vscode) have gone downhill since Textmate. Textmate's great snippet interface made it easier and faster to define custom snippets so as a result, you'd define more custom snippets and reduce the wrist strain :-)
Solution for MacOS: Right click on the _Visual Studio Code.app_ and select _Show Package Contents_. Drill down to the Contents/Resources/app/extensions
directory, within, you will find the extensions files grouped by language. Within, I was able to find javascript/snippets
and modify the existing snippets, or delete the snippet json files entirely. Restart VSC, and enjoy! :-)
I might be a little late, but I simply type the first letter of the prefix twice.
llog // console.log()
eeach // $1.forEach(e => {$2})
It will most likely always be on top.
@kobus1998 unfortunately that doesn't seem to work if log
were to be defined. might just be my configuration though.
@matthewmueller Hmm, weird. Could you show me your snippet? Maybe you changed the name of the snippet instead of the prefix.
"Console log": {
"prefix": "llog",
"description": "Log to console",
"body": [
"console.log($1)"
]
},
on OSX, I am simply going to ~/.vscode/extensions
, chose the extension I wand to disable the snippets from and empty its snippets/snippets.json
file. I know is barbarian and have to repeat this every time there is an update for that extension, but it is better than having the undesired snippet being offered every time. Plus ... you can always have a batch that copies an empty snippets.json
into the right folder, if the extension gets updated too often ;) Hope the team here finds a better way to let us selectively disable the snippets from extensions. HTH
The solution is here : https://stackoverflow.com/questions/40110541/how-to-edit-existing-vs-code-snippets
Simply add this : "editor.snippetSuggestions": "top" in your user settings file.
I’m afraid we’re referring to different issues. I and some of us here, were looking for a vscode solution we could use for disabling the snippets completely, from specific snippets, selectively.
I want to summarize some issue(s) I have with the current implementation and try to provide some actionable feedback.
I apologize if this is the wrong issue and I'm happy to post elsewhere. I've taken some time to try to reduce the number of false positives from the interplay between navigation, snippets and autocomplete.
I'm using Go as my primary language, but this should apply to any language:
1. Autocomplete should not mess with navigation
I think we've all got accustomed to this from various editors, but it should not be like this. What this means is that the arrow keys, space bar and enter should be for code navigation and not for autocomplete navigation and selection.
Tab can be for selecting the focused autocomplete item since I don't think there's any languages where tabs matter (mid-word). You can do this right now in your editor, by messing with the keybindings. Here's a fix to this:
// disable all auto-complete triggers, except tab
{
"key": "down",
"command": "-selectNextSuggestion",
"when": "editorTextFocus && suggestWidgetMultipleSuggestions && suggestWidgetVisible"
},
{
"key": "up",
"command": "-selectPrevSuggestion",
"when": "editorTextFocus && suggestWidgetMultipleSuggestions && suggestWidgetVisible"
},
{
"key": "enter",
"command": "-acceptSelectedSuggestionOnEnter",
"when": "acceptSuggestionOnEnter && editorTextFocus && suggestWidgetVisible && suggestionMakesTextEdit"
}
With this, you can still navigate on autocomplete by pressing cmd+arrow. It does take a couple days to get used to but you'll thank me later.
2. Snippets are a personal preference (like themes & font)
I don't think you should bundle snippets in the same way that you bundle language support. Maybe it's okay as a starting point, but there's gotta be a way to turn the defaults off, especially since there's some very opinionated single-key snippets (e.g. m
=> make($1, $2)$0
).
The order of snippets should be above the scope (e.g. "editor.snippetSuggestions": "top"
) because you want to deterministically be able to kick off a snippet, not have it dependent on what's currently in scope (something Sublime still hasn't fixed).
Since you sort of want both what's in scope and your snippets at your disposal at any given time, I tend to prefix my snippets with a ;
because it's easy to access from the home row and there's less issue with short variables (like m := "hi"
) that are in scope. Maybe there could be a standard key like that for what ships with the standard snippet libraries.
UPDATE I no longer think that ;
as a snippet completer is a good idea. For example, if you're in for i := 0; i < numItems; i++ { ... }
, you don't want s;
to expand a snippet. Still looking for a better alternative here.
3. We should be able to granularly disable what we see in autocomplete
One place where the keyboard interactions break down is when you're tabbing through the snippet. For example if I have a snippet like this println($1)$0
and I want to write println(t)
, once I type "t" and hit tab, it will autocomplete to true
(with Go's IDE support). Personally I'd like to have my settings like this:
"editor.quickSuggestions": {
"comments": false,
"strings": false,
"other": false,
"scope": true // only show variables in lexical scope
}
EDIT: An alternative to this would be to designate another key for going to the next slot. That might be even better in case there's a variable like test := "hi"
in scope. I've added this:
{
"key": ";",
"command": "jumpToNextSnippetPlaceholder",
"when": "editorTextFocus && hasNextTabstop && inSnippetMode"
},
{
"key": "tab",
"command": "-jumpToNextSnippetPlaceholder",
"when": "editorTextFocus && hasNextTabstop && inSnippetMode"
},
{
"key": "shift+;",
"command": "jumpToPrevSnippetPlaceholder",
"when": "editorTextFocus && hasPrevTabstop && inSnippetMode"
},
{
"key": "shift+tab",
"command": "-jumpToPrevSnippetPlaceholder",
"when": "editorTextFocus && hasPrevTabstop && inSnippetMode"
}
4. Better snippet interface
I mentioned this before but because snippets are such a personal thing, they really need to be easier to tweak/update. Textmate had this awesome little snippet interface:
Seems like we've been going downhill since then first with Sublime then Atom. I believe snippets are hugely underrated and I think part of that is because they're currently quite painful to create and update.
Please don't take this feedback the wrong way, I really love the work you all are doing on this editor. I'm just a fan that wants to see VSCode get even more awesome and save our wrists from arthritis 😄
+1, I've also noticed many of the core snippets basically are broken eg: https://github.com/Microsoft/vscode/blob/master/extensions/php/snippets/php.snippets.json
"function …": {
"prefix": "fun",
"body": [
"${1:public }function ${2:FunctionName}(${3:${4:${5:Type} }$${6:var}${7: = ${8:null}}})",
"{",
"\t${0:# code...}",
"}"
],
"description": "Function"
},
It doesn't make sense to jump 5 times inside the param area. Also double dollar syntax ($$) does output single dollar ($) but also creates an extra snippet jump. Correct way to escape seems to be backslash dollar (\$). Edit: second look it seems the dollar was intended as extra jump so i guess its just a lot of jumps then.
Would love to be able to edit snippets in a similar way to shortcuts and configs which you have already done so well. Simply need interface for viewing at least all core snippets and then right click edit -> copy and jump to snippet file where you can quickly modify it.
Thanks for all your work!
I think it would make sense for snippets with the same name to coalesce, so that if you define a snippet with the same name as one from an extension/global snippet, only the snippet with the more specific scope will appear. (I think that's the behavior in Atom).
You also need the ability to remove a snippet, I think you can define a user snippet without the "body" attribute to do so in Atom, but that's not documented anywhere. It can also be helpful to completely disable all snippets from a certain package if you don't like them at all and want to define your own.
"editor.snippetSuggestions": "top"
may work for @gluons and others, but it creates other unintended behavior that's quite disruptive. VS Code seems to give too much "weight" to snippets when this option is set to top
, sorting it at the top of the list _no matter what_, even if there are other, more matched options in the list.
In this example, the forof
snippet, which is only a fuzzy match, is placed above foo
, which is an _exact_ match. foo
should be the top result.
I'd really like to see another option for the "editor.snippetSuggestions"
setting, maybe "preferred"
or something like that. The user should be able to say "hey, I prefer snippets over the default language suggestions" without taking an all-or-nothing approach and throwing everything other than snippets to the bottom.
On Windows, but presumably all platforms - going to VS Code installation, finding snippets.json under typescript-basics and setting it to {}
will get rid of what 99% are probably in this thread for. All those class, for of, if and frankly useless snippets. Especially when you want to add a className but get a class inside JSX.
NB: Afterwards restart VS Code. And backup, because you can brick TS Extensions if you break a reference.
protostyle:
The extensions directory is here:
Mac/Linux: $HOME/.vscode/extensions/
Windows: %USERPROFILE%\.vscode\extensions/
I selected the extension I wanted to modify, dove into the snippets directory found there (if it had one) and modified as desired.
Then I tied a string on my pinky to remember that if/when I update that extension someday, all my personal modifications will get overwritten/replaced out with the updated version of the file.
(unless of course I squirrelled away my changed .json file outside of the extension's directory...)
Thanks to here for helping point me towards the proper directory.
search "snippets" folder in:
(vscode app)/Contents/Resources/app/extensions/(your language)/
or
~/.vscode/extensions/(your language plug)/
edit the json file
So we've seen hacks to remove or modify snippets while keeping keywords, like this...
But we haven't seen anything addressing an equally important customization that I and many others would prefer: removing keywords so that snippets can be easily used, like this:
So we have the _original_ issue brought up by the OP, which still needs an official solution. Manually modifying files that can just get overwritten is not a great solution.
We also have the issue of built-in language keywords not being able to be hidden so that our hacked-up custom snippets can take the spotlight.
And we also have the issue of needing an additional "editor.snippetSuggestions"
setting which prioritizes snippets without throwing them to the top without regard to search relevance.
Has anyone received official word on _any_ of these issues?
No progress on this?
I have tab complete enabled which is supposed to immediately trigger a snippet on prefix match, but because of duplicate snippets it only displays the suggestion menu.
Is there an update on this? Turning off the default suggestions and keywords would be great 👍
Please, don't enforce snippets.
Your snippets dramatically had broken my coding experience and coding performance. It's better to make user less angry in 10% cases than make more happy in 90% cases. Think about it. It's important UX rule.
@nin-jin Fully agree with you. This is the main reason why I refused of using vscode
I'd like to ask people to stop commenting when a +1 would have sufficed. I understand that you feel the need to express your frustration as you've just stumbled upon this issue and might experience a slight shock. But the fact is that for those who have discovered it before you, a hopeful e-mail with a solution is yet another comment that contributes nothing but anger.
The fact of the matter is, there are higher priority issues, and there are perfectly sound workarounds for this. If they have proved too difficult to do, ask for help, someone might, and they'll become better documented overall.
Right now you are merely pushing people away from subscribing to this thread, so that if a dev came here and said: "we won't do this", the people who cared would not be notified, and would not be able to react.
It seems that Atom has solved a similar problem -- Disabling snippets included from packages.
Can it provide some advice on vscode?
Personally I care mostly about built-in snippets. It will be very nice if we had an ability to delete or edit them. Thanks!
EDIT:
I created an extension to control your snippets. You can disable or enable snippets from any extensions, built-in or manually installed.
Repository: https://github.com/svipas/vscode-control-snippets
VS Code extension: https://marketplace.visualstudio.com/items?itemName=svipas.control-snippets
The lack of a possibility to override built-in snippets is super annoying. Please, fix it!
What I currently do is run find ~/.vscode -name snippets -exec rm -r {}
\;
each time an extension updates. It's a dumb hack but it works, if
anyone needs it.
On Thu, 29 Nov 2018 at 03:25, VKondakoff notifications@github.com wrote:
The lack of a possibility to override built-in snippets is super annoying.
Please, fix it!—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/vscode/issues/10565#issuecomment-442670056,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHfPsHYTQrFPwTBvQKCKMwNa3lWrhU3Iks5uzzeNgaJpZM4Jk8EZ
.
Snippets are very much broken, just saying:
What I currently do is run
find ~/.vscode -name snippets -exec rm -r {} \;
each time and extension updates. It's a dumb hack but it works, if anyone needs it.
Also delete all the snippets in the main app, it makes coding way way easier...
PS. editor.snippetSuggestions: "none"
if anyone needs it.
Please fix this. This issue was opened 2.5 years ago and I've been following it for at least half of that time. Just give us a editor.disableDefaultSnippets: true
or similar that turns off all default and extension snippets and just leaves specific ones created by the user.
I also need API for snippets extension.
@jrieken What do you think about "editor.suggest.disableDefaultSnippets": true | false
? I can try to create PR.
EDIT:
I created an extension to control your snippets. You can disable or enable snippets from any extensions, built-in or manually installed.
Repository: https://github.com/svipas/vscode-control-snippets
VS Code extension: https://marketplace.visualstudio.com/items?itemName=svipas.control-snippets
Only not suggesting them is half the problem. They would still autocomplete
on keyword + tab (assuming you have this behaviour enabled).
On Wed, 13 Mar 2019, 12:10 Benas Svipas, notifications@github.com wrote:
@jrieken https://github.com/jrieken What do you think about "editor.suggest.defaultSnippets":
"on" | "off"? I can try to create PR.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/vscode/issues/10565#issuecomment-472358909,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHfPsNSMLyqGAebr-EBJEJVnMyUuHy46ks5vWM6CgaJpZM4Jk8EZ
.
I'm bumping this thread as I've recently grown annoyed with the the fact that the c/c++ snippets are bound within a binary file and there's no way to override or edit them. I prefer not to litter my suggestion menu with duplicates.
Would love to see this: https://github.com/microsoft/vscode/issues/10565#issuecomment-472358909
IMO the best is if snippets are contributed by separate external extensions, so it's possible to uninstall them.
Note that if you don't like snippets at all you can disable them in code assist with
"editor.snippetSuggestions": "none"
It works
I used to use snippets a lot when I was using WebStorm.
I started not using snippets on VS Code because default snippets are not useful for me and I can't even disable it.
For what it's worth when it comes to the annoying build in snippets for typescript they are easy enough to snipe after each release. I assume it would be something similar for other languages. I run the following script every time they begin showing again.
# This is in my ~/.profile
function vsCodeClearSnippits() {
echo "Reseting Snippits"
# Typescript
rm /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/extensions/typescript-basics/snippets/typescript.json
echo {} > /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/extensions/typescript-basics/snippets/typescript.json
# Javascript
rm /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/extensions/javascript/snippets/javascript.json
echo {} > /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/extensions/javascript/snippets/javascript.json
}
Anyway this is hardly the ideal solution because it does revert occasionally and I have to run the vsCodeClearSnippits
from the terminal again. I assume vsCode does this when it updates or detects it has been changed. Anyway annoying to have to run the command again but it works well enough.
Hopefully they provide an actual solution in the future.
has there been an update on this? (apart from editing extensions in a hacky way)
Seems like people have suggested a very sensible setting in the form of "editor.suggest.disableDefaultSnippets": true | false
with the offer of a PR several months ago.
Anyone from the core team care to comment on that suggested approach and green light it? Slightly depressing that after almost 3 years this issue still hasn't been solved.
The default built-in snippets (like for JS / TS) is pretty annoying.
At least make the user custom snippets and user installed snippets before the default.
Any news about override the keyword if has a snippet with the same prefix name?
to resolve this:
Any news on providing a setting to disable/reorder extension-specific snippets?
I don't want to change the order of suggestions — I still want my user-defined snippets to show up first — but only disable or move farther down "contextly unwanted" extensions snippets...
I'm creating an extension which will remove all global snippets.
EDIT:
I created an extension to control your snippets. You can disable or enable snippets from any extensions, built-in or manually installed.
Repository: https://github.com/svipas/vscode-control-snippets
VS Code extension: https://marketplace.visualstudio.com/items?itemName=svipas.control-snippets
@svipas hey, how is it going, any progress?
sounds like a good solution until native support appears
@dotiful Hi, if I will have time today I will publish this extension. It would have picker with all global snippets from builtin extensions and downloaded, so you could choose which one to delete or all of them.
EDIT:
I created an extension to control your snippets. You can disable or enable snippets from any extensions, built-in or manually installed.
Repository: https://github.com/svipas/vscode-control-snippets
VS Code extension: https://marketplace.visualstudio.com/items?itemName=svipas.control-snippets
@svipas Does your extension have disabling snippets feature instead of delete?
So, we'll able to bring it back when we need it. Or show/hide as we wish.
@gluons It's way easier to delete them, but I will see if I can add the ability to disable them instead of deleting them.
EDIT:
I created an extension to control your snippets. You can disable or enable snippets from any extensions, built-in or manually installed.
Repository: https://github.com/svipas/vscode-control-snippets
VS Code extension: https://marketplace.visualstudio.com/items?itemName=svipas.control-snippets
@svipas Any update on the extension that you are working on?
I did some tests and seems that we can't delete snippets (because of a lot of errors in Developer Tools) instead I will disable them, so you could enable/disable them from picker. After new VS Code release 1.37.0 I will publish extension since VS Code provides fs
wrapper so it would be very easy to fully use VS Code API. Stay tuned I will update here about extension which will be published probably this week 🚀
EDIT:
I created an extension to control your snippets. You can disable or enable snippets from any extensions, built-in or manually installed.
Repository: https://github.com/svipas/vscode-control-snippets
VS Code extension: https://marketplace.visualstudio.com/items?itemName=svipas.control-snippets
Extension is already created and works amazing! You can disable or enable snippets from any extensions, built-in or manually installed.
Repository: https://github.com/svipas/vscode-control-snippets
VS Code extension: https://marketplace.visualstudio.com/items?itemName=svipas.control-snippets
How it looks like:
So this is a very important feature that annoys developers every single day of their lives.
I'ts have been 3 years and several duplicates since it was first reported, and I didn't saw any answer from the core team. I think we are doomed.
Thank goodness they have open sourced it so we could get something done
about it!
Thank you very much, Benas!!!
On Wed, Aug 21, 2019 at 8:28 AM Daniel Rodríguez Rivero <
[email protected]> wrote:
So this is a very important feature that annoys developers every single
day of their lives.
I'ts have been 3 years and several duplicates since it was first reported,
and I didn't saw any answer from the core team. I think we are doomed.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/microsoft/vscode/issues/10565?email_source=notifications&email_token=ACOASNFQSMPBNTVPSO6XUELQFVNKHA5CNFSM4CMTYEM2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD42BTCQ#issuecomment-523508106,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACOASNBLXTJK74IO46RLZY3QFVNKHANCNFSM4CMTYEMQ
.
So if you don't like the
for
snippet, create your own, and that would be sorted before the otherfor
snippet.
I'm wondering what did I miss to get the described behavior?
Screenshots:
I found the snippet and added:
'.ruby.source':
'Add ‘# =>’ Marker':
'prefix': '#'
to my ~/.atom/snippets.cson
and it stopped the snippet from firing.
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 >ue
and >us
(useEffect and useState).
Never collides with the built-ins, but I would really prefer to be able to declare snippets like @ramya-rao-a suggested using "disableFromExtension": "typescript"
or similar.
I had the same problem of annoying default snippets. I found a file named javascript.code-snippets there:
C:\Users\
After removing it and restarting VS Code I see only my own snippets. If you only want to remove some default snippets then you can edit that file. Simply cut out annoying for-loop snippet and only that one is gone. This may be a temporary fix until the next update but it is easy to repeat if you keep your own version of the file and replace the default one with it after the update.
On linux, the default code snippets can be found in /usr/share/code/resources/app/extensions/[language]/snippets/[language].code-snippets
, so for JavaScript that would be /usr/share/code/resources/app/extensions/javascript/snippets/javascript.code-snippets
.
As with siimsepp's answer, these changes take effect after restarting VSCode.
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 notifications@github.com 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
https://github.com/microsoft/vscode/issues/10565#issuecomment-706528364,
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 .
, so every time I use a .
it changes to self.
.
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 .
is pretty annoying and this has 4 years is frustrating.
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 1.52
insiders: https://code.visualstudio.com/insiders/
Most helpful comment
Extension is already created and works amazing! You can disable or enable snippets from any extensions, built-in or manually installed.
Repository: https://github.com/svipas/vscode-control-snippets
VS Code extension: https://marketplace.visualstudio.com/items?itemName=svipas.control-snippets
How it looks like: