qiuxiang / solidity-ls

Solidity language server.
57 stars 7 forks source link

feat: support to go definition in monorepo #8

Closed soraliu closed 9 months ago

soraliu commented 2 years ago

So far, the solidity-ls does not support to go definition in monorepo. Because workspaceFolders returns the root path which contains .git, so consider the following case

ROOT
  |- .git
  |- eth
    |- hardhat-project
      |- node_modules
        |- hardhat
      |- contracts
        |- Token.sol
      |- package.json

The code like import "hardhat/console.sol"; will go to ROOT/node_modules/hardhat/console.sol which does not exist.

The PR will fix this case. And it will navigate to ROOT/eth/hardhat-project/node_modules/hardhat/console.sol

soraliu commented 2 years ago

@qiuxiang Could help to review?

qiuxiang commented 2 years ago

what is the lsp client you are using? coc.nvim or nvim-lspconfig?

soraliu commented 2 years ago

I'm using coc.nvim

qiuxiang commented 2 years ago

I have added rootPatterns to coc-solidity, you can try it first.

ChmielewskiKamil commented 1 year ago

How about nvim-lspconfig? I've been trying to get the go-to definition to work but with no success. Can I change something in the config files to support this functionality?