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

enable this extension also for behat cucumber files #36

Open
Trim opened this issue Jan 18, 2024 · 2 comments
Open

enable this extension also for behat cucumber files #36

Trim opened this issue Jan 18, 2024 · 2 comments

Comments

@Trim
Copy link

Trim commented Jan 18, 2024

Hello,

According to the phpactor behat integration documentation, I have to configure the language server to be enabled on "php" and "cucumber" file types.

If I read correctly, currently the coc-phpactor extension enables the phpactor language server only for php files.

Is it possible to add cucumber files too by default or to add an extension option to enable the language server for these files ?

@dantleech
Copy link
Contributor

I guess it should be fine. If the supported file types are set in the coc extebsion then feel free to make an MR :)

@Trim
Copy link
Author

Trim commented Jan 22, 2024

Well, I've just tried to create a patch to add cucumber file type for the extension, but it did not work: Trim@985ad76

After applying this patch:

  1. I run yarn install to rebuild the extension
  2. I open a feature file with vim feature/some.feature with a vim installation which has coc.nvim installed without the coc-phpactor. The project is a new Symfony7 project with this phpactor configuration:
{
    "$schema": "/var/home/adrien/.local/applications/phpactor/phpactor.schema.json",
    "symfony.enabled": true,
    "indexer.exclude_patterns": [
        "/vendor/**/Tests/**/*",
        "/vendor/**/tests/**/*",
        "/var/cache/**/*",
        "/vendor/composer/**/*"
    ],
    "behat.enabled": true,
    "behat.symfony.di_xml_path": "%project_root%/var/cache/dev/App_KernelDevDebugContainer.xml"
}
  1. I use the vim command :set runtimepath^=~/code/coc-phpactor/ with path to my patched coc-phpactor directory
  2. I run the vim command :CocInfo and I have these logs:
## versions

vim version: VIM - Vi IMproved 9.1 9010031
node version: v20.10.0
coc.nvim version: 0.0.82-d1568d56 2023-09-29 19:43:34 +0800
coc.nvim directory: /var/home/adrien/code/config/vim/pack/adrien/start/coc.nvim
term: tmux
platform: linux

## Log of coc.nvim

2024-01-22T21:43:27.647 INFO (pid:123131) [configurations] - Add folder configuration from file: /var/home/adrien/.vim/coc-settings.json
2024-01-22T21:43:27.785 INFO (pid:123131) [extension:coc-git] - Looking for git in: git
2024-01-22T21:43:27.977 INFO (pid:123131) [plugin] - coc.nvim initialized with node: v20.10.0 after 549
2024-01-22T21:44:27.492 INFO (pid:123131) [attach] - receive notification: highlight []
2024-01-22T21:44:31.096 INFO (pid:123131) [attach] - receive notification: showInfo []
  1. Although, if I open a PHP file I see well the log message:
2024-01-22T21:48:57.033 INFO (pid:123131) [language-client-index] - Language server "phpactor" started with 124058

I don't understand why it doesn't work for cucumber files as I've never did a coc-nvim extension before. Some help would be appreciated :)

For the moment, I've set this coc configuration which seems to do the same thing than the coc-phpactor extension, but it works well for both php and cucumber files:

{
  "languageserver": {
    "local-phpactor": {
      "enable": true,
      "filetypes": ["php", "cucumber"],
      "command": "phpactor",
      "args": ["language-server"]
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants