Goal is to create and provide improved devex over current extensions for foundry projects with maybe hardhat support(through foundry) in future.
- Formatting (with foundry, same as
forge fmt
while respecting configs) - Diagnostics (compiler errors and warnings on standard dapptools/foundry structure projects work. Optimizations, configurations, perf, etc. yet to come)
- Outline (could add more details)
- Install the language server:
# ensure that ~/.cargo/bin is in your path for the extension to be able to find it cargo +nightly install --git https://github.com/parmanuxyz/solidity-analyzer --bin solidity-analyzer-ls
- Install the companion vscode prerelease extension from the marketplace
$ cargo b
Check the configuration path below. Logs are located in ~/solidity-analyzer.log
Open extension.ts
in VSCode and run in debug mode
with F5.
Install the pre-release from VSCode marketplace here.
The extension will try to run the language server from the paths in following order:
solidity-analyzer.languageServerPath
configuration value if it existsSOLIDITY_ANALYZER_SERVER_PATH
environment variable if it exists- Will search the folders in
PATH
to see ifsolidity-analyzer-ls
exists in any of them. Will run the first entry it'd find. - If it doesn't even exist in the
PATH
it will try~/bin/solidity-analyzer-ls
. - If found nowhere it'd show an error and exit.
Configure neovim to use solidity-analyzer-ls as follows:
local configs = require 'lspconfig.configs'
local lspconfig = require 'lspconfig'
-- Check if the config is already defined (useful when reloading this file)
if not configs.solidity_analyer_lsp then
configs.solidity_analyzer_lsp = {
default_config = {
cmd = {vim.fn.expand('$HOME/.cargo/bin/solidity-analyzer-ls')},
filetypes = {'solidity'},
root_dir = lspconfig.util.root_pattern('foundry.toml') or function(fname)
return lspconfig.util.find_git_ancestor(fname)
end,
settings = {},
},
}
end
lspconfig.solidity_analyzer_lsp.setup{}