How do i install tsserver on Lazyvim?

785 Views Asked by At

I uncomment the lazy.lua to install tsserver and jsonls but both are failed to install. Can anybody solve this problem.

enter image description here

I installed everything that requires to run lazy vim. Then i uncomment the list which i want as LSP. But failed to installed

1

There are 1 best solutions below

3
Yossef Sabry On

if you in using lua then make a file for lsp-config.lua then add this to the file ::

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

the code for tsserver and eslint and some code complation for tsserver... if there any problem then i suggest to visit this repos ::

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