Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid regular expression for PHP #199

Open
thomas-hiron opened this issue Apr 6, 2024 · 2 comments
Open

Invalid regular expression for PHP #199

thomas-hiron opened this issue Apr 6, 2024 · 2 comments
Labels
🐛 bug Defect / Bug php

Comments

@thomas-hiron
Copy link

👓 What did you see?

Hello, I'm setting Cucumber LSP for nvim, and I'm getting errors during regex parsing.
I'm trying to glue steps from package: https://github.com/FriendsOfBehat/MinkExtension

Regex parsing fails with error:

[ERROR][2024-04-06 11:07:53] ...lsp/handlers.lua:535	'Failed to reindex: Invalid regular expression: /Opens specified page\n     * Example: Given I am on "http://batman.com"\n     * Example: And I am on "/articles/isBatmanBruceWayne"\n     * Example: When I go to "/articles/isBatmanBruceWayne"\n     *\n     * /^(?:|I )am on "(?P<page>[^"]+)"$/\n     * @When /^(?:|I )go to "(?P<page>[^"]+)"$//: Invalid group'

Here is the corresponding bloc:

    /**
     * Opens specified page
     * Example: Given I am on "http://batman.com"
     * Example: And I am on "/articles/isBatmanBruceWayne"
     * Example: When I go to "/articles/isBatmanBruceWayne"
     *
     * @Given /^(?:|I )am on "(?P<page>[^"]+)"$/
     * @When /^(?:|I )go to "(?P<page>[^"]+)"$/
     */
    public function visit($page)
    {
        $this->visitPath($page);
    }

What can be wrong? And what package is responsible for parsing those steps? I can't find Invalid regular expression anywhere in the source code.

Thanks!

✅ What did you expect to see?

Regex parsing should work, as those steps are executed successfully during testing.

📦 Which tool/library version are you using?

node 21.7.1
npm 10.5.0
nvim 0.9.5
@cucumber/language-server 1.5.0

🔬 How could we reproduce it?

Use this nvim lspconfig and check lsp logs:

require('lspconfig').cucumber_language_server.setup {
  capabilities = capabilities,
  settings = {
    cucumber = {
      features = { 'behat/**/*.feature' },
      glue = { 'vendor/friends-of-behat/mink-extension/src/Behat/MinkExtension/Context/**/*.php' },
    },
  }
}

📚 Any additional context?

I've never installed this package before, so maybe I'm missing a package or configuration.

@kieran-ryan kieran-ryan transferred this issue from cucumber/language-server Apr 7, 2024
@kieran-ryan kieran-ryan added the 🐛 bug Defect / Bug label Apr 7, 2024
@kieran-ryan
Copy link
Sponsor Member

Thanks for the detailed report @thomas-hiron. Have transferred the issue to the Cucumber Language Service, where the language support is implemented.

Feel free to take a look at the php implementation and unit tests in case you observe the underlying issue and either comment or raise a PR if you have any inkling on the underlying root cause. The Cucumber VSCode extension contributing guidelines can also be useful in debugging, though may be a bit heavy if you're using a different IDE.

@thomas-hiron
Copy link
Author

Thanks for moving it to the appropriate place!
I'll have a look at unit tests to see what's wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Defect / Bug php
Projects
None yet
Development

No branches or pull requests

2 participants