mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-23 05:40:44 +00:00
Compare commits
4 commits
438ea0939e
...
896db71757
Author | SHA1 | Date | |
---|---|---|---|
|
896db71757 | ||
|
8eb4f87969 | ||
|
f6d3a11f33 | ||
|
76c7d35895 |
2 changed files with 11 additions and 39 deletions
|
@ -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)
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue