From f40846954bba78ee7dc17fcbe534d523a951bc60 Mon Sep 17 00:00:00 2001 From: Sebastian Stammler Date: Thu, 25 Aug 2022 01:07:54 +0200 Subject: feat(solc): Add hardhat.config.* to solc root detection (#2085) Hardhat users will experience a better root dir detection if the hardhat.config.ts (or .js) file takes precedence over the git repo dir, especially in monorepos, where this could lead to faulty import statements. Note that most Solidity projects are using hardhat. --- lua/lspconfig/server_configurations/solc.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lua') diff --git a/lua/lspconfig/server_configurations/solc.lua b/lua/lspconfig/server_configurations/solc.lua index 42e44fe3..9ae3948d 100644 --- a/lua/lspconfig/server_configurations/solc.lua +++ b/lua/lspconfig/server_configurations/solc.lua @@ -4,7 +4,7 @@ return { default_config = { cmd = { 'solc', '--lsp' }, filetypes = { 'solidity' }, - root_dir = util.root_pattern '.git', + root_dir = util.root_pattern('hardhat.config.*', '.git'), }, docs = { description = [[ @@ -13,7 +13,7 @@ https://docs.soliditylang.org/en/latest/installing-solidity.html solc is the native language server for the Solidity language. ]], default_config = { - root_dir = [[root_pattern(".git")]], + root_dir = [[root_pattern('hardhat.config.*', '.git')]], }, }, } -- cgit v1.2.3-70-g09d2