0

Nvim info

NVIM v0.5.1

Build type: Release

LuaJIT 2.1.0-beta3

Also using nvim-lspconfig, and tsserver


Filesystem dir structure

|--home
  |--project-A
    |--src
      |-- 
        |--/* Implementation somewhere here */
  |--project-B
    |--src
      |--
        |-- /* Used somewhere here */    

I want to jump to the implementation in project-A, whereas it is used in project-B.


Tried

I am able to jump to other implementations within project-B, so my lsp client is functioning correctly.

To achieve the desired goto implementation, I added in workspace /absolute-path-to/project-A using the command lua vim.lsp.buf.add_workspace_folder(), and then tried jumping to the implementation again but this did not work.

Output of ex command lua print(vim.inspect(vim.lsp.buf.list_workspace_folders())):

{ "/absolute-path-to/project-A", "/absolute-path-to/project-B", "/absolute-path-to/project-A", "/absolute-path-to/project-B" }

For some reason paths repeat in the above output.


Question

Is there a way I can configure nvim LSP client so that a jump to implementation from project-B to project-A is possible?

2
  • do you try to use bear -- make to generate compile_commands.json?
    – nextloop
    Dec 26 '21 at 21:12
  • i think you can add project-A by :lua vim.lsp.buf.add_workspace_folder()
    – nextloop
    Dec 26 '21 at 21:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.