summaryrefslogtreecommitdiff
path: root/.config/nvim/lsp/astro.lua
diff options
context:
space:
mode:
authorKyren223 <Kyren223@proton.me>2025-04-27 14:12:18 +0300
committerKyren223 <Kyren223@proton.me>2025-04-27 14:12:18 +0300
commit21107f040b1579c1139ef0ca2ce993603d24826f (patch)
treeec72798215c80179689b9a92d1f147308771244d /.config/nvim/lsp/astro.lua
parent49be66e67afbbe27b4d93ec1ff39bc6c1d97e3ef (diff)
Massive nvim refactor, migrated from nvim-lspconfig to NVIM 0.11 lsp/*
also migrated most LSP clients to nix rather than mason
Diffstat (limited to '.config/nvim/lsp/astro.lua')
-rw-r--r--.config/nvim/lsp/astro.lua20
1 files changed, 20 insertions, 0 deletions
diff --git a/.config/nvim/lsp/astro.lua b/.config/nvim/lsp/astro.lua
new file mode 100644
index 0000000..2bee9fe
--- /dev/null
+++ b/.config/nvim/lsp/astro.lua
@@ -0,0 +1,20 @@
+-- https://github.com/withastro/language-tools/tree/main/packages/language-server
+
+local function get_typescript_server_path(root_dir)
+ local project_root = vim.fs.dirname(vim.fs.find('node_modules', { path = root_dir, upward = true })[1])
+ return project_root and vim.fs.joinpath(project_root, 'node_modules', 'typescript', 'lib') or ''
+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,
+}