plugins/dap: init + extensions + tests (#455)

This commit is contained in:
Wolbyte 2023-07-03 22:34:46 +03:30 committed by GitHub
parent 993cf528b7
commit d025d14f4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 967 additions and 0 deletions

View file

@ -0,0 +1,27 @@
{
empty = {
plugins.dap.extensions.dap-go.enable = true;
};
default = {
plugins.dap.extensions.dap-go = {
enable = true;
dapConfigurations = [
{
# Must be "go" or it will be ignored by the plugin
type = "go";
name = "Attach remote";
mode = "remote";
request = "attach";
}
];
delve = {
path = "dlv";
initializeTimeoutSec = 20;
port = "$\{port}";
args = [];
};
};
};
}

View file

@ -0,0 +1,45 @@
{
empty = {
plugins.dap.extensions.dap-python.enable = true;
};
example = {
plugins.dap.extensions.dap-python = {
enable = true;
customConfigurations = [
{
type = "python";
request = "launch";
name = "My custom launch configuration";
program = "$\{file}";
# ... more options; see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings
}
];
resolvePython = ''
function()
return "/absolute/path/to/python"
end
'';
testRunner = "customTestRunner";
testRunners = {
customTestRunner = ''
function(classname, methodname, opts)
local args = {classname, methodname}
return 'modulename', args
end
'';
};
};
};
default = {
plugins.dap.extensions.dap-python = {
enable = true;
console = "integratedTerminal";
includeConfigs = true;
adapterPythonPath = "python3";
};
};
}

View file

@ -0,0 +1,91 @@
{
empty = {
plugins.dap.extensions.dap-ui.enable = true;
};
default = {
plugins.dap.extensions.dap-ui = {
enable = true;
controls = {
element = "repl";
enabled = true;
icons = {
disconnect = "";
pause = "";
play = "";
run_last = "";
step_back = "";
step_into = "";
step_out = "";
step_over = "";
terminate = "";
};
};
elementMappings = {};
expandLines = true;
floating = {
border = "single";
mappings = {
close = ["q" "<Esc>"];
};
};
forceBuffers = true;
icons = {
collapsed = "";
current_frame = "";
expanded = "";
};
layouts = [
{
elements = [
{
id = "scopes";
size = 0.25;
}
{
id = "breakpoints";
size = 0.25;
}
{
id = "stacks";
size = 0.25;
}
{
id = "watches";
size = 0.25;
}
];
position = "left";
size = 40;
}
{
elements = [
{
id = "repl";
size = 0.5;
}
{
id = "console";
size = 0.5;
}
];
position = "bottom";
size = 10;
}
];
mappings = {
edit = "e";
expand = ["<CR>" "<2-LeftMouse>"];
open = "o";
remove = "d";
repl = "r";
toggle = "t";
};
render = {
indent = 1;
maxValueLines = 100;
};
};
};
}

View file

@ -0,0 +1,32 @@
{
empty = {
plugins.dap.extensions.dap-virtual-text.enable = true;
};
default = {
plugins.dap.extensions.dap-virtual-text = {
enable = true;
enabledCommands = true;
highlightChangedVariables = true;
highlightNewAsChanged = true;
showStopReason = true;
commented = false;
onlyFirstDefinition = true;
allReferences = false;
clearOnContinue = false;
displayCallback = ''
function(variable, buf, stackframe, node, options)
if options.virt_text_pos == 'inline' then
return ' = ' .. variable.value
else
return variable.name .. ' = ' .. variable.value
end
end
'';
virtTextPos = "eol";
allFrames = false;
virtLines = false;
};
};
}

View file

@ -0,0 +1,85 @@
{
empty = {
plugins.dap.enable = true;
};
example = {
plugins.dap = {
enable = true;
adapters = {
executables = {
python = {
command = ".virtualenvs/tools/bin/python";
args = ["-m" "debugpy.adapter"];
};
};
servers = {
java = ''
function(callback, config)
M.execute_command({command = 'vscode.java.startDebugSession'}, function(err0, port)
assert(not err0, vim.inspect(err0))
callback({ type = 'server'; host = '127.0.0.1'; port = port; })
end)
end
'';
javaEnriched = {
host = "127.0.0.1";
port = 8080;
enrichConfig = ''
function(config, on_config)
local final_config = vim.deepcopy(config)
final_config.extra_property = 'This got injected by the adapter'
on_config(final_config)
end
'';
};
};
};
configurations = {
python = [
{
type = "python";
request = "launch";
name = "Launch file";
program = "$\{file}";
}
];
};
};
};
default = {
plugins.dap = {
enable = true;
adapters = {
executables = {};
servers = {};
};
configurations = {};
signs = {
dapStopped = {
text = "";
texthl = "DiagnosticWarn";
};
dapBreakpoint = {
text = "B";
texthl = "DiagnosticInfo";
};
dapBreakpointRejected = {
text = "R";
texthl = "DiagnosticError";
};
dapBreakpointCondition = {
text = "C";
texthl = "DiagnosticInfo";
};
dapLogPoint = {
text = "L";
texthl = "DiagnosticInfo";
};
};
};
};
}