pawelgrzybek / snippet-generator Goto Github PK
View Code? Open in Web Editor NEWSnippet generator for Visual Studio Code, Sublime Text and Atom
Home Page: https://snippet-generator.app/
Snippet generator for Visual Studio Code, Sublime Text and Atom
Home Page: https://snippet-generator.app/
Hi, jupyter
or anaconda notebook supports snippets using nbextensions and follows a similar structure like vs code
. However, this does not support a placeholder as of now. Can we feature engineer this?
Structure for jupyter:
{
"snippets" : [
{
"name" : "example",
"code" : [
"# This is an example snippet!",
"# To create your own, add a new snippet block to the",
"# snippets.json file in your jupyter nbextensions directory:",
"# /nbextensions/snippets/snippets.json",
"# `jupyter --data-dir` prints the working directory",
"import this"
]
},
{
"name" : "new-example",
"code" : [
"# This is a new example snippet!",
"import new"
]
}
]
}
It would be nice to be able to paste an existing snippet into the right side and have it decode it into the left hand side for editing the snippet. This way I could update an existing snippet I created without having to re-create it from scratch.
does not escape $
import {$isCodeNode} from '@lexical/code';
"": {
"prefix": "",
"body": [
"import {$isCodeNode} from '@lexical/code';"
],
"description": ""
}
I use sublime for editing markdown files of jekyll backed blog. I need to insert front matter frequently. for example
---
layout: post
title:
author:
date: 2019-11-11
---
Hi. I request to add the following fields:
source code is
<script>
export default {
methods: {
handlerClose() {
this.$emit('update:visible', false);
},
},
};
</script>
get snippets:
"": {
"prefix": "",
"body": [
"<script>",
"export default {",
" methods: {",
" handlerClose() {",
" this.$emit('update:visible', false);",
" },",
" },",
"};",
"</script>"
],
"description": ""
}
when inserting in vsCode, $ will be ignore, but this.$$emit('update:visible', false);
will work fine
While generating vs code snippet there has to be one more pair of curly brackets as the whole snip code has to be only one object in itself.
hello! thanks for the great generator!
few feature requests:
thanks, and take care!
It would be nice if this app could take a snippet of one format as input, and then output a snippet of the other format.
eg. Paste in a sublime snippet and output a vscode snippet.
The current snippet creator doesn't double up on $ chars to ensure that the variable is inserted properly.
$$Value
will render to $Value
in Powershell snippets. Any chance of this being added? :)
Love the app. Thanks.
When placing for example ${variable_name}
inside a snippet, it should be escaped as \\${variable_name\\}
, so that VScode doesn't think it's a placeholder in the snippet
For example for cortex debug, the following line is usually needed:
"cwd": "${workspaceRoot}",
With proper encoding:
"\"cwd\": \"\\${workspaceRoot\\}\",",
When reworking past snippets, it would be useful to be able to paste it in the IDE format to edit it without having to rewrite part of it.
I might try to do a PR in the next few days for it.
I have an issue with displaying your generator in Safari. Input field almost hidden. I tried to turn off all of my browser extensions but it didn't help me. See the screenshot: https://www.dropbox.com/s/iz0wp804wkjtzbb/11.png?dl=0
If passing $variable it should provide \$variable or else it will show "variable" instead of "$variable" on visual Code.
The developers like you making life of others easy.
Thanks a lot big bro.
Hey there,
I wonder if there is a way to enhance the generator to deal with some more characters (at least in VSCode)
Like \ or $ (typically to import powershell code)
UNC patch: \\mypath\dir to \\\\mypath\\dir
Variables: $myVar to \\$myVar
Thanks. Great tool!
Current behaviour: When I select multiple lines in Your snippet...
section and press Tab
, it erases the selected code.
Expected behaviour: All the selected lines should indent as in most of the code editors.
It would be a nice addition if the dollar sign ($) could be escaped automatically. This is necessary for sublime text when it is used in the actual code snippet.
\$test = 'string'
Instead of:
$test = 'string'
Please remove the empty space in scope XML tag.
It currently retains '\n' in the code to '\n' in snippet.
例如 ctrl + i 创建了一个 placeholder
...
Hi thanks for this!
RFC: Could I have a permalink to whatever text is typed in the box? Then I can save one link, rather than saving the individual snippets :)
Thanks!
I use this generator all the time for VS Code, it's amazing. Could you add Visual Studio snippet support?
https://docs.microsoft.com/en-us/visualstudio/ide/walkthrough-creating-a-code-snippet?view=vs-2019
Hello.
$Variablenames in VSCode snippets need to be escaped with a double backslash, like: \\$Variablename to look like $Variablename in the inserted code.
It gets tricky when $Variablenames follow a path delimiter, in Windows the backslash...
A Windows backslash is escaped with a single backslash, like: \\some\\path
Adding the escaped $Variablename directly behind it will not work, ie: \\\\$Variablename. The $Variablename will loose it's '$' and look like: \Variablename
What does work is escaping the double escape by double escaping :) as in: \\\\\\$Variablename
tl;dr:
it takes six backslashes to escape the combination '\some\path\$Variablename', to look like '\\some\\path\\\\\\$Variablename'
This is only necessary if a $Variablename follows a path delimiter. Otherwise a double backslash '\\' would be enough.
phew
This might be related (or cover) Issue #13
I was making a large snippet and I accidentally inserted a piece of code that compromised the snippet. I had to start from scratch because there's no way back.
My idea is simple, add a back function
When the origin has a tabulation in spaces, it should translate it to vscode as \t.
Thanks!
When quotation marks (") were used in snippet descriptions or triggers it did not replace them with ". This is an issue in both Atom and VSCode.
When using single quotation marks in Atom (') it did not replace them with '. This is only an issue in Atom.
Ps. I'd like to try to fix this one if possible 😄.
I know this would be hard because of the interpolation, but you can just ignore stuff with backticks
and anything
that has a regex trigger. Just implement the basic stuff like this.
Snippet Generator
substitute($1,'\v^$2','$3','${4:g}')$0
VSCODE
"substitute function": {
"prefix": "sub",
"body": [
"substitute($1,'\\v^$2','$3','${4:g}')$0"
],
"description": "substitute function"
}
Ultisnips
snippet sub "substitute function"
substitute($1,'\v^$2','$3','$4')$0
endsnippet
Tks for the nice plugin ! Is it possible to enhance this great website to something like a parser working in the following way :
the --- seperates the different code to convert to snippets
aaa(default description)
bbb(default trigger,prefix)
textAfter(text to convert to snippets)
---
aaaNextsnippet(default description)
bbbNextsnippet(default trigger,prefix)
textAfterNextSnippet(text to convert to snippets)
---
etc...
(VSCodium Is VSCode Wihtout Microsoft Tracking Stuff)
it says end of file expected [1,3] error
Often the code written in the left tab is very long on the horizontal axis and the display even for modifications to the written code is annoying.
Is it possible to have the two tabs (left and right) instead of both occupying 50% of the page being collapsible horizontally like the bootstrap Accordion cards, so as to have the tab of interest to the full screen?
Is it possible to add a placeholder shortcut similar to ctrl + i for the placeholder of vscode $ {1: example}, also for other functions, such as the multiple choice $ {1 | example1, exaple2, example3 |}?
is multiverse generation possible? from native code to vscode snippet, and from vscode snippet to native code (preserving tabstops, placeholders, etc.)
it is a great application yours saves time, but it can be improved, indeed it must be improved!
Hi Pawel,
Love your snippet generator! I clicked to donate to you to help you pay for the domain, but the PayPal pool is closed. I hope that means donations have covered your domain costs for the year, but I would still like to tip you. Any way I can do that?
Cheers,
Cooper
I have a snippet in atom, and I can't seem to figure out how to do string interpolation i.e. #{name}
in a atom snippet.
'flash_message':
'prefix': 'flash'
'body': """
<% flash.each do |name, msg| %>
<%= content_tag(:div, msg, class: "alert alert-#{name}") %>
<% end %>
"""
In VSCode snippet, '' should convert to '\' in body
field.
Do we have support for adding multiple snippets? If no, can we have it?
"scope": "javascript,javascriptreact,typescript,typescriptreact",
So snippet work cross ts tsx and js jsx.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.