Closed gersonsosa closed 6 months ago
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:
local metals_config = require("metals").bare_config()
metals_config.find_root_dir = function ()
return vim.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 https://github.com/scalameta/nvim-metals/commit/72f47336a4515c75b123611ee1fa6070543a69bf now makes it detect the root of the project deeper than before.
I have a setup similar to the one in the docs https://github.com/scalameta/nvim-metals/blob/72f47336a4515c75b123611ee1fa6070543a69bf/doc/metals.txt#L945-L965
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 https://github.com/scalameta/nvim-metals/blob/72f47336a4515c75b123611ee1fa6070543a69bf/lua/metals/config.lua#L328 to 2
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
72f47336a4515c75b123611ee1fa6070543a69bf