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

Playground improvements (click-to-copy, default initial code, movable panels, etc.) #779

Open
jgerigmeyer opened this issue Jul 20, 2023 · 4 comments

Comments

@jgerigmeyer
Copy link
Contributor

jgerigmeyer commented Jul 20, 2023

Opening this issue to capture a number of proposed improvements to the new Sass Playground. Feel free to split this into separate issues as you see fit.

  1. Default code contents on initial Playground load (if not following a direct link with existing contents)
  2. Click-to-copy input SCSS/Sass or output CSS: see design proposal
  3. Link directly from code examples throughout to the site, to open the code in the Playground: see design proposal
  4. Drag to expand/collapse input/output/console panel widths: see design proposal
  5. Autocomplete Sass-specific keywords (e.g. @use, @debug) and in-scope variables
  6. Click on line number in the Console to go to that line in the input panel
  7. Convert existing input between SCSS and Sass when switching between panels
@nex3
Copy link
Contributor

nex3 commented Sep 6, 2023

I'm striking through number 7 as "infeasible". We actually used to maintain a tool that could do this, but it turns out that the ongoing maintenance cost of needing to be able to produce nicely-formatted source code for every type of source AST node is substantial. I don't think it's worth the value of using it in the playground.

@ravindUwU
Copy link

Thoughts on encoding the line number into the URL state and placing the cursor at that line when the playground loads? 🤔

@nex3
Copy link
Contributor

nex3 commented Jun 17, 2024

That's an interesting idea. I wonder if it would make more sense to copy the location specifically when there's highlighted text—it seems like the most likely use case is to indicate "look at this part of the code", and highlighting might be a clearer signal that the user intends the position to be meaningful.

@ravindUwU
Copy link

ravindUwU commented Jun 18, 2024

Oh that's way better!! I'd love to have a go at implementing this over the weekend 😄. I guess there are a few decisions to be made about 🤔,

  1. The current URL state is <inputFormat><outputFormat><content> and doesn't include a content delimiter so I'm unsure if extending this format to include a selection is ideal... thoughts on making it a JSON array instead? Decoding can support both formats so that existing playground links won't break.

    type PlaygroundUrlState = [
        /* content: */ string,
        /* isScss: */ 0 | 1,
        /* isExpanded: */ 0 | 1,
        /* selection: */ [/* from: */ number, /* to: */ number] | undefined,
    };
  2. Should highlights be more visually distinctive? Maybe #EFEB88?

  3. Move this discussion to a separate, feature-specific issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants