diff options
| author | E.T <8301962+ETLaurent@users.noreply.github.com> | 2026-02-04 23:31:26 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-04 17:31:26 -0500 |
| commit | b3a4eb8f5296c4581eaffd5d23f4601a9b17ca99 (patch) | |
| tree | f15cbf516eb5299a6ab7860670f62c29e4a8deea | |
| parent | docs: update configs.md (diff) | |
| download | nvim-lspconfig-b3a4eb8f5296c4581eaffd5d23f4601a9b17ca99.tar nvim-lspconfig-b3a4eb8f5296c4581eaffd5d23f4601a9b17ca99.tar.gz nvim-lspconfig-b3a4eb8f5296c4581eaffd5d23f4601a9b17ca99.tar.bz2 nvim-lspconfig-b3a4eb8f5296c4581eaffd5d23f4601a9b17ca99.tar.lz nvim-lspconfig-b3a4eb8f5296c4581eaffd5d23f4601a9b17ca99.tar.xz nvim-lspconfig-b3a4eb8f5296c4581eaffd5d23f4601a9b17ca99.tar.zst nvim-lspconfig-b3a4eb8f5296c4581eaffd5d23f4601a9b17ca99.zip | |
docs(astro): example to fix tsdk path not found error #4307
| -rw-r--r-- | lsp/astro.lua | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/lsp/astro.lua b/lsp/astro.lua index a85aae39..c9fc4c1c 100644 --- a/lsp/astro.lua +++ b/lsp/astro.lua @@ -6,6 +6,42 @@ --- ```sh --- npm install -g @astrojs/language-server --- ``` +--- +--- If typescript is installed globally, you might get the `\`typescript.tsdk\` init option is required` error. +--- You will need to manually pass the typescript SDK path. Here is an example of a Nix configuration where typescript is installed via Nix's Home-manager: +--- +--- ```nix +--- { config, pkgs, ... }: +--- +--- { +--- home.packages = with pkgs; [ +--- typescript +--- ]; +--- +--- programs.neovim = { +--- plugins = with pkgs.vimPlugins; [ +--- nvim-lspconfig +--- ]; +--- extraPackages = with pkgs; [ +--- astro-language-server +--- ]; +--- initLua = '' +--- vim.lsp.config['astro'] = { +--- init_options = { +--- typescript = { +--- tsdk = ${pkgs.typescript}/lib/node_modules/typescript/lib, +--- }, +--- }, +--- } +--- +--- vim.lsp.enable('astro') +--- +--- -- ... +--- ''; +--- }; +--- } +--- ``` +--- The path can also be passed via a variable, like `vim.g.tsdk = "${pkgs.typescript}/lib/node_modules/typescript/lib"` and then used in the Lua Neovim config. local util = require 'lspconfig.util' |
