gpt4 book ai didi

Neovim 选择语言提示

转载 作者:行者123 更新时间:2023-12-04 17:18:43 26 4
gpt4 key购买 nike

我正在将 Neovim 与 LSP 一起使用,但在保存我的任何 tsx 文件时遇到问题。我不断收到选择语言服务器的提示:
enter image description here
这是我如何配置我的语言服务器

lspinstall.setup()
local servers = lspinstall.installed_servers()

for _, lsp in ipairs(servers) do
if lsp == 'tsserver' then
require('lsp.tsserver')
elseif lsp == 'efm' then
require('lsp.efm')
elseif lsp == 'html' then
require('lsp.html')
else
nvim_lsp[lsp].setup {on_attach = on_attach, settings = {Lua = {diagnostics = {globals = {'vim'}}}}}
end
end
如果我这样做 :LspInfo我在屏幕截图中看到了 2 个服务器。
EFM 配置
local lspconfig = require 'lspconfig'

local prettier = {formatCommand = './node_modules/.bin/prettier --config-precedence prefer-file --stdin-filepath ${INPUT}', formatStdin = true}
local luaFormat = {
formatCommand = 'lua-format -i --no-keep-simple-function-one-line --column-limit=120 --indent-width=2 --double-quote-to-single-quote',
formatStdin = true
}

lspconfig.efm.setup {
-- cmd = {'efm-langserver', '-logfile', '/tmp/efm.log', '-loglevel', '5'},
on_attach = on_attach,
init_options = {documentFormatting = true},
filetypes = {'javascriptreact', 'javascript', 'lua', 'typescriptreact', 'typescript'},
settings = {
rootMarkers = {'.git/'},
languages = {lua = {luaFormat}, typescript = {prettier}, typescriptreact = {prettier}}
}
}
typescript 配置
local lspconfig = require 'lspconfig'

lspconfig.tsserver.setup {
on_attach = function(client, bufnr)
client.resolved_capabilities.document_formatting = false

on_attach(client, bufnr)
end,
settings = {diagnostics = {globals = {'on_attach'}}}
}
谢谢你的帮助

最佳答案

关于Neovim 选择语言提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67550082/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com