Closed
Description
Hi @dsznajder, thanks for making this nice plugin. Is there an existing way to use double quotes instead of single quotes and to add semicolons?
Example ->
import React, { PureComponent } from "react";
import PropTypes from "prop-types";
export default class TaskInformation extends PureComponent {
static propTypes = {
}
render() {
return (
<div>
</div>
);
}
}
Activity
ice-chillios commentedon Mar 27, 2019
There is no possibility for now, but feel free to add this option :)
sravan-s commentedon Mar 28, 2019
I didn't check the code base yet, I will try anyways :)
Rc85 commentedon Jun 17, 2019
Single quotes is based on your vscode settings.
CodingDive commentedon Jul 24, 2019
I'm not sure if you need this feature inside the library for another reason but there is always the possibility to have
prettier
autoformat your code based on your project preferences.CTRL|CMD+Shift+P => Format Document
ice-chillios commentedon Jul 24, 2019
@ReasonableDeveloper Sure, but would be nice if someone could do it without some onSave hook / format document. I'm also looking forward to add some other specific settings as
// @flow
annotation, etc. I will check once more if anything has changedRc85 commentedon Jul 28, 2019
For semi-colons, it is possible by editing snippets.json (for Windows 10, it is found in
C:\Users\roger\.vscode\extensions\dsznajder.es7-react-js-snippets-2.4.0\snippets
). Downside is that not all users prefer semi-colons and when changes are pushed to this repo, it will restore snippets.json back to its original, removing all your inserted semi-colons.fauzanelka commentedon Jan 13, 2020
It would be good if you add this as an option. If it turned on it will add semicolon, vice versa.
trailofdad commentedon Jan 16, 2020
I'd like to see this as an option as well. I've never contributed before but this seems like it might be a good first issue 😄
ice-chillios commentedon Jan 16, 2020
@trailofdad The problem is, I didn't see any options to pass them into
snippets.json
file. This extension already contain some options and commands already so it won't be a problem to set them but, can't read them on side of template.I would definitely love to add those. Same with
// @flow
annotation on every component snippet.trailofdad commentedon Jan 16, 2020
@dsznajder Forgive me if this is a silly idea, because I have no experience with plugin dev at the moment. Would be be possible to do a string replace on the single quotes when you convert the JSON to a string? Lets say if a flag were set in the settings or something?
ice-chillios commentedon Jan 16, 2020
I thought about same thing. I’m not sure about performance downsize of that. Also, change of this any of those, should regenerate .json file everytime, not sure if possible to dynamically load new file. I will yeet over the weekend.
P.S. I’m not familiar with extension development neither ;p just reading docs and trying.
trailofdad commentedon Jan 16, 2020
@dsznajder Awesome 😎 I'll have a look at it when I have a chance as well 🚀
ice-chillios commentedon Feb 5, 2020
@trailofdad I've tried the approach which we discussed, unfortunately I didn't achieve the expected result.
active
function only is applied when command for search is triggered, and I did not found any other solution in docs (maybe I've missed something). Additionally,.json
files are loaded on very beginning (their paths are declared inpackage.json
).[-]How to configure the snippets to use double quotes or semi colons[/-][+]Semi & singleQuotes configuration - [Not available for now][/+]wispamulet commentedon Jun 23, 2020
I found this plugin has options to decide whether to use semicolons or not. The plugin works for now but it seems that it's no longer being manitained by its owner.
Maybe someone would check this. React Redux ES6 Snippets
AmodeusR commentedon Jan 8, 2022
ice-chillios commentedon Jan 15, 2022
I finally found some time to play around with this. Unfortunately, It's still very limited but it's working for snippets from search. Hope so for now it will be enough but still looking into the possibility of dynamically loading inline prompts and applying format