Compare commits

...

2 commits

6 changed files with 82 additions and 12 deletions

View file

@ -15,7 +15,7 @@
./lualine.nix ./lualine.nix
./neo-tree.nix ./neo-tree.nix
./nvim-cmp.nix ./nvim-cmp.nix
./project.nix # ./project.nix
./rainbow-delimiters.nix ./rainbow-delimiters.nix
./telescope.nix ./telescope.nix
./toggleterm.nix ./toggleterm.nix

37
config/lsp/conform.nix Normal file
View file

@ -0,0 +1,37 @@
{ helpers, pkgs, ... }: {
plugins.conform-nvim = {
enable = true;
formatAfterSave = ''
{
format_after_save = {
lsp_format = "fallback",
},
}
'';
formattersByFt = {
python = [ "black" ];
c = [ "clang-format" ];
cpp = [ "clang-format" ];
cmake = [ "cmake_format" ];
nix = [ "nixfmt" ];
# Standalone scalafmt is too slow, so we use it as a fallback
scala = helpers.mkRaw ''
{ scalafmt, lsp_format = "prefer" }
'';
toml = [ "taplo" ];
yaml = [ "yq" ];
json = [ "jq" ];
};
};
extraPackages = with pkgs; [
black
clang-tools
cmake-format
jq
nixfmt-rfc-style
scalafmt
taplo
yq
];
}

View file

@ -1,5 +1,6 @@
{ {
imports = [ imports = [
./conform.nix
./lsp.nix ./lsp.nix
./lsp-format.nix ./lsp-format.nix
./lspkind.nix ./lspkind.nix

View file

@ -1,4 +1,4 @@
{ helpers, ... }: { pkgs, helpers, ... }:
{ {
plugins.lsp = { plugins.lsp = {
@ -69,6 +69,14 @@
}; };
}; };
}; };
onAttach = ''
require("lsp_signature").on_attach({
bind = true,
handler_opts = {
border = "rounded"
};
}, bufnr)
'';
}; };
keymaps = [ keymaps = [
@ -85,4 +93,20 @@
}; };
} }
]; ];
extraConfigLua = ''
require("lspconfig").asm_lsp.setup {
filetypes = { "asm", "s", "S" }
}
require("lspconfig").verible.setup { }
'';
extraPlugins = with pkgs.vimPlugins; [
lsp_signature-nvim
];
extraPackages = with pkgs; [
asm-lsp
verible
];
} }

View file

@ -8,12 +8,28 @@
extraPackages = [ extraPackages = [
pkgs.metals pkgs.metals
pkgs.scalafmt
]; ];
autoGroups.nvim_metals_group = { autoGroups.nvim_metals_group = {
clear = true; clear = true;
}; };
extraConfigLua = ''
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}",
excludedPackages = { "akka.actor.typed.javadsl", "com.github.swagger.akka.javadsl" },
useGlobalExecutable = true,
verboseCompilation = true
}
metals_config.capabilities = require("cmp_nvim_lsp").default_capabilities()
'';
autoCmd = [ autoCmd = [
{ {
event = "FileType"; event = "FileType";
@ -21,18 +37,10 @@
desc = "Initialize nvim-metals"; desc = "Initialize nvim-metals";
callback = helpers.mkRaw '' callback = helpers.mkRaw ''
function() 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
}
require("metals").initialize_or_attach(metals_config) require("metals").initialize_or_attach(metals_config)
end end
''; '';
pattern = [ "scala" "sbt" ];
} }
]; ];

View file

@ -5,7 +5,7 @@
enable = true; enable = true;
enableTelescope = true; enableTelescope = true;
silentChdir = false; silentChdir = false;
scopeChdir = "tab"; manualMode = true;
}; };
autoGroups.project_nvim_group = { autoGroups.project_nvim_group = {