lsp: use nvim-metals instead of lsp-config for scala

This commit is contained in:
xinyangli 2024-08-22 11:48:45 +08:00
parent 4ca81595ba
commit 7b5241304b
Signed by: xin
SSH key fingerprint: SHA256:qZ/tzd8lYRtUFSrfBDBMcUqV4GHKxqeqRA3huItgvbk
3 changed files with 58 additions and 4 deletions

View file

@ -3,5 +3,6 @@
./lsp.nix
./lsp-format.nix
./lspkind.nix
./nvim-metals.nix
];
}

View file

@ -1,4 +1,4 @@
{ ... }:
{ helpers, ... }:
{
plugins.lsp = {
@ -16,9 +16,6 @@
nixd = {
enable = true;
};
metals = {
enable = true;
};
};
inlayHints = true;
keymaps = {
@ -73,4 +70,19 @@
};
};
};
keymaps = [
{
mode = [ "n" ];
key = "<leader>th";
action = helpers.mkRaw ''
function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
end
'';
options = {
desc = "Toggle inlay hints";
};
}
];
}

View file

@ -0,0 +1,41 @@
{ pkgs, helpers, ... }:
{
extraPlugins = [
pkgs.vimPlugins.nvim-metals
pkgs.vimPlugins.plenary-nvim
];
extraPackages = [
pkgs.metals
];
autoGroups.nvim_metals_group = {
clear = true;
};
autoCmd = [
{
event = "FileType";
group = "nvim_metals_group";
desc = "Initialize nvim-metals";
callback = helpers.mkRaw ''
function()
metals_config = require("metals").bare_config()
metals_config.init_options.statusBarProvider = "off"
metals_config.settings = {
showInferredType = true,
showImplicitArguments = false,
showImplicitConversionsAndClasses = false,
metalsBinaryPath = "${pkgs.lib.getExe pkgs.metals}",
useGlobalExecutable = true
}
vim.lsp.inlay_hint.enable(true)
require("metals").initialize_or_attach(metals_config)
end
'';
}
];
plugins.fidget.enable = true;
}