如何在 Lazyvim 上安装 tsserver?

问题描述 投票:0回答:1

我取消注释lazy.lua来安装tsserver和jsonls,但两者都安装失败。有谁能解决这个问题吗

enter image description here

我安装了运行lazy vim 所需的一切。然后我取消注释我想要作为 LSP 的列表。但安装失败

neovim liskov-substitution-principle mason
1个回答
0
投票

如果您使用 lua,请为 lsp-config.lua 创建一个文件,然后将其添加到文件中 ::

return {
  {
    "williamboman/mason.nvim",
    lazy = false,
    config = function()
      require("mason").setup()
    end,
  },
  {
    "williamboman/mason-lspconfig.nvim",
    lazy = false,
    opts = {
      auto_install = true,
    },
  },
  {
    "neovim/nvim-lspconfig",
    lazy = false,
    config = function()
      local capabilities = require("cmp_nvim_lsp").default_capabilities()

      -- Setup language servers.
      local lspconfig = require("lspconfig")
      lspconfig.tsserver.setup({capabilities = capabilities})
      lspconfig.eslint.setup({
        on_attach = function(client, bufnr)
          vim.api.nvim_create_autocmd("BufWritePre", {
            buffer = bufnr,
            command = "EslintFixAll",
          })
        end,
        capabilities = capabilities
      })
      require("lspconfig").eslint.setup({})
    end,
  },
};

tsserver 和 eslint 的代码以及一些代码编译... 如果有任何问题,我建议访问此存储库::

https://github.com/williamboman/mason-lspconfig.nvim https://github.com/neovim/nvimlspconfig/blob/master/doc/server_configurations.md#tsserver

© www.soinside.com 2019 - 2024. All rights reserved.