feat: Initial jdtls support

This commit is contained in:
AmanSe 2023-08-09 10:11:48 +05:30
parent cefae48b08
commit 13878ce081
No known key found for this signature in database
3 changed files with 47 additions and 0 deletions

View file

@ -64,6 +64,7 @@ inputs: let
enable = isMaximal; enable = isMaximal;
crates.enable = true; crates.enable = true;
}; };
java.enable = isMaximal;
ts.enable = isMaximal; ts.enable = isMaximal;
svelte.enable = isMaximal; svelte.enable = isMaximal;
go.enable = isMaximal; go.enable = isMaximal;

View file

@ -23,6 +23,7 @@ in {
./zig.nix ./zig.nix
./html.nix ./html.nix
./svelte.nix ./svelte.nix
./java.nix
]; ];
options.vim.languages = { options.vim.languages = {

View file

@ -0,0 +1,45 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.languages.java;
in {
options.vim.languages.java = {
enable = mkEnableOption "Java language support";
treesitter = {
enable = mkEnableOption "Enable Java treesitter" // {default = config.vim.languages.enableTreesitter;};
package = nvim.types.mkGrammarOption pkgs "java";
};
lsp = {
enable = mkEnableOption "Java LSP support (java-language-server)" // {default = config.vim.languages.enableLSP;};
package = mkOption {
description = "java language server";
type = types.package;
default = pkgs.jdt-language-server;
};
};
};
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.lsp.enable {
vim.lsp.lspconfig.enable = true;
vim.lsp.lspconfig.sources.jdtls = ''
lspconfig.jdtls.setup {
cmd = {"${cfg.lsp.package}/bin/jdt-language-server", "-data", vim.fn.stdpath("cache").."/jdtls/workspace"},
}
'';
})
(mkIf cfg.treesitter.enable {
vim.treesitter.enable = true;
vim.treesitter.grammars = [cfg.treesitter.package];
})
]);
}