mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-02-24 04:18:03 +00:00
kotlin: LSP and treesitter
This commit is contained in:
parent
dd2f73ba84
commit
1ece52ed42
4 changed files with 59 additions and 2 deletions
|
@ -51,6 +51,7 @@ isMaximal: {
|
|||
css.enable = isMaximal;
|
||||
sql.enable = isMaximal;
|
||||
java.enable = isMaximal;
|
||||
kotlin.enable = isMaximal;
|
||||
ts.enable = isMaximal;
|
||||
svelte.enable = isMaximal;
|
||||
go.enable = isMaximal;
|
||||
|
|
|
@ -9,6 +9,7 @@ in {
|
|||
./elixir.nix
|
||||
./go.nix
|
||||
./haskell.nix
|
||||
./kotlin.nix
|
||||
./html.nix
|
||||
./java.nix
|
||||
./lua.nix
|
||||
|
|
|
@ -20,7 +20,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Haskell LSP support (haskell-language-server)" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Haskell LSP support (haskell-language-server)" // {default = true;};
|
||||
|
||||
package = mkOption {
|
||||
description = "haskell_ls package";
|
||||
|
@ -41,7 +41,7 @@ in {
|
|||
lspconfig.haskell_ls.setup {
|
||||
capabilities = capabilities,
|
||||
on_attach=default_on_attach,
|
||||
cmd = "${cfg.lsp.package}/bin/haskell-language-server-wrapper",
|
||||
cmd = "${cfg.lsp.package}/bin/haskell-language-server",
|
||||
}
|
||||
'';
|
||||
})
|
||||
|
|
55
modules/plugins/languages/kotlin.nix
Normal file
55
modules/plugins/languages/kotlin.nix
Normal file
|
@ -0,0 +1,55 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.types) package;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
|
||||
cfg = config.vim.languages.kotlin;
|
||||
in {
|
||||
options.vim.languages.kotlin = {
|
||||
enable = mkEnableOption "kotlin/HCL support";
|
||||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "kotlin treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = mkGrammarOption pkgs "kotlin";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "kotlin LSP support (kotlin-ls)" // {default = config.vim.languages.enableLSP;};
|
||||
|
||||
package = mkOption {
|
||||
description = "kotlin-ls package";
|
||||
type = package;
|
||||
default = pkgs.kotlin-language-server;
|
||||
};
|
||||
};
|
||||
};
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter.enable = true;
|
||||
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||
})
|
||||
|
||||
(mkIf cfg.lsp.enable {
|
||||
vim.lsp.lspconfig.enable = true;
|
||||
vim.lsp.lspconfig.sources.kotlin-ls = ''
|
||||
lspconfig.kotlinls.setup {
|
||||
capabilities = capabilities,
|
||||
on_attach=default_on_attach,
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''{"${cfg.lsp.package}/bin/kotlin-language-server"}''
|
||||
},
|
||||
}
|
||||
'';
|
||||
})
|
||||
]);
|
||||
}
|
Loading…
Add table
Reference in a new issue