mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 05:10:44 +00:00
languages/ts: update lspconfig; rename tsserver to ts_ls (#379)
Silence lspconfig, Microsoft naming convention is speaking.
This commit is contained in:
parent
27b3524508
commit
842b45b969
2 changed files with 47 additions and 6 deletions
|
@ -1136,11 +1136,11 @@
|
|||
"plugin-nvim-lspconfig": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1716498901,
|
||||
"narHash": "sha256-PMMqPDnq4Q8gWeKQ2WPE+pOf1R1G61wJ+bAWkHpQlzE=",
|
||||
"lastModified": 1727085470,
|
||||
"narHash": "sha256-IPpUZEMIL7+4mmqQLy9JeT0cW15/SH3Hx8kyksVcqC0=",
|
||||
"owner": "neovim",
|
||||
"repo": "nvim-lspconfig",
|
||||
"rev": "b972e7154bc94ab4ecdbb38c8edbccac36f83996",
|
||||
"rev": "dd329912c8d446240584a2dbcd3802af3a19105a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
|
||||
cfg = config.vim.languages.ts;
|
||||
|
||||
defaultServer = "tsserver";
|
||||
defaultServer = "ts_ls";
|
||||
servers = {
|
||||
tsserver = {
|
||||
ts_ls = {
|
||||
package = pkgs.typescript-language-server;
|
||||
lspConfig = ''
|
||||
lspconfig.tsserver.setup {
|
||||
lspconfig.ts_ls.setup {
|
||||
capabilities = capabilities;
|
||||
on_attach = attach_keymaps,
|
||||
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
|
||||
|
@ -65,6 +83,7 @@
|
|||
)
|
||||
'';
|
||||
};
|
||||
|
||||
prettierd = {
|
||||
package = pkgs.prettierd;
|
||||
nullConfig = ''
|
||||
|
@ -94,6 +113,7 @@
|
|||
};
|
||||
};
|
||||
in {
|
||||
_file = ./ts.nix;
|
||||
options.vim.languages.ts = {
|
||||
enable = mkEnableOption "Typescript/Javascript language support";
|
||||
|
||||
|
@ -190,11 +210,32 @@ in {
|
|||
};
|
||||
})
|
||||
|
||||
# Extensions
|
||||
(mkIf cfg.extensions."ts-error-translator".enable {
|
||||
vim.startPlugins = ["ts-error-translator"];
|
||||
vim.pluginRC.ts-error-translator = entryAnywhere ''
|
||||
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