Hi there. I searched the issue history for this repo and wasn't able to find this. Please forgive me if it already exists!
This is just a friendly request for the suggestion box: Currently, we are only able to write snippets in json5. It would be nice to have the ability to write them in yaml to make adding and arranging snippets easier.
Wouldn't it be possible to load snippets in the same way as they are currently, but if .yml, .yaml files are found, just run them through a yaml parser (e.g. js-yaml) prior to consuming in vscode?
Thanks for considering! 馃槃
Unsure if that will happen. I don't see a significant advantage of using yaml over json over xml
I'd love to be able to write snippets in YAML.
The advantage of YAML over JSON is developer ergonomics.
The multi-line snippets as arrays in fully qualified JSON are painful to write. It would be much easier and clearer to compose snippets in YAML, particularly if multi-line strings could be split into the array format on \n: eg:
- React Life Cycle:
prefix: life
body: >
public componentWillMount() {}
public componentDidMount() {}
public componentWillReceiveProps(nextProps) {}
public shouldComponentUpdate(nextProps, nextState) {}
public componentWillUpdate(nextProps, nextState) {}
public componentDidUpdate(prevProps, prevState) {}
public componentWillUnmount() {}"
vs.
{
"React: lifecycle": {
"prefix": "life",
"body": [
"public componentWillMount() {}",
"public componentDidMount() {}",
"public componentWillReceiveProps(nextProps) {}",
"public shouldComponentUpdate(nextProps, nextState) {}",
"public componentWillUpdate(nextProps, nextState) {}",
"public componentDidUpdate(prevProps, prevState) {}",
"public componentWillUnmount() {}"
]
},
}
I agree, in fact, vs code should use yaml for all configuration files.
As I noted over at https://github.com/Microsoft/vscode/issues/15140#issuecomment-304574987 Sublime and Atom make snippet authoring much nicer (note that many people agreed with reactions)
I think supporting multi-line snippets should definitely be a priority! I can't comment on any of the issues that are specifically asking for that as they've all been locked.
Thanks for the great tool :)
This issue is being closed to keep the number of issues in our inbox on a manageable level, we are closing issues that are not going to be addressed in the foreseeable future: We look at the number of votes the issue has received and the number of duplicate issues filed. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider.
If you wonder what we are up to, please see our roadmap and issue reporting guidelines.
Thanks for your understanding and happy coding!
If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider.
Please reconsider.
Dropping by to add my passionate vote to reconsider this idea.
Snippets are fundamentally meant to be written by humans. And, directly from yaml.org's landing page...
What It Is: YAML is a human friendly data serialization
standard for all programming languages.
It was created so that people can more easily deal with its syntax, which is the opposite of json or xml. I hope this gets a proper reconsideration.
in fact, vs code should use yaml for all configuration files.
VSCode, like any JS-based tool, would do everyone a huge favor by supporting full-blown JS for configuration files. Babel does now, everyone should follow suit
As far as I can tell VSCode doesn't even support the JSON5 syntax for multiline strings... 馃う鈥嶁檪 馃う鈥嶁檪 \
When I insert the following snippet, it just inserts test foo on a single line.
{
"Multiline Test": {
"prefix": "mt",
"body": "test\
foo"
}
}
After looking through similar extensions and being dissatisfied with how they work, I decided to create one that just pastes the contents of the clipboard as a snippet:
https://marketplace.visualstudio.com/items?itemName=vscodeshift.paste-as-snippet
I think this should be reopened / reconsidered. It's pretty hard to manage larger snippets when you have to keep worrying about putting quotes around each line of a snippet. A hacky alternative is to use something like this tool, but that just makes it hard in a different kind of way.
Perhaps something like what Vetur does would be a good way of doing it, you basically have a folder where you put your snippets in, and the language is read from the file extension. It works pretty well.
Most helpful comment
Please reconsider.