mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 21:30:51 +00:00
languages/vala: init (#432)
* vala: init * vala: applying reviews * vala: making formatter work * vala: cleaning up useless import * vala: wrapping uncrustify * vala: added changelog entry
This commit is contained in:
parent
c6453c4e69
commit
0e763161e2
4 changed files with 82 additions and 0 deletions
|
@ -73,6 +73,7 @@ isMaximal: {
|
||||||
};
|
};
|
||||||
csharp.enable = isMaximal;
|
csharp.enable = isMaximal;
|
||||||
julia.enable = isMaximal;
|
julia.enable = isMaximal;
|
||||||
|
vala.enable = isMaximal;
|
||||||
};
|
};
|
||||||
|
|
||||||
visuals = {
|
visuals = {
|
||||||
|
|
|
@ -292,6 +292,7 @@ To migrate to `nixfmt`, simply change `vim.languages.nix.format.type` to
|
||||||
- Add LSP, diagnostics, formatter and Treesitter support for Kotlin under
|
- Add LSP, diagnostics, formatter and Treesitter support for Kotlin under
|
||||||
`vim.languages.kotlin`
|
`vim.languages.kotlin`
|
||||||
- changed default keybinds for leap.nvim to avoid altering expected behavior
|
- changed default keybinds for leap.nvim to avoid altering expected behavior
|
||||||
|
- Add LSP, formatter and Treesitter support for Vala under `vim.languages.vala`
|
||||||
|
|
||||||
[Bloxx12](https://github.com/Bloxx12)
|
[Bloxx12](https://github.com/Bloxx12)
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ in {
|
||||||
./lua.nix
|
./lua.nix
|
||||||
./markdown.nix
|
./markdown.nix
|
||||||
./nim.nix
|
./nim.nix
|
||||||
|
./vala.nix
|
||||||
./nix.nix
|
./nix.nix
|
||||||
./ocaml.nix
|
./ocaml.nix
|
||||||
./php.nix
|
./php.nix
|
||||||
|
|
79
modules/plugins/languages/vala.nix
Normal file
79
modules/plugins/languages/vala.nix
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (builtins) attrNames;
|
||||||
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.lists) isList;
|
||||||
|
inherit (lib.types) enum either listOf package str;
|
||||||
|
inherit (lib.nvim.types) mkGrammarOption;
|
||||||
|
inherit (lib.nvim.lua) expToLua;
|
||||||
|
|
||||||
|
cfg = config.vim.languages.vala;
|
||||||
|
|
||||||
|
defaultServer = "vala_ls";
|
||||||
|
servers = {
|
||||||
|
vala_ls = {
|
||||||
|
package = pkgs.symlinkJoin {
|
||||||
|
name = "vala-language-server-wrapper";
|
||||||
|
paths = [pkgs.vala-language-server];
|
||||||
|
buildInputs = [pkgs.makeBinaryWrapper];
|
||||||
|
postBuild = ''
|
||||||
|
wrapProgram $out/bin/vala-language-server \
|
||||||
|
--prefix PATH : ${pkgs.uncrustify}/bin
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
internalFormatter = true;
|
||||||
|
lspConfig = ''
|
||||||
|
lspconfig.vala_ls.setup {
|
||||||
|
capabilities = capabilities;
|
||||||
|
on_attach = default_on_attach;
|
||||||
|
cmd = ${
|
||||||
|
if isList cfg.lsp.package
|
||||||
|
then expToLua cfg.lsp.package
|
||||||
|
else ''{"${cfg.lsp.package}/bin/vala-language-server"}''
|
||||||
|
},
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
options.vim.languages.vala = {
|
||||||
|
enable = mkEnableOption "Vala language support";
|
||||||
|
|
||||||
|
treesitter = {
|
||||||
|
enable = mkEnableOption "Vala treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||||
|
package = mkGrammarOption pkgs "vala";
|
||||||
|
};
|
||||||
|
|
||||||
|
lsp = {
|
||||||
|
enable = mkEnableOption "Vala LSP support" // {default = config.vim.languages.enableLSP;};
|
||||||
|
server = mkOption {
|
||||||
|
description = "Vala LSP server to use";
|
||||||
|
type = enum (attrNames servers);
|
||||||
|
default = defaultServer;
|
||||||
|
};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
description = "Vala LSP server package, or the command to run as a list of strings";
|
||||||
|
type = either package (listOf str);
|
||||||
|
default = servers.${cfg.lsp.server}.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
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.vala_ls = servers.${cfg.lsp.server}.lspConfig;
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
}
|
Loading…
Reference in a new issue