mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-26 15:06:45 +00:00
languages/ts: rename tsserver to ts_ls as per upstream instructions
Silence lspconfig, Microsoft naming convention is speaking.
This commit is contained in:
parent
9ab18adf0e
commit
6c72ac235c
1 changed files with 44 additions and 3 deletions
|
@ -17,12 +17,12 @@
|
||||||
|
|
||||||
cfg = config.vim.languages.ts;
|
cfg = config.vim.languages.ts;
|
||||||
|
|
||||||
defaultServer = "tsserver";
|
defaultServer = "ts_ls";
|
||||||
servers = {
|
servers = {
|
||||||
tsserver = {
|
ts_ls = {
|
||||||
package = pkgs.typescript-language-server;
|
package = pkgs.typescript-language-server;
|
||||||
lspConfig = ''
|
lspConfig = ''
|
||||||
lspconfig.tsserver.setup {
|
lspconfig.ts_ls.setup {
|
||||||
capabilities = capabilities;
|
capabilities = capabilities;
|
||||||
on_attach = attach_keymaps,
|
on_attach = attach_keymaps,
|
||||||
cmd = ${
|
cmd = ${
|
||||||
|
@ -49,6 +49,24 @@
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Here for backwards compatibility. Still consider tsserver a valid
|
||||||
|
# configuration in the enum, but assert if it's set to *properly*
|
||||||
|
# redirect the user to the correct server.
|
||||||
|
tsserver = {
|
||||||
|
package = pkgs.typescript-language-server;
|
||||||
|
lspConfig = ''
|
||||||
|
lspconfig.ts_ls.setup {
|
||||||
|
capabilities = capabilities;
|
||||||
|
on_attach = attach_keymaps,
|
||||||
|
cmd = ${
|
||||||
|
if isList cfg.lsp.package
|
||||||
|
then expToLua cfg.lsp.package
|
||||||
|
else ''{"${cfg.lsp.package}/bin/typescript-language-server", "--stdio"}''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# TODO: specify packages
|
# TODO: specify packages
|
||||||
|
@ -65,6 +83,7 @@
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
prettierd = {
|
prettierd = {
|
||||||
package = pkgs.prettierd;
|
package = pkgs.prettierd;
|
||||||
nullConfig = ''
|
nullConfig = ''
|
||||||
|
@ -94,6 +113,7 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
_file = ./ts.nix;
|
||||||
options.vim.languages.ts = {
|
options.vim.languages.ts = {
|
||||||
enable = mkEnableOption "Typescript/Javascript language support";
|
enable = mkEnableOption "Typescript/Javascript language support";
|
||||||
|
|
||||||
|
@ -190,11 +210,32 @@ in {
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
|
# Extensions
|
||||||
(mkIf cfg.extensions."ts-error-translator".enable {
|
(mkIf cfg.extensions."ts-error-translator".enable {
|
||||||
vim.startPlugins = ["ts-error-translator"];
|
vim.startPlugins = ["ts-error-translator"];
|
||||||
vim.pluginRC.ts-error-translator = entryAnywhere ''
|
vim.pluginRC.ts-error-translator = entryAnywhere ''
|
||||||
require("ts-error-translator").setup(${toLuaObject cfg.extensions.ts-error-translator.setupOpts})
|
require("ts-error-translator").setup(${toLuaObject cfg.extensions.ts-error-translator.setupOpts})
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
|
||||||
|
# Warn the user if they have set the default server name to tsserver to match upstream (us)
|
||||||
|
# The name "tsserver" has been deprecated in lspconfig, and now should be called ts_ls. This
|
||||||
|
# is a purely cosmetic change, but emits a warning if not accounted for.
|
||||||
|
{
|
||||||
|
assertions = [
|
||||||
|
{
|
||||||
|
assertion = cfg.lsp.enable -> cfg.lsp.server != "tsserver";
|
||||||
|
message = ''
|
||||||
|
As of a recent lspconfig update, he `tsserver` configuration has been renamed
|
||||||
|
to `ts_ls` to match upstream behaviour of `lspconfig`, and the name `tsserver`
|
||||||
|
is no longer considered valid by nvf. Please set `vim.languages.ts.lsp.server`
|
||||||
|
to `"ts_ls"` instead of to `${cfg.lsp.server}`
|
||||||
|
|
||||||
|
Please see <https://github.com/neovim/nvim-lspconfig/pull/3232> for more details
|
||||||
|
about this change.
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue