nvim-lspconfig icon indicating copy to clipboard operation
nvim-lspconfig copied to clipboard

go: embedded projects not being detected

Open kkrime opened this issue 1 year ago • 4 comments

Description

If we have the following: outter_project: /User/kkrime/go/src/outter_project inner_project: /User/kkrime/go/src/outter_project/inner_project

Both projects are vaild projects with all the files you'd expect in the root of a project folder to be detected by the lsp.

If you open the outter_project first then open the inner_project, only the outter_project will be in the workspace_folders

nvim outter_project/main.go outter_project/innner_project/main.go -O

If you do it the other way round i.e first open the inner_project then open the outter_project, both projects will be in the workspace_folders

nvim outter_project/innner_project/main.go outta_project/main.go -O

both projects shouild be in workspace_folders in both senarios

kkrime avatar Jan 08 '25 02:01 kkrime

This sounds similar to https://github.com/neovim/nvim-lspconfig/pull/3515

You did not even mention which "root markers" are in these projects ?

justinmk avatar Jan 08 '25 11:01 justinmk

This sounds similar to #3515

You did not even mention which "root markers" are in these projects ?

I'm using .git to identify the root of the project

kkrime avatar Jan 08 '25 11:01 kkrime

FYI @justinmk I tested https://github.com/neovim/nvim-lspconfig/pull/3515 on that branch, in both senarios in the description, only the root directory of the first file will be returned, the root directory of the second file does not get detected.

So: nvim outter_project/main.go outter_project/innner_project/main.go -O the workspace_folders will only ever contain outter_project as the root, even when switching buffers to the second file

and nvim outter_project/innner_project/main.go outta_project/main.go -O the workspace_folders will only ever contain inner_project as the root, even when switching buffers to the second file

kkrime avatar Jan 09 '25 00:01 kkrime

after https://github.com/neovim/neovim/pull/33485 is merged, Nvim 0.12 / 0.11.2 will support more control over the precedence of root_markers. Then the go config can be updated (I'm hoping you or another user will try it and send a PR)

justinmk avatar Apr 30 '25 13:04 justinmk