1
0
Fork 0
mirror of https://github.com/nix-community/nixvim.git synced 2025-11-09 12:06:05 +01:00

plugins/lsp/vue_ls: add vtslsIntegration option

Add a vue_ls integration by default for vtsls in addition to tsls which
is already implemented (see #3771).

Haven't added it to Volar since it is deprecated anyway (#3600)
This commit is contained in:
sportshead 2025-10-13 01:04:49 +01:00
parent a830246ed9
commit c28c786439
No known key found for this signature in database
GPG key ID: A874DB2CBFD3CFD0

View file

@ -9,6 +9,15 @@ let
renamedServers = import ./_renamed.nix; renamedServers = import ./_renamed.nix;
unsupportedServers = lib.importJSON ../../../generated/unsupported-lspconfig-servers.json; unsupportedServers = lib.importJSON ../../../generated/unsupported-lspconfig-servers.json;
typescriptFiletypes = [
"javascript"
"javascriptreact"
"javascript.jsx"
"typescript"
"typescriptreact"
"typescript.tsx"
];
lspExtraArgs = { lspExtraArgs = {
dartls = { dartls = {
settingsOptions = import ./dartls-settings.nix { inherit lib helpers; }; settingsOptions = import ./dartls-settings.nix { inherit lib helpers; };
@ -122,14 +131,7 @@ let
# `plugins.lsp.servers.volar.tslsIntegration` and `plugins.lsp.servers.vue_ls.tslsIntegration` don't wipe out the default filetypes # `plugins.lsp.servers.volar.tslsIntegration` and `plugins.lsp.servers.vue_ls.tslsIntegration` don't wipe out the default filetypes
extraConfig = { extraConfig = {
plugins.lsp.servers.ts_ls = { plugins.lsp.servers.ts_ls = {
filetypes = [ filetypes = typescriptFiletypes;
"javascript"
"javascriptreact"
"javascript.jsx"
"typescript"
"typescriptreact"
"typescript.tsx"
];
}; };
}; };
}; };
@ -146,27 +148,52 @@ let
default = true; default = true;
example = false; example = false;
}; };
}; vtslsIntegration = mkOption {
extraConfig = cfg: opts: { type = types.bool;
assertions = lib.nixvim.mkAssertions "plugins.lsp.servers.vue_ls" { description = ''
assertion = cfg.tslsIntegration -> (cfg.package != null); Enable integration with vtsls.
message = "When `${opts.tslsIntegration}` is enabled, `${opts.package}` must not be null."; '';
default = true;
example = false;
}; };
plugins.lsp.servers.ts_ls = lib.mkIf (cfg.enable && cfg.tslsIntegration) { };
filetypes = [ "vue" ]; extraConfig =
extraOptions = { cfg: opts:
init_options = { let
plugins = lib.mkIf (cfg.package != null) [ plugin = {
{ name = "@vue/typescript-plugin";
name = "@vue/typescript-plugin"; location = "${lib.getBin cfg.package}/lib/language-tools/packages/language-server";
location = "${lib.getBin cfg.package}/lib/language-tools/packages/language-server"; languages = [ "vue" ];
languages = [ "vue" ]; };
} in
{
assertions = lib.nixvim.mkAssertions "plugins.lsp.servers.vue_ls" {
assertion = (cfg.tslsIntegration or cfg.vtslsIntegration) -> (cfg.package != null);
message = "When `${opts.tslsIntegration}` or `${opts.vtslsIntegration}` 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 = lib.mkIf (cfg.package != null) [ plugin ];
};
};
};
plugins.lsp.servers.vtsls = lib.mkIf (cfg.enable && cfg.vtslsIntegration) {
filetypes = typescriptFiletypes ++ [ "vue" ];
settings.vtsls.tsserver = {
globalPlugins = lib.mkIf (cfg.package != null) [
(
plugin
// {
configNamespace = "typescript";
enableForWorkspaceTypeScriptVersions = true;
}
)
]; ];
}; };
}; };
}; };
};
}; };
vls = { vls = {
extraOptions = { extraOptions = {