adds astro config
This commit is contained in:
parent
be9821eeab
commit
e0be4f1831
3 changed files with 27 additions and 0 deletions
|
|
@ -42,6 +42,7 @@
|
||||||
stylua
|
stylua
|
||||||
typescript-language-server
|
typescript-language-server
|
||||||
vscode-langservers-extracted
|
vscode-langservers-extracted
|
||||||
|
astro-language-server
|
||||||
lua-language-server
|
lua-language-server
|
||||||
prettierd
|
prettierd
|
||||||
eslint_d
|
eslint_d
|
||||||
|
|
|
||||||
25
modules/nvim/config/lsp/astro.lua
Normal file
25
modules/nvim/config/lsp/astro.lua
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
local function get_typescript_server_path(root_dir)
|
||||||
|
local project_roots = vim.fs.find("node_modules", { path = root_dir, upward = true, limit = math.huge })
|
||||||
|
for _, project_root in ipairs(project_roots) do
|
||||||
|
local typescript_path = project_root .. "/typescript"
|
||||||
|
local stat = vim.loop.fs_stat(typescript_path)
|
||||||
|
if stat and stat.type == "directory" then
|
||||||
|
return typescript_path .. "/lib"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
cmd = { "astro-ls", "--stdio" },
|
||||||
|
filetypes = { "astro" },
|
||||||
|
root_markers = { "package.json", "tsconfig.json", "jsconfig.json", ".git" },
|
||||||
|
init_options = {
|
||||||
|
typescript = {},
|
||||||
|
},
|
||||||
|
before_init = function(_, config)
|
||||||
|
if config.init_options and config.init_options.typescript and not config.init_options.typescript.tsdk then
|
||||||
|
config.init_options.typescript.tsdk = get_typescript_server_path(config.root_dir)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
@ -2,6 +2,7 @@ vim.lsp.enable("ts_ls")
|
||||||
vim.lsp.enable("lua_ls")
|
vim.lsp.enable("lua_ls")
|
||||||
vim.lsp.enable("jsonls")
|
vim.lsp.enable("jsonls")
|
||||||
vim.lsp.enable("nil_ls")
|
vim.lsp.enable("nil_ls")
|
||||||
|
vim.lsp.enable("astro")
|
||||||
|
|
||||||
vim.diagnostic.config({
|
vim.diagnostic.config({
|
||||||
virtual_text = false,
|
virtual_text = false,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue