WIP stuff

Cba with commit messages
This commit is contained in:
raf 2024-10-16 05:42:01 +03:00
parent bd2743fb45
commit 6425e9cfb0
Signed by: NotAShelf
GPG key ID: AF26552424E53993
2 changed files with 12 additions and 16 deletions

View file

@ -4,7 +4,8 @@
inherit (lib.options) mkOption;
inherit (lib.types) bool;
inherit (lib.meta) getExe;
inherit (lib.lists) isList optionals;
inherit (lib.strings) optionalString;
inherit (lib.lists) optionals;
inherit (lib.generators) mkLuaInline;
inherit (lib.nvim.attrsets) mapListToAttrs;
inherit (lib.nvim.lua) toLuaObject;
@ -46,17 +47,21 @@ in {
# `on_attach`.
# TODO: nixpkgs-like doc comments from that one RFC
mkLspConfig = {
# Mandatory arguments
name,
package,
# Optional arguments for the sake of flexibility
args ? [],
cmd ? [(getExe package)] ++ lib.optionals (args != []) args,
cmd ? [(getExe package)] ++ optionals (args != []) args,
capabilities ? "capabilities",
on_attach ? "on_attach",
init_opts ? "",
}: let
generatedConfig = {
inherit cmd;
capabilities = mkLuaInline capabilities;
on_attach = mkLuaInline on_attach;
init_opts = mkLuaInline (optionalString (init_opts != "") init_opts);
};
in {
inherit package;

View file

@ -9,27 +9,18 @@
inherit (lib.modules) mkIf mkMerge;
inherit (lib.lists) isList;
inherit (lib.types) enum either package listOf str bool;
inherit (lib.nvim.languages) diagnosticsToLua;
inherit (lib.nvim.languages) diagnosticsToLua mkLspConfig;
inherit (lib.nvim.types) diagnostics mkGrammarOption;
inherit (lib.nvim.lua) expToLua;
cfg = config.vim.languages.bash;
defaultServer = "bash-ls";
defaultServer = "bashls";
servers = {
bash-ls = {
bashls = mkLspConfig {
name = "bashls";
package = pkgs.bash-language-server;
lspConfig = ''
lspconfig.bashls.setup{
capabilities = capabilities;
on_attach = default_on_attach;
cmd = ${
if isList cfg.lsp.package
then expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/bash-language-server", "start"}''
};
}
'';
args = ["start"];
};
};