2023-06-19 15:59:04 +08:00
|
|
|
local util = require 'lspconfig.util'
|
|
|
|
|
2024-05-21 12:31:14 +08:00
|
|
|
local root_files = {
|
|
|
|
'hardhat.config.js',
|
|
|
|
'hardhat.config.ts',
|
|
|
|
'foundry.toml',
|
|
|
|
'remappings.txt',
|
|
|
|
'truffle.js',
|
|
|
|
'truffle-config.js',
|
|
|
|
'ape-config.yaml',
|
|
|
|
}
|
|
|
|
|
2023-06-19 15:59:04 +08:00
|
|
|
return {
|
|
|
|
default_config = {
|
|
|
|
cmd = { 'nomicfoundation-solidity-language-server', '--stdio' },
|
|
|
|
filetypes = { 'solidity' },
|
2024-05-21 12:31:14 +08:00
|
|
|
root_dir = util.root_pattern(unpack(root_files)) or util.root_pattern('.git', 'package.json'),
|
|
|
|
single_file_support = true,
|
2023-06-19 15:59:04 +08:00
|
|
|
},
|
|
|
|
docs = {
|
|
|
|
description = [[
|
|
|
|
https://github.com/NomicFoundation/hardhat-vscode/blob/development/server/README.md
|
|
|
|
|
2024-05-21 12:31:14 +08:00
|
|
|
`nomicfoundation-solidity-language-server` can be installed via `npm`:
|
|
|
|
|
|
|
|
```sh
|
|
|
|
npm install -g @nomicfoundation/solidity-language-server
|
|
|
|
```
|
2023-06-19 15:59:04 +08:00
|
|
|
|
|
|
|
A language server for the Solidity programming language, built by the Nomic Foundation for the Ethereum community.
|
|
|
|
]],
|
|
|
|
default_config = {
|
2024-05-21 12:31:14 +08:00
|
|
|
root_dir = [[root_pattern("]] .. table.concat(root_files, '", "') .. [[", ".git", "package.json")]],
|
2023-06-19 15:59:04 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|