ecosse3 / nvim

A non-minimal Neovim config built to work most efficiently with Frontend Development
GNU General Public License v3.0
1.21k stars 109 forks source link

How to install language server for .astro files? #90

Closed hitfm00 closed 2 years ago

hitfm00 commented 2 years ago

I found this https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#astro But don't understand how to implement this language server to the nvim

ecosse3 commented 2 years ago

You just need to do two steps:

  1. Install astro-language-server via :Mason (just press i on it).
  2. Add it to table in lua/lsp/setup.lua:

for _, server in ipairs { "bashls", "graphql", "html", "volar", "prismals" } do

In the next version of Ecovim (3.0) I'll configure ease of user-customizable config but it has to wait a bit.

hitfm00 commented 2 years ago

Thanks! But I went a little different way

lua/lsp/setup.lua added this:

Снимок экрана 2022-08-24 в 00 49 38

lsp/servers/astro.lua added this:

local M = {}

 M.setup = function()
   local lsp = require("lspconfig")
   local on_attach = require("lsp.on_attach")
   local opts = {
     on_attach = function(client, bufnr)
       client.server_capabilities.document_formatting = false
       client.server_capabilities.document_range_formatting = false

       on_attach(client, bufnr)
     end,
     capabilities = require("lsp.capabilities"),
     flags = { debounce_text_changes = 150 },
   }

   lsp.astro.setup(opts)
 end

 return M

I don't know why, but :Mason and press I didn't work for me.

I like EcoVim, Good work! :)