Skip to content

Commit

Permalink
feat(lsp): allow cmd to be null
Browse files Browse the repository at this point in the history
  • Loading branch information
Toalaah committed Oct 17, 2023
1 parent 9d75ffb commit f39385b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions modules/lsp/lsp-config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ with lib; let
};
serverConfig =
defaultConfig
// {inherit (value) cmd;}
// (
if value.cmd == null
then {}
else {inherit (value) cmd;}
)
// value.extraOpts;
in ''
require('lspconfig')['${name}'].setup ${toLua serverConfig}
Expand Down Expand Up @@ -76,9 +80,13 @@ in {
type = types.attrsOf (types.submodule {
options = {
cmd = mkOption {
type = types.listOf types.str;
type = types.nullOr (types.listOf types.str);
default = null;
description = lib.mdDoc ''
The command used to start the language server. Each `argv` should be a separate list entry.
If you want to use the default lspconfig 'cmd' value, set this
value to null (this is the default).
'';
example = lib.literalExpression ''
cmd = [ "''${pkgs.myLanguageServer}/bin/my-lsp" "--stdio"];
Expand Down

0 comments on commit f39385b

Please sign in to comment.