vala: applying reviews

This commit is contained in:
Soliprem 2024-11-03 12:49:15 +01:00
parent c2780f497b
commit 438ea0939e
2 changed files with 7 additions and 9 deletions

View file

@ -20,6 +20,8 @@
servers = { servers = {
vala_ls = { vala_ls = {
package = pkgs.vala-language-server; package = pkgs.vala-language-server;
runtimeInputs = pkgs.uncrustify;
internalFormatter = true;
lspConfig = '' lspConfig = ''
lspconfig.vala_ls.setup { lspconfig.vala_ls.setup {
capabilities = capabilities; capabilities = capabilities;
@ -41,7 +43,7 @@
nullConfig = pkg: '' nullConfig = pkg: ''
table.insert( table.insert(
ls_sources, ls_sources,
null_ls.builtins.diagnostics.eslint_d.with({ null_ls.builtins.diagnostics.vala_lint.with({
command = "${getExe pkg}", command = "${getExe pkg}",
}) })
) )
@ -54,13 +56,11 @@ in {
treesitter = { treesitter = {
enable = mkEnableOption "Vala treesitter" // {default = config.vim.languages.enableTreesitter;}; enable = mkEnableOption "Vala treesitter" // {default = config.vim.languages.enableTreesitter;};
package = mkGrammarOption pkgs "vala"; package = mkGrammarOption pkgs "vala";
}; };
lsp = { lsp = {
enable = mkEnableOption "Vala LSP support" // {default = config.vim.languages.enableLSP;}; enable = mkEnableOption "Vala LSP support" // {default = config.vim.languages.enableLSP;};
server = mkOption { server = mkOption {
description = "Vala LSP server to use"; description = "Vala LSP server to use";
type = enum (attrNames servers); type = enum (attrNames servers);
@ -69,7 +69,7 @@ in {
package = mkOption { package = mkOption {
description = "Vala LSP server package, or the command to run as a list of strings"; description = "Vala LSP server package, or the command to run as a list of strings";
example = ''[lib.getExe pkgs.jdt-language-server " - data " " ~/.cache/jdtls/workspace "]''; example = ''[lib.getExe pkgs.vala-language-server]'';
type = either package (listOf str); type = either package (listOf str);
default = servers.${cfg.lsp.server}.package; default = servers.${cfg.lsp.server}.package;
}; };
@ -77,7 +77,6 @@ in {
extraDiagnostics = { extraDiagnostics = {
enable = mkEnableOption "extra Vala diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;}; enable = mkEnableOption "extra Vala diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;};
types = diagnostics { types = diagnostics {
langDesc = "Vala"; langDesc = "Vala";
inherit diagnosticsProviders; inherit diagnosticsProviders;

View file

@ -4,9 +4,8 @@
lib, lib,
... ...
}: let }: let
inherit (lib.strings) stringLength concatMapStringsSep; inherit (lib.strings) concatMapStringsSep;
inherit (lib.modules) mkIf; inherit (lib.modules) mkIf;
cfg = config.vim.utility.preview.markdownPreview; cfg = config.vim.utility.preview.markdownPreview;
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
@ -19,8 +18,8 @@ in {
mkdp_filetypes = [(concatMapStringsSep ", " (x: "'" + x + "'") cfg.filetypes)]; mkdp_filetypes = [(concatMapStringsSep ", " (x: "'" + x + "'") cfg.filetypes)];
mkdp_command_for_global = cfg.alwaysAllowPreview; mkdp_command_for_global = cfg.alwaysAllowPreview;
mkdp_open_to_the_world = cfg.broadcastServer; mkdp_open_to_the_world = cfg.broadcastServer;
mkdp_open_ip = mkIf (stringLength cfg.customIP > 0) cfg.customIP; mkdp_open_ip = cfg.customIP;
mkdp_port = mkIf (stringLength cfg.customPort > 0) cfg.customPort; mkdp_port = cfg.customPort;
}; };
}; };
} }