From 96c9775a5f109565595d8f2995ade4d16eb64a42 Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Fri, 3 Oct 2025 18:56:36 +0100 Subject: [PATCH] plugins/lsp/volar: handle null package with ts_ls integration The ts_ls integration needs to call `getBin cfg.package`, so the package cannot be null. Adds an assertion. --- plugins/lsp/language-servers/default.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/lsp/language-servers/default.nix b/plugins/lsp/language-servers/default.nix index b3b4a458..302a585c 100644 --- a/plugins/lsp/language-servers/default.nix +++ b/plugins/lsp/language-servers/default.nix @@ -162,12 +162,16 @@ let example = false; }; }; - extraConfig = cfg: { + extraConfig = cfg: opts: { + assertions = lib.nixvim.mkAssertions "plugins.lsp.servers.volar" { + assertion = cfg.tslsIntegration -> (cfg.package != null); + message = "When `${opts.tslsIntegration}` is enabled, `${opts.package}` must not be null."; + }; plugins.lsp.servers.ts_ls = lib.mkIf (cfg.enable && cfg.tslsIntegration) { filetypes = [ "vue" ]; extraOptions = { init_options = { - plugins = [ + plugins = lib.mkIf (cfg.package != null) [ { name = "@vue/typescript-plugin"; location = "${lib.getBin cfg.package}/lib/language-tools/packages/language-server";