Compare commits

...

4 commits

Author SHA1 Message Date
Soliprem
896db71757 vala: added changelog entry 2024-11-03 19:50:35 +01:00
Soliprem
8eb4f87969 vala: wrapping uncrustify 2024-11-03 19:44:35 +01:00
Soliprem
f6d3a11f33 vala: cleaning up useless import 2024-11-03 13:27:57 +01:00
Soliprem
76c7d35895 vala: making formatter work 2024-11-03 13:26:57 +01:00
2 changed files with 11 additions and 39 deletions

View file

@ -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
`vim.languages.kotlin`
- 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)

View file

@ -6,12 +6,10 @@
}: let
inherit (builtins) attrNames;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.meta) getExe;
inherit (lib.nvim.languages) diagnosticsToLua;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.lists) isList;
inherit (lib.types) enum either listOf package str;
inherit (lib.nvim.types) mkGrammarOption diagnostics;
inherit (lib.nvim.types) mkGrammarOption;
inherit (lib.nvim.lua) expToLua;
cfg = config.vim.languages.vala;
@ -19,8 +17,15 @@
defaultServer = "vala_ls";
servers = {
vala_ls = {
package = pkgs.vala-language-server;
runtimeInputs = pkgs.uncrustify;
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 {
@ -35,21 +40,6 @@
'';
};
};
defaultDiagnosticsProvider = ["vala-lint"];
diagnosticsProviders = {
vala-lint = {
package = pkgs.vala-lint;
nullConfig = pkg: ''
table.insert(
ls_sources,
null_ls.builtins.diagnostics.vala_lint.with({
command = "${getExe pkg}",
})
)
'';
};
};
in {
options.vim.languages.vala = {
enable = mkEnableOption "Vala language support";
@ -69,20 +59,10 @@ in {
package = mkOption {
description = "Vala LSP server package, or the command to run as a list of strings";
example = ''[lib.getExe pkgs.vala-language-server]'';
type = either package (listOf str);
default = servers.${cfg.lsp.server}.package;
};
};
extraDiagnostics = {
enable = mkEnableOption "extra Vala diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;};
types = diagnostics {
langDesc = "Vala";
inherit diagnosticsProviders;
inherit defaultDiagnosticsProvider;
};
};
};
config = mkIf cfg.enable (mkMerge [
@ -91,15 +71,6 @@ in {
vim.treesitter.grammars = [cfg.treesitter.package];
})
(mkIf cfg.extraDiagnostics.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources = diagnosticsToLua {
lang = "Vala";
config = cfg.extraDiagnostics.types;
inherit diagnosticsProviders;
};
})
(mkIf cfg.lsp.enable {
vim.lsp.lspconfig.enable = true;
vim.lsp.lspconfig.sources.vala_ls = servers.${cfg.lsp.server}.lspConfig;