openstyles / openstyles/stylus

[Suggestion] Beautify selection only

Open
#488 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

editor enhancement
Dominant language
JavaScript
Stars
6.9k
Forks
382
PR merge metrics
No merged PRs in 30d

Description

It would be a cool feature to be able to only beautify the selected text block.

This helps keeping non-standard indentations like

.pausedOverlay {
    text-shadow:  1px  1px 1px black,
                  1px -1px 1px black,
                 -1px  1px 1px black,
                 -1px -1px 1px black !important;
    }

An advantage is that you can be sure nothing wrong happened to the code that is out of sight / scope.

Of course it won't respect the overall indentation e.g. from a wrapping @-moz-doc rule, but that's no problem as the text is selected anyway and can be reindented easily by pressing tab.

Another problem that might come up is beautifying multiple separated selections. To not overcomplicate it, this should simply not work.

This suggestion should be considered when realizing the unified editor for vanilla CSS and UserCSS.

We can then also get rid of the "beautify this section" button.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the unified editor for vanilla CSS and UserCSS and the existing “beautify this section” button. Define selection handling so one selected block can be beautified, multiple separated selections are rejected, and text outside the selection remains unchanged; the existing section button should then be removable.

Written by the indexing model from the issue text.

Assessment

Tech stack
css
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.