英文:
Lunar vim does not highlight syntax error on solidity, the default LSP does not show
问题
在我编写Solidity代码时,语法错误没有出现,每次都需要编译才能解决编译问题。
我尝试下载了几个Lunar VIM插件,也尝试添加了VSCode插件,但都没有生效。
英文:
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.
答案1
得分: 1
我找到了一种解决方法,通过全局安装nomicfoundation-solidity-language-server
并修改config.lua
中的Solidity LSP配置。
全局安装nomicfoundation-solidity-language-server
npm install @nomicfoundation/solidity-language-server -g
修改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,
},
}
英文:
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,
},
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论