aboutsummaryrefslogtreecommitdiffstats
path: root/lsp/mdx_analyzer.lua
diff options
context:
space:
mode:
authorMuntasir Mahmud <muntasir.joypurhat@gmail.com>2025-04-22 13:25:37 +0600
committerGitHub <noreply@github.com>2025-04-22 15:25:37 +0800
commit0cac07773817274d8de8d6df8b10edb691c5580e (patch)
treecf270dce3db5efab8390f03f99c718fe1003e69a /lsp/mdx_analyzer.lua
parentdocs: update configs.md (diff)
downloadnvim-lspconfig-0cac07773817274d8de8d6df8b10edb691c5580e.tar
nvim-lspconfig-0cac07773817274d8de8d6df8b10edb691c5580e.tar.gz
nvim-lspconfig-0cac07773817274d8de8d6df8b10edb691c5580e.tar.bz2
nvim-lspconfig-0cac07773817274d8de8d6df8b10edb691c5580e.tar.lz
nvim-lspconfig-0cac07773817274d8de8d6df8b10edb691c5580e.tar.xz
nvim-lspconfig-0cac07773817274d8de8d6df8b10edb691c5580e.tar.zst
nvim-lspconfig-0cac07773817274d8de8d6df8b10edb691c5580e.zip
feat(mdx_analyzer): add vim.lsp.config support (#3757)
Diffstat (limited to 'lsp/mdx_analyzer.lua')
-rw-r--r--lsp/mdx_analyzer.lua25
1 files changed, 25 insertions, 0 deletions
diff --git a/lsp/mdx_analyzer.lua b/lsp/mdx_analyzer.lua
new file mode 100644
index 00000000..36b84239
--- /dev/null
+++ b/lsp/mdx_analyzer.lua
@@ -0,0 +1,25 @@
+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
+
+---@brief
+---https://github.com/mdx-js/mdx-analyzer
+---
+---`mdx-analyzer`, a language server for MDX
+
+return {
+ cmd = { 'mdx-language-server', '--stdio' },
+ filetypes = { 'mdx' },
+ root_markers = { 'package.json' },
+ single_file_support = true,
+ settings = {},
+ 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,
+}