smjonas / snippet-converter.nvim

Bundle snippets from multiple sources and convert them to your format of choice.
Mozilla Public License 2.0
170 stars 4 forks source link

Multiline snippet description when converting to SnipMate #3

Closed dcampos closed 2 years ago

dcampos commented 2 years ago

When trying to convert snippets (like this one) from rafamadriz/friendly-snippets to SnipMate, some snippets containing \n in their description aren't being converted correctly. This is a minimal example snippet (not from friendly-snippets):

{
  "foreach": {
    "prefix": "foreach",
    "body": ["for (${1:type} ${2:var} : ${3:iterable}) {", "\t$0", "}"],
    "description": "Enhanced for loop\nThis is a new line\nAnd another one"
  }
}

Converted (the description spans multiple lines):

# Generated by snippet-converter.nvim (https://github.com/smjonas/snippet-converter.nvim)

snippet foreach Enhanced for loop
This is a new line
And another one
    for (${1:type} ${2:var} : ${3:iterable}) {
        $0
    }

One possible solution would be converting newlines to spaces.

smjonas commented 2 years ago

Thanks for reporting!