mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
plugins/lsp/volar: add ts-ls integration
This commit is contained in:
parent
384f97cf50
commit
a8ab73432a
2 changed files with 89 additions and 1 deletions
|
@ -691,6 +691,32 @@ let
|
|||
"nodePackages"
|
||||
"@volar/vue-language-server"
|
||||
];
|
||||
extraOptions = {
|
||||
tslsIntegration = mkOption {
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Enable integration with TypeScript language server.
|
||||
'';
|
||||
default = true;
|
||||
example = false;
|
||||
};
|
||||
};
|
||||
extraConfig = cfg: {
|
||||
plugins.lsp.servers.ts-ls = lib.mkIf (cfg.enable && cfg.tslsIntegration) {
|
||||
filetypes = [ "vue" ];
|
||||
extraOptions = {
|
||||
init_options = {
|
||||
plugins = [
|
||||
{
|
||||
name = "@vue/typescript-plugin";
|
||||
location = "${lib.getBin cfg.package}/lib/node_modules/@vue/language-server";
|
||||
languages = [ "vue" ];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "yamlls";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, ... }:
|
||||
{ lib, pkgs, ... }:
|
||||
{
|
||||
empty = {
|
||||
plugins.lsp.enable = true;
|
||||
|
@ -222,4 +222,66 @@
|
|||
};
|
||||
};
|
||||
};
|
||||
|
||||
volar-tsls-integration =
|
||||
{ config, ... }:
|
||||
{
|
||||
plugins.lsp = {
|
||||
enable = true;
|
||||
servers = {
|
||||
volar.enable = true;
|
||||
ts-ls = {
|
||||
enable = true;
|
||||
filetypes = [ "typescript" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
assertions = [
|
||||
{
|
||||
assertion = lib.any (x: x == "vue") config.plugins.lsp.servers.ts-ls.filetypes;
|
||||
message = "Expected `vue` filetype configuration.";
|
||||
}
|
||||
{
|
||||
assertion = lib.any (
|
||||
x: x.name == "@vue/typescript-plugin"
|
||||
) config.plugins.lsp.servers.ts-ls.extraOptions.init_options.plugins;
|
||||
message = "Expected `@vue/typescript-plugin` plugin.";
|
||||
}
|
||||
{
|
||||
assertion = lib.any (x: x == "typescript") config.plugins.lsp.servers.ts-ls.filetypes;
|
||||
message = "Expected `typescript` filetype configuration.";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
tsls-filetypes =
|
||||
{ config, ... }:
|
||||
{
|
||||
plugins.lsp = {
|
||||
enable = true;
|
||||
servers = {
|
||||
ts-ls = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
assertions = [
|
||||
{
|
||||
assertion = lib.all (x: x != "vue") config.plugins.lsp.servers.ts-ls.filetypes;
|
||||
message = "Did not expect `vue` filetype configuration.";
|
||||
}
|
||||
(lib.mkIf (config.plugins.lsp.servers.ts-ls.extraOptions ? init_options) {
|
||||
assertion = lib.all (
|
||||
x: x.name != "@vue/typescript-plugin"
|
||||
) config.plugins.lsp.servers.ts-ls.extraOptions.init_options.plugins;
|
||||
message = "Did not expect `@vue/typescript-plugin` plugin.";
|
||||
})
|
||||
{
|
||||
assertion = lib.any (x: x == "typescript") config.plugins.lsp.servers.ts-ls.filetypes;
|
||||
message = "Expected `typescript` filetype configuration.";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue