mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-02-24 12:28:32 +00:00
Compare commits
4 commits
48d223fe44
...
34b8cbd0c6
Author | SHA1 | Date | |
---|---|---|---|
![]() |
34b8cbd0c6 | ||
![]() |
72da674a2b | ||
![]() |
5cc76714b7 | ||
![]() |
c0790c5494 |
5 changed files with 132 additions and 14 deletions
|
@ -51,6 +51,7 @@ isMaximal: {
|
||||||
css.enable = isMaximal;
|
css.enable = isMaximal;
|
||||||
sql.enable = isMaximal;
|
sql.enable = isMaximal;
|
||||||
java.enable = isMaximal;
|
java.enable = isMaximal;
|
||||||
|
kotlin.enable = isMaximal;
|
||||||
ts.enable = isMaximal;
|
ts.enable = isMaximal;
|
||||||
svelte.enable = isMaximal;
|
svelte.enable = isMaximal;
|
||||||
go.enable = isMaximal;
|
go.enable = isMaximal;
|
||||||
|
|
|
@ -102,6 +102,10 @@ everyone.
|
||||||
recommended to go through rustacean.nvim's README to take a closer look at its
|
recommended to go through rustacean.nvim's README to take a closer look at its
|
||||||
features and usage
|
features and usage
|
||||||
|
|
||||||
|
- Add [lz.n] support and lazy-load some builtin plugins.
|
||||||
|
|
||||||
|
[lz.n]: https://github.com/mrcjkb/rustaceanvim
|
||||||
|
|
||||||
[jacekpoz](https://jacekpoz.pl):
|
[jacekpoz](https://jacekpoz.pl):
|
||||||
|
|
||||||
[ocaml-lsp]: https://github.com/ocaml/ocaml-lsp
|
[ocaml-lsp]: https://github.com/ocaml/ocaml-lsp
|
||||||
|
@ -259,6 +263,8 @@ everyone.
|
||||||
- Add LSP and Treesitter support for R under `vim.languages.R`.
|
- Add LSP and Treesitter support for R under `vim.languages.R`.
|
||||||
- Add Otter support under `vim.lsp.otter` and an assert to prevent conflict with
|
- Add Otter support under `vim.lsp.otter` and an assert to prevent conflict with
|
||||||
ccc
|
ccc
|
||||||
|
- Add LSP, diagnostics, formatter and Treesitter support for Kotlin under
|
||||||
|
`vim.languages.kotlin`
|
||||||
|
|
||||||
[Bloxx12](https://github.com/Bloxx12)
|
[Bloxx12](https://github.com/Bloxx12)
|
||||||
|
|
||||||
|
|
31
flake.lock
generated
31
flake.lock
generated
|
@ -844,6 +844,22 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"plugin-luasnip": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1726165831,
|
||||||
|
"narHash": "sha256-nkaa1NGOI28Et2QitQB+Spv+J42QVdHE1oywteLcJJw=",
|
||||||
|
"owner": "L3MON4D3",
|
||||||
|
"repo": "LuaSnip",
|
||||||
|
"rev": "e808bee352d1a6fcf902ca1a71cee76e60e24071",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "L3MON4D3",
|
||||||
|
"repo": "LuaSnip",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"plugin-lz-n": {
|
"plugin-lz-n": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -874,19 +890,6 @@
|
||||||
"owner": "horriblename",
|
"owner": "horriblename",
|
||||||
"ref": "require-rewrite",
|
"ref": "require-rewrite",
|
||||||
"repo": "lzn-auto-require",
|
"repo": "lzn-auto-require",
|
||||||
"plugin-luasnip": {
|
|
||||||
"flake": false,
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1726165831,
|
|
||||||
"narHash": "sha256-nkaa1NGOI28Et2QitQB+Spv+J42QVdHE1oywteLcJJw=",
|
|
||||||
"owner": "L3MON4D3",
|
|
||||||
"repo": "LuaSnip",
|
|
||||||
"rev": "e808bee352d1a6fcf902ca1a71cee76e60e24071",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "L3MON4D3",
|
|
||||||
"repo": "LuaSnip",
|
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1906,9 +1909,9 @@
|
||||||
"plugin-lspkind": "plugin-lspkind",
|
"plugin-lspkind": "plugin-lspkind",
|
||||||
"plugin-lspsaga": "plugin-lspsaga",
|
"plugin-lspsaga": "plugin-lspsaga",
|
||||||
"plugin-lualine": "plugin-lualine",
|
"plugin-lualine": "plugin-lualine",
|
||||||
|
"plugin-luasnip": "plugin-luasnip",
|
||||||
"plugin-lz-n": "plugin-lz-n",
|
"plugin-lz-n": "plugin-lz-n",
|
||||||
"plugin-lzn-auto-require": "plugin-lzn-auto-require",
|
"plugin-lzn-auto-require": "plugin-lzn-auto-require",
|
||||||
"plugin-luasnip": "plugin-luasnip",
|
|
||||||
"plugin-mind-nvim": "plugin-mind-nvim",
|
"plugin-mind-nvim": "plugin-mind-nvim",
|
||||||
"plugin-minimap-vim": "plugin-minimap-vim",
|
"plugin-minimap-vim": "plugin-minimap-vim",
|
||||||
"plugin-modes-nvim": "plugin-modes-nvim",
|
"plugin-modes-nvim": "plugin-modes-nvim",
|
||||||
|
|
|
@ -8,6 +8,7 @@ in {
|
||||||
./css.nix
|
./css.nix
|
||||||
./elixir.nix
|
./elixir.nix
|
||||||
./go.nix
|
./go.nix
|
||||||
|
./kotlin.nix
|
||||||
./html.nix
|
./html.nix
|
||||||
./java.nix
|
./java.nix
|
||||||
./lua.nix
|
./lua.nix
|
||||||
|
|
107
modules/plugins/languages/kotlin.nix
Normal file
107
modules/plugins/languages/kotlin.nix
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
||||||
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
|
inherit (lib.nvim.languages) diagnosticsToLua;
|
||||||
|
inherit (lib.types) package;
|
||||||
|
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||||
|
inherit (lib.lists) isList;
|
||||||
|
inherit (lib.nvim.lua) expToLua;
|
||||||
|
|
||||||
|
cfg = config.vim.languages.kotlin;
|
||||||
|
|
||||||
|
defaultDiagnosticsProvider = ["ktlint"];
|
||||||
|
diagnosticsProviders = {
|
||||||
|
ktlint = {
|
||||||
|
package = pkgs.ktlint;
|
||||||
|
nullConfig = pkg: ''
|
||||||
|
table.insert(
|
||||||
|
ls_sources,
|
||||||
|
null_ls.builtins.diagnostics.ktlint.with({
|
||||||
|
command = "${getExe pkg}",
|
||||||
|
})
|
||||||
|
)
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
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" // {default = config.vim.languages.enableLSP;};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
description = "kotlin_language_server package with Kotlin runtime";
|
||||||
|
type = package;
|
||||||
|
example = literalExpression ''
|
||||||
|
pkgs.symlinkJoin {
|
||||||
|
name = "kotlin-language-server-wrapped";
|
||||||
|
paths = [pkgs.kotlin-language-server];
|
||||||
|
nativeBuildInputs = [pkgs.makeWrapper];
|
||||||
|
postBuild = '''
|
||||||
|
wrapProgram $out/bin/kotlin-language-server \
|
||||||
|
--prefix PATH : ''${pkgs.kotlin}/bin
|
||||||
|
''';
|
||||||
|
};
|
||||||
|
'';
|
||||||
|
default = pkgs.kotlin-language-server;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
extraDiagnostics = {
|
||||||
|
enable = mkEnableOption "extra Kotlin diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;};
|
||||||
|
|
||||||
|
types = diagnostics {
|
||||||
|
langDesc = "Kotlin";
|
||||||
|
inherit diagnosticsProviders;
|
||||||
|
inherit defaultDiagnosticsProvider;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
(mkIf cfg.treesitter.enable {
|
||||||
|
vim.treesitter.enable = true;
|
||||||
|
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.extraDiagnostics.enable {
|
||||||
|
vim.lsp.null-ls.enable = true;
|
||||||
|
vim.lsp.null-ls.sources = diagnosticsToLua {
|
||||||
|
lang = "kotlin";
|
||||||
|
config = cfg.extraDiagnostics.types;
|
||||||
|
inherit diagnosticsProviders;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
|
(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"}''
|
||||||
|
},
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue