From de009fd679e10d053fdcc10785f91ad5317449ea Mon Sep 17 00:00:00 2001 From: awy Date: Tue, 14 Oct 2025 18:27:29 +0300 Subject: nvim revamp --- .config/nvim/lsp/astro.lua | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .config/nvim/lsp/astro.lua (limited to '.config/nvim/lsp/astro.lua') diff --git a/.config/nvim/lsp/astro.lua b/.config/nvim/lsp/astro.lua new file mode 100644 index 0000000..a85aae3 --- /dev/null +++ b/.config/nvim/lsp/astro.lua @@ -0,0 +1,25 @@ +---@brief +--- +--- https://github.com/withastro/language-tools/tree/main/packages/language-server +--- +--- `astro-ls` can be installed via `npm`: +--- ```sh +--- npm install -g @astrojs/language-server +--- ``` + +local util = require 'lspconfig.util' + +---@type vim.lsp.Config +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 = util.get_typescript_server_path(config.root_dir) + end + end, +} -- cgit v1.2.3