Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>CSS End Block LabelsNew to Visual Studio Code? Get it now.
CSS End Block Labels

CSS End Block Labels

tikusieg

| (0) | Free
Display selectors beside closing CSS, SCSS and Less braces without changing your source.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

CSS End Block Labels

Display the corresponding selector after each closing brace in CSS, SCSS and Less. Labels are editor decorations: the extension never edits your source.

.about {
    .inner {
        color: red;
    }  .inner
}  .about

The labels shown after } above are visual attachments, not comments.

日本語

Try locally

Install Node.js 24 LTS or a newer supported release, then run:

npm ci
npm run check
npm test
npm run build

Open this folder in VS Code and press F5 (Run Extension). In the Extension Development Host, open a CSS, SCSS or Less file with multiline blocks.

To install without the debugger:

npm run package
code --install-extension css-end-block-labels-0.1.0.vsix

The publisher ID is tikusieg. Confirm license ownership before the first release.

Marketplace releases

The ci.yml workflow publishes v* tag pushes after validation succeeds. The tag must match the package version exactly (for example, v0.1.0 for version 0.1.0). Branch pushes, pull requests and manual workflow runs only validate and package.

Before the first release, configure Trusted Publishing in the Marketplace publisher management page: owner tikusieg, repository css-end-block-labels, workflow ci.yml, and no environment. Publishing uses OIDC; no PAT secret is needed.

Commit and push the release changes, then push the first tag:

git tag v0.1.0
git push origin v0.1.0

For subsequent releases, start with committed changes and run npm version patch, then git push origin HEAD --follow-tags. Update the changelog before releasing. Every release requires a new version number.

Features

  • Parent selector resolution, suffixes (&-item), reversed nesting (.active &), and selector lists.
  • CSS selector-list parents use :is(...) to preserve native nesting semantics. SCSS and Less expand combinations.
  • At-rules retain their own names; enclosing selectors flow through nested at-rules. Keyframe steps retain from, to, or percentages.
  • Local selector mode, depth and line filters, length limits, theme color, spacing and opacity.
  • Debounced edits and URI/version/language cache shared across split editors.
  • Each label attaches to its own closing brace, including several on the same line.
  • Local processing only: no telemetry or network calls.

Settings

All keys below have the cssEndBlockLabels. prefix. Settings support language and workspace resource scopes.

Key Default Meaning
enabled true Enable labels
languages ["css", "scss", "less"] Enabled language IDs (supported parsers only)
selectorMode "local" Show only the current block selector; resolved expands parents
minLines 3 Lines from opening to closing brace, inclusive
minDepth 0 Minimum depth; outermost block is 0
showAtRules true Label at-rule blocks
showSingleLine false Label single-line blocks, bypassing minLines
labelPrefix "" Text before labels
labelSuffix "" Text after labels
labelMargin "1em" CSS length between brace and label
opacity 1 Label opacity (0–1)
maxLabelLength 120 Limit including prefix/suffix and ellipsis; 0 is unlimited
debounceDelay 150 Edit debounce in milliseconds

Color uses cssEndBlockLabels.labelColor in workbench.colorCustomizations. For One Dark Pro:

{
  "workbench.colorCustomizations": {
    "[One Dark Pro]": {
      "cssEndBlockLabels.labelColor": "#545b69"
    }
  }
}

Commands

Command Palette: CSS End Block Labels: Enable, Disable, Toggle, Refresh. Enable/Disable/Toggle override the current visible editor only; Refresh reparses its document. Overrides reset when an editor leaves the visible editor set or extension settings change. Use enabled for persistent preferences. No keyboard shortcuts are assigned.

Error handling and limits

CSS uses PostCSS with safe-parser recovery. SCSS/Less use their language parsers; on errors, recovery attempts a strictly parseable prefix (at most four attempts). Labels with uncertain closing positions are hidden. Syntax repairs automatically refresh labels; no repeated error notifications appear. An incomplete outer SCSS/Less block may temporarily hide valid nested labels.

Runtime variables/interpolation remain local. Expansion is capped at 256 combinations to avoid excessive work. Advanced compiler-specific constructs, Less mixin names, scope semantics and selector transformations are not a substitute for compiler output. Parsing is synchronous after debounce; very large files may still cause pauses. Embedded styles, CSS-in-JS and indented Sass are outside the scope.

Validation

npm test covers selectors, offsets, interpolation, syntax recovery, line filters, cache behavior, mocked editor lifecycle (split views, commands, debounce, configuration and disposal), and 5,000 blocks. npm run check type-checks; npm run package builds a VSIX. Manual checks in an Extension Development Host:

  1. Open CSS/SCSS/Less; switch language modes and themes.
  2. Split one document into two editors; edit, toggle one editor, and refresh.
  3. Change settings and check multiline/single-line/adjacent closing braces.
  4. Break and repair syntax; verify no labels attach to the wrong brace.
  5. Copy, save, format, undo and redo; verify source text is unchanged by labels.

MIT license. See LICENSE.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft