Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config support #25

Closed
nickmccurdy opened this issue Oct 14, 2019 · 11 comments · Fixed by #56
Closed

Config support #25

nickmccurdy opened this issue Oct 14, 2019 · 11 comments · Fixed by #56
Labels
help wanted Extra attention is needed options Related to the options/config page or its data
Milestone

Comments

@nickmccurdy
Copy link
Member

#23 (comment)

@kaicataldo
Copy link
Member

Definitely think we should implement this! Assuming we want this in the extension's settings page, seems like we could:

  1. Have a text input that accepts JSON
  2. Have individual inputs for each configurable option (I think VS Code's plugin does this?)
  3. Both of the above!

@kaicataldo kaicataldo added enhancement New feature or request help wanted Extra attention is needed labels Oct 15, 2019
@nickmccurdy
Copy link
Member Author

As far as UI is concerned, I really like how Code Sandbox does it. There's a preference pane with a GUI for the Prettier fields and a link to edit the JSON directly for importing/exporting (similar vibe to VSCode's user/workspace settings).

image
image

Source: https://github.com/codesandbox/codesandbox-client/blob/master/packages/app/src/app/pages/common/Modals/PreferencesModal/CodeFormatting/Prettier/index.tsx

@kaicataldo
Copy link
Member

That seems pretty ideal to me.

@nickmccurdy
Copy link
Member Author

nickmccurdy commented Oct 15, 2019

Would you be okay with pulling in React for this? It will require some build configuration which I can help with, but it's pretty small and will make managing the form a lot easier. Code Sandbox is also using React, but I'm not sure how reusable their components in the source would be.

@kaicataldo
Copy link
Member

I'm not opposed to that at all! The current plugin code uses vanilla JS because there really isn't much UI to render.

@lipis
Copy link
Member

lipis commented Oct 15, 2019

Yes, I also don't mind React.. as long as it's nice and tidy..! :)

@nickmccurdy nickmccurdy added this to the MVP milestone Oct 17, 2019
@nickmccurdy
Copy link
Member Author

nickmccurdy commented Oct 18, 2019

I just realized the playground is using React, would it be better to try to reuse those components instead of cloning Code Sandbox's UI? It has sections and I figure it might be more familiar to Prettier users, though I think Code Sandbox's looks nicer.

Code reuse would be a little tricky at first with this being a separate repository from Prettier and the playground, but we could release a package for both in theory.

@kaicataldo
Copy link
Member

Oh, that's interesting. It looks like there are a number of configuration options in the playground that we probably wouldn't use. I wonder if it's worth the overhead of extracting out a package that we have to make sure works for both cases? Given that there isn't a ton of complex behavior, I'm inclined to say we just write our out config UI. I'm happy to go with consensus on this though :)

@nickmccurdy
Copy link
Member Author

nickmccurdy commented Oct 18, 2019

We could start by copying it if we like the playground UI, and extract a package if we end up using shared logic. Do you have any preference over this UI or the code sandbox one? Or do you have a different idea?

@kaicataldo
Copy link
Member

I think that seems like a good plan! I didn't have any particular design choices in mind. I like the idea of making it an embedded option, because then you can just style the popup and not have to worry about how it looks in a full document. I think the Redux DevTools use this nicely:

Screen Shot 2019-10-17 at 9 32 30 PM

Screen Shot 2019-10-17 at 9 32 36 PM

@nickmccurdy
Copy link
Member Author

That's a good idea, I think it would make formatting easier.

@nickmccurdy nickmccurdy added options Related to the options/config page or its data and removed enhancement New feature or request labels Nov 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed options Related to the options/config page or its data
Projects
None yet
3 participants