Skip to content

Semi & singleQuotes configuration - [Not available for now] #62

Closed
@sravan-s

Description

@sravan-s

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

ice-chillios commented on Mar 27, 2019

@ice-chillios
Member

There is no possibility for now, but feel free to add this option :)

sravan-s

sravan-s commented on Mar 28, 2019

@sravan-s
Author

I didn't check the code base yet, I will try anyways :)

Rc85

Rc85 commented on Jun 17, 2019

@Rc85

Single quotes is based on your vscode settings.

CodingDive

CodingDive commented on Jul 24, 2019

@CodingDive
Contributor

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.

  1. Insert snippet
  2. Save document with prettier installed or format code via the command palette CTRL|CMD+Shift+P => Format Document
ice-chillios

ice-chillios commented on Jul 24, 2019

@ice-chillios
Member

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

Rc85

Rc85 commented on Jul 28, 2019

@Rc85

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

fauzanelka commented on Jan 13, 2020

@fauzanelka

It would be good if you add this as an option. If it turned on it will add semicolon, vice versa.

trailofdad

trailofdad commented on Jan 16, 2020

@trailofdad

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

ice-chillios commented on Jan 16, 2020

@ice-chillios
Member

@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

trailofdad commented on Jan 16, 2020

@trailofdad

@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

ice-chillios commented on Jan 16, 2020

@ice-chillios
Member

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

trailofdad commented on Jan 16, 2020

@trailofdad

@dsznajder Awesome 😎 I'll have a look at it when I have a chance as well 🚀

ice-chillios

ice-chillios commented on Feb 5, 2020

@ice-chillios
Member

@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 in package.json).

changed the title [-]How to configure the snippets to use double quotes or semi colons[/-] [+]Semi & singleQuotes configuration - [Not available for now][/+] on Feb 5, 2020
pinned this issue on Feb 5, 2020
wispamulet

wispamulet commented on Jun 23, 2020

@wispamulet

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

AmodeusR commented on Jan 8, 2022

@AmodeusR
ice-chillios

ice-chillios commented on Jan 15, 2022

@ice-chillios
Member

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

unpinned this issue on Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @trailofdad@sravan-s@ice-chillios@Rc85@wispamulet

      Issue actions

        Semi & singleQuotes configuration - [Not available for now] · Issue #62 · r5n-labs/vscode-react-javascript-snippets