sidlatau / neotest-dart

30 stars 8 forks source link

adapter root can be wrong if a folder named dart is in the tree #5

Closed momrak closed 1 year ago

momrak commented 1 year ago

https://github.com/nvim-neotest/neotest/issues/237

https://github.com/sidlatau/neotest-dart/blob/43a61b8aab7908799d58369ba15dc4cd381d46ff/lua/neotest-dart/init.lua#L11 this line sets the root to the first it meets with the name dart. I have a folder in my path to the project named dart and it will then be set as the root.

Is there a particular reason for this?

I checked the adapter for go and they use the following to set the root. Would it be enough to use pubspec.yaml or something similar for Dart as a more robust way of setting this? adapter.root = lib.files.match_root_pattern("go.mod", "go.sum")

Not quite sure how this lib.files.match_root_pattern works though. When i renamed my dart folder the root was set correctly.

sidlatau commented 1 year ago

Thanks for registering an issue. Yes, I think you are right, pubspec.yaml should be used to check for the root. I updated the code, please check if it works for you.

momrak commented 1 year ago

Now it works as expected 🎉 Thanks