treewide: Reformat with nixfmt

This commit is contained in:
traxys 2024-05-05 19:39:35 +02:00
parent c6281260dc
commit 62f32bfc71
459 changed files with 28139 additions and 26377 deletions

View file

@ -1,40 +1,37 @@
{
lib,
helpers,
}:
with lib; rec {
mkAdapterType = attrs:
{ lib, helpers }:
with lib;
rec {
mkAdapterType =
attrs:
types.submodule {
options =
{
id = helpers.mkNullOrOption types.str ''
Identifier of the adapter. This is used for the
`adapterId` property of the initialize request.
For most debug adapters setting this is not necessary.
options = {
id = helpers.mkNullOrOption types.str ''
Identifier of the adapter. This is used for the
`adapterId` property of the initialize request.
For most debug adapters setting this is not necessary.
'';
enrichConfig = helpers.mkNullOrLuaFn ''
A lua function (`func(config, on_config)`) which allows an adapter to enrich a
configuration with additional information. It receives a configuration as first
argument, and a callback that must be called with the final configuration as second argument.
'';
options = {
initializeTimeoutSec = helpers.defaultNullOpts.mkInt 4 ''
How many seconds the client waits for a response on a initialize request before emitting a warning.
'';
enrichConfig = helpers.mkNullOrLuaFn ''
A lua function (`func(config, on_config)`) which allows an adapter to enrich a
configuration with additional information. It receives a configuration as first
argument, and a callback that must be called with the final configuration as second argument.
disconnectTimeoutSec = helpers.defaultNullOpts.mkInt 3 ''
How many seconds the client waits for a disconnect response from the debug
adapter before emitting a warning and closing the connection.
'';
options = {
initializeTimeoutSec = helpers.defaultNullOpts.mkInt 4 ''
How many seconds the client waits for a response on a initialize request before emitting a warning.
'';
disconnectTimeoutSec = helpers.defaultNullOpts.mkInt 3 ''
How many seconds the client waits for a disconnect response from the debug
adapter before emitting a warning and closing the connection.
'';
sourceFiletype = helpers.mkNullOrOption types.str ''
The filetype to use for content retrieved via a source request.
'';
};
}
// attrs;
sourceFiletype = helpers.mkNullOrOption types.str ''
The filetype to use for content retrieved via a source request.
'';
};
} // attrs;
};
executableAdapterOption = mkAdapterType {
@ -54,7 +51,7 @@ with lib; rec {
serverAdapterOption = mkAdapterType {
host = helpers.defaultNullOpts.mkStr "127.0.0.1" "Host to connect to.";
port = helpers.mkNullOrOption (types.either types.int (types.enum ["$\{port}"])) ''
port = helpers.mkNullOrOption (types.either types.int (types.enum [ "$\{port}" ])) ''
Port to connect to.
If "$\{port}" dap resolves a free port.
This is intended to be used with `executable.args`.
@ -76,7 +73,8 @@ with lib; rec {
'';
};
mkAdapterOption = name: type:
mkAdapterOption =
name: type:
helpers.mkNullOrOption (with types; attrsOf (either str type)) ''
Debug adapters of `${name}` type.
The adapters can also be set to a function which takes three arguments:
@ -100,7 +98,10 @@ with lib; rec {
};
request = mkOption {
type = types.enum ["attach" "launch"];
type = types.enum [
"attach"
"launch"
];
description = ''
Indicates whether the debug adapter should launch a debuggee or attach to one that is already running.
'';
@ -120,18 +121,20 @@ with lib; rec {
numhl = helpers.mkNullOrOption types.str "`numhl` for sign.";
};
processAdapters = type: adapters:
processAdapters =
type: adapters:
with builtins;
mapAttrs (_: adapter:
if isString adapter
then helpers.mkRaw adapter
else
filterAttrs (n: _: n != "enrichConfig") (
adapter
// {
inherit type;
enrich_config = adapter.enrichConfig;
}
))
adapters;
mapAttrs (
_: adapter:
if isString adapter then
helpers.mkRaw adapter
else
filterAttrs (n: _: n != "enrichConfig") (
adapter
// {
inherit type;
enrich_config = adapter.enrichConfig;
}
)
) adapters;
}