Skip to content

Semantic syntax highlighting is applied in all files #305

@zohnannor

Description

@zohnannor

👓 What did you see?

Once the extension is initialised (by opening any .feature file), the syntax highlighting is present in all other files.

I originally noticed this because #[given(regex = r"^I request `(/\w+)`$")] line became comment-style (grey color and italic)

Image

I then bisected my extensions to confirm this happens only when Cucumber is enabled. And then I tried just pasting the Feature section in some arbitrary file's multiline comment:

Image

>Developer: Inspect Editor Tokens and Scopes Before and after extension initialization:

before after
Image Image

✅ What did you expect to see?

The gherkin-specific syntax highlighting should only be applied in .feature files.

📦 Which tool/library version are you using?

$ cargo -vV 
cargo 1.93.0 (083ac5135 2025-12-15)
release: 1.93.0
commit-hash: 083ac5135f967fd9dc906ab057a2315861c7a80d
commit-date: 2025-12-15
host: x86_64-unknown-linux-gnu
libgit2: 1.9.1 (sys:0.20.2 vendored)
libcurl: 8.15.0-DEV (sys:0.4.83+curl-8.15.0 vendored ssl:OpenSSL/3.5.4)
ssl: OpenSSL 3.5.4 30 Sep 2025
os: Arch Linux Rolling Release [64-bit]
[dev-dependencies]
cucumber = "0.22.1"

https://marketplace.visualstudio.com/items?itemName=CucumberOpen.cucumber-official

Installation
Identifier
cucumberopen.cucumber-official
Version
1.11.0
Last Updated
6 months ago
Size
13.09MB
{
    "cucumber.glue": [
        "backend/e2e/**/*.rs"
    ],
    "cucumber.features": [
        "backend/e2e/**/*.feature"
    ]
}

🔬 How could we reproduce it?

I guess just open any file and try making a multi-line comment with gherkin syntax in it.

📚 Any additional context?

This is mostly a concern of the cucumber/language-service repo, right?

Metadata

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