You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today while importing my scala project I noticed it failed with the latest version of nvim-metals, I think this commit 72f4733 now makes it detect the root of the project deeper than before.
projects, set the `find_root_dir_max_project_nesting`
key to an integer greater than 1.
Ex: Set `find_root_dir_max_project_nesting` to 2 if
this is your project tree:
build.sbt <- this is the desired root
a/
b/
- build.sbt <- subproject, not the desired root
- src/main/scala/Main.scala
If you need even more fine-grained control over
finding your root-dir (in cases where you have very
uncommon build layouts) you can also use the
`find_root_dir` key in the config to provide your
own custom function to find the root dir given a
starting dir and root patterns. _You more than likely
shouldn't need to do this_.
build.gradle.kts <- this is the desired root
a/
build.gradle.kts <- subproject, not the desired root (detected as root by the current version)
b/
build.gradle.kts <- subproject, not the desired root
src/main/scala/Main.scala
by reading the docs and the code I guess I could try to use find_root_dir_max_project_nesting setting, but if I try to pass find_root_dir_max_project_nesting it's reported as an invalid option, am I missing something?
What would be the right way to fix this? I don't see why adding build.gradle.kts detect my root in a nested folder rather than the root.
Expected behavior
The root of the project to be detected
build.gradle.kts <- this is the desired root
a/
build.gradle.kts <- subproject, not the desired root
b/
build.gradle.kts <- subproject, not the desired root
src/main/scala/Main.scala
or the ability to use the find_root_dir_max_project_nesting setting
this issue can be closed, after the suggestion by @ckipp01 I set the setting find_root_dir_max_project_nesting directly under the config object rather than under config.settings and that works
If you have a unique project build setup with subprojects, etc., you can also set the config.find_root_dir function.
Here is a little example to set the root to the current working directory:
localmetals_config=require("metals").bare_config()
metals_config.find_root_dir=function ()
returnvim.fn.getcwd()
end
Describe the bug
Today while importing my scala project I noticed it failed with the latest version of nvim-metals, I think this commit 72f4733 now makes it detect the root of the project deeper than before.
I have a setup similar to the one in the docs
nvim-metals/doc/metals.txt
Lines 945 to 965 in 72f4733
by reading the docs and the code I guess I could try to use
find_root_dir_max_project_nesting
setting, but if I try to pass find_root_dir_max_project_nesting it's reported as an invalid option, am I missing something?As a workaround I set this
nvim-metals/lua/metals/config.lua
Line 328 in 72f4733
What would be the right way to fix this? I don't see why adding
build.gradle.kts
detect my root in a nested folder rather than the root.Expected behavior
The root of the project to be detected
or the ability to use the
find_root_dir_max_project_nesting
settingOperating system
macOS
Version of Metals
v1.3.0
Commit of nvim-metals
72f4733
The text was updated successfully, but these errors were encountered: