Skip to content

[Bug]: Double slash comments cause wrong position for syntax highlights in scss files #559

Open
@kryp71c

Description

How did you encounter this bug?

When using stylelint with stylelint-prettier, any double slash comment in an scss file will move any following error syntax highlight up by two spaces:

// some comment
.test {
  padding: 0 ;
            ^ actual error (extra space)
          ^ squggly line denoting error is shown here
}

This is cumulative. Every line that starts with a double slash following errors are moved up by two spaces. Any */ inside a double slash comment will also move following errors up by two spaces. C style multi-line comments /* */ do not have that effect.

Note the changing position of the error for the extra space in the padding rule as comments are added:
vscode-bug

Link to Minimal Reproducible Example

https://github.com/kryp71c/stylelint-vscode-bug

Code Snippet

// some comment
.test {
  padding: 0 ;
}

Stylelint Configuration

/** @type {import('stylelint').Config} */
export default{
  extends: ["stylelint-config-standard-scss", "stylelint-prettier/recommended"],
};

Extension Configuration

{
  "stylelint.validate": [
    "scss",
  ],
}

Actual Behaviour

Adding a double slash comment in an scss file moves the syntax highlight of following errors up by two spaces.

Expected Behaviour

Double slash comments don't affect the syntax highlight position.

Logs

No response

Stylelint Version

v16.5.0

vscode-stylelint Version

v1.4.0

Node.js Version

v20.13.0

Operating System

macOS Ventura 13.5.2

Windows Subsystem for Linux

No response

Code of Conduct

  • I agree to follow vscode-stylelint's Code of Conduct

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions