nvim-neotest / neotest

An extensible framework for interacting with tests within NeoVim.
MIT License
2.3k stars 115 forks source link

watch() with ruby and rspec: does not work, how to improve? #320

Open fwolfst opened 10 months ago

fwolfst commented 10 months ago

I use neotest in a Ruby/Rails project with an rspec test suite and the solargraph LSP. Afaict, the textDocument/definition request gives me responses (I can gd go to definition and telescopes lsp_definitions fidner works/shows a class name when invoked over a file with a class def).

I do not understand what the configuration in https://github.com/nvim-neotest/neotest/blob/d424d262d01bccc1e0b038c9a7220a755afd2a1f/doc/neotest.txt#L346 and

https://github.com/nvim-neotest/neotest/blob/d424d262d01bccc1e0b038c9a7220a755afd2a1f/doc/neotest.txt#L566 means. I am neither versed in treesitter nor in LSP.

In the simplest case (unit tests), a spec files path can be found by convention (app/lib/feature.rb will have tests in spec/lib/feature_spec.rb). And even a fully manual model ("watch all of these files: [X,Y]; on changes run tests in [A,B]).

Can you give any pointers how to debug and improve the situation? 🙏

rcasia commented 3 months ago

The neotest file watcher feature is not relaying in lsp but in treesitter queries.

You can check this query and tweak it in order to find out why does not work in your project: https://github.com/nvim-neotest/neotest/blob/26ed90509c377d10dbdebd25b7094a886323b32b/lua/neotest/config/init.lua#L346-L361

There is documentation on treesitter queries on here.