从Packer迁移至Lazy后Neovim调用lua-language-server提示权限拒绝的问题求助
从Packer迁移至Lazy后Neovim调用lua-language-server提示权限拒绝的问题求助
最近我把Neovim的插件管理器从Packer换成了Lazy,目前用LSP、LspConfig、Mason和MasonLspConfig搭配好几个语言服务器做开发。但现在遇到个麻烦:Neovim没法正常访问这些服务器了,之前用Packer的时候完全没问题。我翻来覆去检查配置,还是找不到问题出在哪。
先说明下目前的情况:
- 所有语言服务器都已经通过Mason安装完成,并且已经添加到系统PATH中
- 单独在终端里执行
lua-language-server命令是可以正常运行的,没有权限问题 - 我使用的默认shell是Fish
- 具体报错信息是:
Spawning language server with cmd:
lua-language-serverfailed with error message: EACCES: permission denied
下面是我的Lazy插件配置文件:
return { { "lvimuser/lsp-inlayhints.nvim" }, { "neovim/nvim-lspconfig", dependencies = { "lvimuser/lsp-inlayhints.nvim" }, config = function() local lspconfig = require("lspconfig") lspconfig.gopls.setup({ on_attach = function(client, bufnr) require("settings/shared").on_attach(client, bufnr) require("lsp-inlayhints").setup({ inlay_hints = { type_hints = { prefix = "=> " }, }, }) require("lsp-inlayhints").on_attach(client, bufnr) require("illuminate").on_attach(client) end, settings = { gopls = { analyses = { nilness = true, unusedparams = true, unusedwrite = true, useany = true, }, experimentalPostfixCompletions = true, gofumpt = true, staticcheck = true, usePlaceholders = true, hints = { assignVariableTypes = true, compositeLiteralFields = true, compositeLiteralTypes = true, constantValues = true, functionTypeParameters = true, parameterNames = true, rangeVariableTypes = true, } }, }, }) end }, { "williamboman/mason.nvim" }, { "Afourcat/treesitter-terraform-doc.nvim" }, { "williamboman/mason-lspconfig.nvim", dependencies = { "williamboman/mason.nvim" }, config = function() local mason_lspconfig = require("mason-lspconfig") mason_lspconfig.setup({ PATH = "prepend", ensure_installed = { "eslint", "gopls", -- WARNING: This could be an issue with goenv switching. "marksman", "rust_analyzer", "sumneko_lua", "terraformls", "tflint", "tsserver", "yamlls", } }) mason_lspconfig.setup_handlers({ function(server_name) require("lspconfig")[server_name].setup({ on_attach = function(client, bufnr) require("settings/shared").on_attach(client, bufnr) require("illuminate").on_attach(client) if server_name == "terraformls" then require("treesitter-terraform-doc").setup() end end }) end }) end }, { "simrat39/symbols-outline.nvim", config = function() require("symbols-outline").setup({ -- autofold_depth = 1, -- h: close, l: open, W: close all, E: open all auto_close = false, highlight_hovered_item = true, position = "left", width = 15, symbols = { File = { icon = "", hl = "GruvboxAqua" }, -- TSURI Module = { icon = "", hl = "GruvboxBlue" }, -- TSNamespace Namespace = { icon = "", hl = "GruvboxBlue" }, -- TSNamespace Package = { icon = "", hl = "GruvboxBlue" }, -- TSNamespace Class = { icon = "𝓒", hl = "GruvboxGreen" }, -- TSType Method = { icon = "ƒ", hl = "GruvboxOrange" }, -- TSMethod Property = { icon = "", hl = "GruvboxOrange" }, -- TSMethod Field = { icon = "", hl = "GruvboxRed" }, -- TSField Constructor = { icon = "", hl = "TSConstructor" }, Enum = { icon = "ℰ", hl = "GruvboxGreen" }, -- TSType Interface = { icon = "ﰮ", hl = "GruvboxGreen" }, -- TSType Function = { icon = "", hl = "GruvboxYellow" }, -- TSFunction Variable = { icon = "", hl = "GruvboxPurple" }, -- TSConstant Constant = { icon = "", hl = "GruvboxPurple" }, -- TSConstant String = { icon = "𝓐", hl = "GruvboxGray" }, -- TSString Number = { icon = "#", hl = "TSNumber" }, Boolean = { icon = "⊨", hl = "TSBoolean" }, Array = { icon = "", hl = "GruvboxPurple" }, -- TSConstant Object = { icon = "⦿", hl = "GruvboxGreen" }, -- TSType Key = { icon = "🔐", hl = "GruvboxGreen" }, -- TSType Null = { icon = "NULL", hl = "GruvboxGreen" }, -- TSType EnumMember = { icon = "", hl = "GruvboxRed" }, -- TSField Struct = { icon = "𝓢", hl = "GruvboxGreen" }, -- TSType Event = { icon = "🗲", hl = "GruvboxGreen" }, -- TSType Operator = { icon = "+", hl = "TSOperator" }, TypeParameter = { icon = "𝙏", hl = "GruvboxRed" } --TTSParameter }, }) end }, { "mfussenegger/nvim-lint", config = function() local lint = require("lint") lint.linters_by_ft = { go = { "golangcilint" }, -- ~/.golangci.yml } -- see ./lsp.lua for calls to this plugin's try_lint() function. end }, }
备注:内容来源于stack exchange,提问作者Daniel
相关产品推荐
相关产品推荐

