1

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
  • azyVim the well-named. Commented Jan 7, 2024 at 7:34

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

3 Comments

hey can you tell me the path where i would create lsp-config.lua file?
Thank you for contributing to the Stack Overflow community. This may be a correct answer, but it’d be really useful to provide additional explanation of your code so developers can understand your reasoning. This is especially useful for new developers who aren’t as familiar with the syntax or struggling to understand the concepts. Would you kindly edit your answer to include additional details for the benefit of the community?
okay github.com/yossefsabry/vim-lazy-configuration/tree/main/lua/… visit this link this my nvim configurtion using lazy you can to clone the repo and source the init.lua file then its will work but you must donwload the lsp-config from mason by type :Mason in cammed mode the search for the lsp-confg you when then install then its gone work with you if you dont went to clone the repositery then i suggest to visit lsp-config git repo its explain every thing in details github.com/neovim/nvim-lspconfig
0

I meet the same problem ! I look the MasonLog, and find the key is npm is not executable, so you can try to download the npm, I have solved my problems perfectly!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.