Lunar vim does not highlight syntax error on solidity, the default LSP does not show

248 Views Asked by At

When I was coding on solidity the syntax erros did not appear, every time I need to compile to solve see compilation problems.

I tried to download several plugins to Lunar VIM, tried to add vscode plugins too but did not work.

2

There are 2 best solutions below

1
On BEST ANSWER

I found a way to solve this by install global nomicfoundation-solidity-language-server and change config.lua solidity LSP.

Install nomicfoundation-solidity-language-server globally

npm install @nomicfoundation/solidity-language-server -g

Change config.lua

local lspconfig = require 'lspconfig'
local configs = require 'lspconfig.configs'

configs.solidity = {
 default_config = {
 cmd = {'nomicfoundation-solidity-language-server', '--stdio'},
 filetypes = { 'solidity' },
 root_dir = lspconfig.util.find_git_ancestor,
 single_file_support = true,
 },
}
1
On

For people using Mason, you can do :Mason and find the 'nomicfoundation-solidity-language-server' under the LSP tab and "I" for install. Should work out of the box.