mirror of
https://github.com/nix-community/nixvim.git
synced 2025-11-28 13:11:04 +01:00
plugins/dap-python: require dap to be explicitly enabled
Instead of automatically enabling `plugins.dap`, require users to explicitly enable it. This prevents silent re-enabling of dap when a user has explicitly disabled it.
This commit is contained in:
parent
8117ab9770
commit
5f74bfcc11
2 changed files with 26 additions and 19 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
|
|
@ -76,26 +77,29 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
||||||
# Manually supplied to nvim-dap config module
|
# Manually supplied to nvim-dap config module
|
||||||
callSetup = false;
|
callSetup = false;
|
||||||
extraConfig = cfg: {
|
extraConfig = cfg: {
|
||||||
plugins.dap = {
|
assertions = lib.nixvim.mkAssertions "plugins.dap-python" {
|
||||||
enable = true;
|
assertion = config.plugins.dap.enable;
|
||||||
|
message = ''
|
||||||
extensionConfigLua = ''
|
You have to enable `plugins.dap` to use `plugins.dap-python`.
|
||||||
require("dap-python").setup("${cfg.adapterPythonPath}", ${toLuaObject cfg.settings})
|
'';
|
||||||
''
|
|
||||||
+ (optionalString (cfg.testRunners != null) ''
|
|
||||||
table.insert(require("dap-python").test_runners,
|
|
||||||
${toLuaObject (builtins.mapAttrs (_: lib.nixvim.mkRaw) cfg.testRunners)})
|
|
||||||
'')
|
|
||||||
+ (optionalString (cfg.customConfigurations != null) ''
|
|
||||||
table.insert(require("dap").configurations.python, ${toLuaObject cfg.customConfigurations})
|
|
||||||
'')
|
|
||||||
+ (optionalString (cfg.resolvePython != null) ''
|
|
||||||
require("dap-python").resolve_python = ${toLuaObject cfg.resolvePython}
|
|
||||||
'')
|
|
||||||
+ (optionalString (cfg.testRunner != null) ''
|
|
||||||
require("dap-python").test_runner = ${toLuaObject cfg.testRunner};
|
|
||||||
'');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
plugins.dap.extensionConfigLua = ''
|
||||||
|
require("dap-python").setup("${cfg.adapterPythonPath}", ${toLuaObject cfg.settings})
|
||||||
|
''
|
||||||
|
+ (optionalString (cfg.testRunners != null) ''
|
||||||
|
table.insert(require("dap-python").test_runners,
|
||||||
|
${toLuaObject (builtins.mapAttrs (_: lib.nixvim.mkRaw) cfg.testRunners)})
|
||||||
|
'')
|
||||||
|
+ (optionalString (cfg.customConfigurations != null) ''
|
||||||
|
table.insert(require("dap").configurations.python, ${toLuaObject cfg.customConfigurations})
|
||||||
|
'')
|
||||||
|
+ (optionalString (cfg.resolvePython != null) ''
|
||||||
|
require("dap-python").resolve_python = ${toLuaObject cfg.resolvePython}
|
||||||
|
'')
|
||||||
|
+ (optionalString (cfg.testRunner != null) ''
|
||||||
|
require("dap-python").test_runner = ${toLuaObject cfg.testRunner};
|
||||||
|
'');
|
||||||
};
|
};
|
||||||
|
|
||||||
# NOTE: Renames added in https://github.com/nix-community/nixvim/pull/2897 (2025-01-26)
|
# NOTE: Renames added in https://github.com/nix-community/nixvim/pull/2897 (2025-01-26)
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
{
|
{
|
||||||
empty = {
|
empty = {
|
||||||
|
plugins.dap.enable = true;
|
||||||
plugins.dap-python.enable = true;
|
plugins.dap-python.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
example = {
|
example = {
|
||||||
|
plugins.dap.enable = true;
|
||||||
plugins.dap-python = {
|
plugins.dap-python = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
|
|
@ -34,6 +36,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
default = {
|
default = {
|
||||||
|
plugins.dap.enable = true;
|
||||||
plugins.dap-python = {
|
plugins.dap-python = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue