vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Default glue paths should support multi-root and nested workspaces

Open zohnannor opened this issue 3 years ago • 2 comments
trafficstars

👓 What did you see?

When I open a workspace that has tests/features/* structure somewhere in it, every step is marked as Undefined.

image

✅ What did you expect to see?

Should the extension use the settings...

{
    "cucumber.glue": [
        "src/test/**/*.java",
        "features/**/*.ts",
        "features/**/*.tsx",
        "features/**/*.php",
        "features/**/*.py",
        "tests/**/*.py",
        "tests/**/*.rs",
        "features/**/*.rs",
        "features/**/*.rb",
        "*specs*/**/.cs"
    ]
}

...to find the specified structure across the opened workspace and associate .feature files with corresponding matchers? Users currently have to tune their local workspace settings:

// in a local .vscode/settings.json
{
    "cucumber.glue": [
        "path/to/dir/tests/**/*.ext"
    ]
}

... so that extension can find the matchers.

📦 Which tool/library version are you using?

Name: Cucumber
Id: CucumberOpen.cucumber-official
Description: Cucumber for Visual Studio Code
Version: 1.5.1
Publisher: Cucumber
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=CucumberOpen.cucumber-official

🔬 How could we reproduce it?

Move the tests/features/ dir (and possibly re-configure your build system for this change) in some nested dir, not in the top-level dir, observe the Undefined step and no goto definition in the editor for every step in the .features files. Default VScode settings.

MRE: https://github.com/zohnannor/cucumber-vscode-mre/tree/workspace


This text was originally generated from a template, then edited by hand. You can modify the template here.

zohnannor avatar Oct 19 '22 17:10 zohnannor

Are you suggesting we add ./**/ to the beginning of every cucumber.glue glob? While it might fix your problem without having to change any settings, it might also slow down the scanning if there are many files in your workspace. It's primarily limited by how fast the globbing library works, which I haven't benchmarked.

Not sure what to do about this one...

aslakhellesoy avatar Nov 11 '22 23:11 aslakhellesoy

Benchmarked the fast-glob globbing library used by the Language Server through the node-glob benchmark.

Starting glob patterns with **/ is about 10x times slower (0.074s -> 0.732s) for synchronous operations and 16x times slower (0.067s -> 1.101s) running asynchronously.

This benchmark suite contains significantly more files than would be contained within a typical Cucumber environment repository, so would not be as drastic in practice. Although it should be possible to support this request, we would first need to optimise existing performance (#152) - particularly how we watch and read files; allowing us to offset the slower globbing and provide a better out-of-the-box experience.

--- pattern: 'features/**/*.js' ---
~~ sync ~~
node fast-glob sync             0m0.074s  0
node globby sync                0m0.093s  0
node current globSync mjs       0m0.093s  0
node current glob syncStream    0m0.076s  0
~~ async ~~
node fast-glob async            0m0.067s  0
node globby async               0m0.088s  0
node current glob async mjs     0m0.068s  0
node current glob stream        0m0.069s  0

--- pattern: './**/features/**/*.js' ---
~~ sync ~~
node fast-glob sync             0m0.732s  0
node globby sync                0m0.685s  0
node current globSync mjs       0m0.966s  0
node current glob syncStream    0m1.103s  0
~~ async ~~
node fast-glob async            0m1.101s  0
node globby async               0m1.275s  0
node current glob async mjs     0m1.008s  0
node current glob stream        0m1.302s  0

kieran-ryan avatar May 14 '24 19:05 kieran-ryan