Lunar Vim不会在Solidity上突出显示语法错误,默认的LSP也不会显示。

huangapple go评论85阅读模式
英文:

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,
 },
}

huangapple
  • 本文由 发表于 2023年6月13日 05:02:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/76460317.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定