Giter Site home page Giter Site logo

snippet-generator's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

snippet-generator's Issues

Snippets for jupyter/anaconda notebook

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"
      ]
    }
  ]
}

Feature Request: Paste existing snippet to edit

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 $

does not escape $

import {$isCodeNode} from '@lexical/code';

"": {
"prefix": "",
"body": [
"import {$isCodeNode} from '@lexical/code';"
],
"description": ""
}

How to add current date/time in iso format?

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

Find a bug,When inserting,code with $ will be ignore

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

issue in vscode snippet

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.

Feature request for Ctrl+i

hello! thanks for the great generator!

few feature requests:

  1. After pressing ctrl+i while having a word "dataset" selected, the generated placeholder should be ${1:dataset} instead of ${1:example}.
    As of now, when i select "dataset" and press ctrl+i, it is replaced by ${1:example}
  2. The Ctrl+i placeholders should auto-increment, ie first press generates ${1:example}, unless it exists already, second press should generate ${2:example}, unless it exists already, etc

thanks, and take care!

Convert from one type to another

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.

Feature request: Powershell VSCode snippets.

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.

${variable_name} doesn't get properly escaped

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\\}\",",

Enhancement : Deal with more reserved characters

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!

Feature Request: Support for multi line tabbing

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.

Escape dollar sign

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'

Link to copy snippets?

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!

Escape (PowerShell, PHP) $Variables in VSCode

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

Add CTRL+Z

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

Tabulation as \t

When the origin has a tabulation in spaces, it should translate it to vscode as \t.

Thanks!

Can you add ultisnips?

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	

possibility to create multiple snippets at once ?

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

Unable to select the middle part

image

Unable to select the middle part
When I need to change the middle section,
I don't want to choose all of them, but I have to start from scratch!
Why?

Issue With VSCodium

(VSCodium Is VSCode Wihtout Microsoft Tracking Stuff)
it says end of file expected [1,3] error

some implementation suggestions

  1. 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?

  2. 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 |}?

  3. 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!

Want to donate $ to you, but pool is closed.

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

Atom String Interpolation

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

Add scope

"scope": "javascript,javascriptreact,typescript,typescriptreact",
So snippet work cross ts tsx and js jsx.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.