mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-02-24 04:18:03 +00:00
merge
This commit is contained in:
commit
657b6fb0d2
5 changed files with 145 additions and 0 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;
|
||||
|
@ -61,6 +62,7 @@ isMaximal: {
|
|||
dart.enable = isMaximal;
|
||||
bash.enable = isMaximal;
|
||||
r.enable = isMaximal;
|
||||
haskell.enable = isMaximal;
|
||||
tailwind.enable = isMaximal;
|
||||
typst.enable = isMaximal;
|
||||
clang = {
|
||||
|
|
|
@ -8,6 +8,8 @@ in {
|
|||
./css.nix
|
||||
./elixir.nix
|
||||
./go.nix
|
||||
./haskell.nix
|
||||
./kotlin.nix
|
||||
./html.nix
|
||||
./java.nix
|
||||
./lua.nix
|
||||
|
|
55
modules/plugins/languages/haskell.nix
Normal file
55
modules/plugins/languages/haskell.nix
Normal file
|
@ -0,0 +1,55 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
inherit (lib.types) package;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
|
||||
cfg = config.vim.languages.haskell;
|
||||
in {
|
||||
options.vim.languages.haskell = {
|
||||
enable = mkEnableOption "Haskell support";
|
||||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "Haskell treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = mkGrammarOption pkgs "haskell";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Haskell LSP support (haskell-language-server)" // {default = true;};
|
||||
|
||||
package = mkOption {
|
||||
description = "haskell_ls package";
|
||||
type = package;
|
||||
default = pkgs.haskell-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.hls = ''
|
||||
lspconfig.hls.setup {
|
||||
capabilities = capabilities,
|
||||
on_attach=default_on_attach,
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''{"${cfg.lsp.package}/bin/haskell-language-server-wrapper", "--lsp"}''
|
||||
},
|
||||
}
|
||||
'';
|
||||
})
|
||||
]);
|
||||
}
|
75
modules/plugins/languages/kotlin.nix
Normal file
75
modules/plugins/languages/kotlin.nix
Normal file
|
@ -0,0 +1,75 @@
|
|||
{
|
||||
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;
|
||||
|
||||
# Creating a version of the LSP with access to the kotlin binary.
|
||||
# This is necessary for the LSP to load the standard library
|
||||
kotlinLspWithRuntime = pkgs.symlinkJoin {
|
||||
name = "kotlin-language-server-with-runtime";
|
||||
paths = [
|
||||
pkgs.kotlin-language-server
|
||||
pkgs.kotlin
|
||||
];
|
||||
buildInputs = [pkgs.makeWrapper];
|
||||
postBuild = ''
|
||||
wrapProgram $out/bin/kotlin-language-server \
|
||||
--prefix PATH : ${pkgs.lib.makeBinPath [pkgs.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_language_server)" // {default = config.vim.languages.enableLSP;};
|
||||
|
||||
package = mkOption {
|
||||
description = "kotlin_language_server package with Kotlin runtime";
|
||||
type = package;
|
||||
default = kotlinLspWithRuntime;
|
||||
};
|
||||
};
|
||||
};
|
||||
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_language_server = ''
|
||||
lspconfig.kotlin_language_server.setup {
|
||||
capabilities = capabilities,
|
||||
root_dir = lspconfig.util.root_pattern("main.kt", ".git"),
|
||||
on_attach=default_on_attach,
|
||||
init_options = {
|
||||
-- speeds up the startup time for the LSP
|
||||
storagePath = "vim.fn.stdpath('state') .. '/kotlin'",
|
||||
},
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''{"${cfg.lsp.package}/bin/kotlin-language-server"}''
|
||||
},
|
||||
}
|
||||
'';
|
||||
})
|
||||
]);
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
{lib, ...}: let
|
||||
<<<<<<< HEAD
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
inherit (lib.types) bool str listOf;
|
||||
|
@ -58,6 +59,16 @@ in {
|
|||
(eg. in Org files) When true, otter handles these cases fully.
|
||||
'';
|
||||
};
|
||||
=======
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
in {
|
||||
options.vim.lsp = {
|
||||
otter = {
|
||||
enable = mkEnableOption "Otter LSP Injector";
|
||||
mappings = {
|
||||
toggle = mkMappingOption "Activate LSP on Cursor Position [otter]" "<leader>lo";
|
||||
>>>>>>> 7b46366e53493c2843f9524e2e80916ea9cea99b
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue