-
-
Notifications
You must be signed in to change notification settings - Fork 26
Description
👓 What did you see?
Thanks for maintaining @cucumber/language-server! It's been a breeze to use and I really enjoy using it.
This behavior could be expected (and a weird edge case if anything), but I noticed a small issue where, when a step in a .feature file contains a forward slash, the corresponding step definition glue code isn't found by the language server, even when @cucumber/cucumber can successfully locate the corresponding step definition when the tests are run.
features/config.feature
Feature: Simple test
Scenario: GET /config
Given I am a user
# Notice `/config` with a forward slash prefix
When I send a request to /config
Then the response should contain expected configfeatures/config.ts
import { Given, Then, When } from '@cucumber/cucumber';
Given('I am a user', async function () {
// no-op
});
// Notice the escaped forward slash - which is a requirement for `@cucumber/cucumber` to match this step definition to the step referenced in the feature file.
When('I send a request to \\/config{}', async function (value: string) {
// eslint-disable-next-line no-console
console.log(`Sending request to ${value}`);
});
Then('the response should contain expected config', async function () {
// no-op
});✅ What did you expect to see?
I would expect that @cucumber/language-server could locate a step definition for a feature step with a forward slash, when @cucumber/cucumber is able to match the step definition to this step and run tests as expected.
📦 Which tool/library version are you using?
❯ node -v
v24.10.0@cucumber/cucumber: 12.1.0
@cucumber/language-server: 1.7.0
❯ uname -v
Darwin Kernel Version 25.0.0: Wed Sep 17 21:42:08 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T8132❯ nvim --version
NVIM v0.11.4
Build type: Release
LuaJIT 2.1.1761727121🔬 How could we reproduce it?
Clone this reproduction repository, install dependencies, run the test suite, and verify that all tests run as expected.
git clone https://github.com/Drew-Daniels/cucumber-lsp-repro
cd cucumber-lsp-repro
npm i
npm run cucumberHowever, open up features/simple-maths.feature in your editor (I am using neovim) and verify that the LSP generates a warning that the step definition for the When I send a request to /config line cannot be found.
📚 Any additional context?
Here is my (abbreviated) nvim-lspconfig.lua file:
return {
"neovim/nvim-lspconfig",
config = function(_, _)
local capabilities = require("blink.cmp").get_lsp_capabilities()
-- TODO: Modularize configuration so that 'capabilities = capabilities' setting is used for every lsp
--TODO: Deactivate eslint lsp when in an "ignored" directory so things are less noisy
-- https://github.com/neovim/nvim-lspconfig/issues/2508
local root_dir = vim.fs.root(0, ".git")
local use_flat_config = false
if root_dir ~= nil and vim.fn.filereadable(root_dir .. "/eslint.config.js") == 1 then
use_flat_config = true
end
vim.lsp.config("cucumber_language_server", {
capabilities = capabilities,
settings = {
cucumber = {
glue = {
-- Cucumber-JVM
"src/test/**/*.java",
-- Cucumber-Js
"features/**/*.ts",
"features/**/*.tsx",
"features/**/*.js",
"features/**/*.jsx",
"step-definitions/**/*.ts",
"test/features/**/*.ts",
-- Behat
"features/**/*.php",
-- Behave
"features/**/*.py",
-- Pytest-BDD
"tests/**/*.py",
-- Cucumber Rust
"tests/**/*.rs",
"features/**/*.rs",
-- Cucumber-Ruby
"features/**/*.rb",
-- SpecFlow
"*specs*/**/*.cs",
-- Godog
"features/**/*_test.go",
},
},
},
})
vim.lsp.enable({
"cucumber_language_server",
})
end,
}