Format workspace with CodeFormat

This commit is contained in:
2023-09-02 17:29:59 +02:00
parent 214ffd053d
commit ae3bc212a9
63 changed files with 1205 additions and 1061 deletions
+18 -18
View File
@@ -14,7 +14,7 @@
limitations under the License.
]]
local utils = require('utils')
local utils = require("utils")
M = {}
@@ -22,40 +22,40 @@ local env_ok = false
local dap = nil
local function check_env()
local debugpy = utils.exec('python -m debugpy --version')
assert(debugpy.rc == 0, 'Python module debugpy is required')
local pytest = utils.exec('python -m pytest --version')
assert(pytest.rc == 0, 'Python module pytest is required')
local debugpy = utils.exec("python -m debugpy --version")
assert(debugpy.rc == 0, "Python module debugpy is required")
local pytest = utils.exec("python -m pytest --version")
assert(pytest.rc == 0, "Python module pytest is required")
env_ok = true
end
local function load_dap()
local ok, dap = pcall(require, 'dap')
assert(ok, 'nvim-dap is required')
local ok, dap = pcall(require, "dap")
assert(ok, "nvim-dap is required")
return dap
end
function M.run(args)
assert(type(args) == 'table', 'Args not specified or of wrong type')
assert(type(args) == "table", "Args not specified or of wrong type")
if not env_ok then
check_env()
end
if not dap then
dap = load_dap()
dap.adapters.python = {
type = 'executable';
command = 'python';
args = { '-m', 'debugpy.adapter' };
cwd = vim.fn.getcwd();
type = "executable",
command = "python",
args = { "-m", "debugpy.adapter", },
cwd = vim.fn.getcwd(),
}
end
local config = {
name = 'pytest ' .. table.concat(args, ' '),
type = 'python',
request = 'launch',
name = "pytest " .. table.concat(args, " "),
type = "python",
request = "launch",
-- pythonPath = vim.fn.getcwd() .. '/.venv/bin/python',
module = 'pytest',
module = "pytest",
-- python = 'python';
-- program = vim.fn.getcwd() .. '/.venv/bin/pytest';
args = args,
@@ -66,8 +66,8 @@ function M.run(args)
dap.run(config)
-- List of events described at https://microsoft.github.io/debug-adapter-protocol/specification#Events
-- Also see :h dap-extensions
dap.listeners.after['event_initialized']['pytest.lua'] = function(session, body)
dap.set_exception_breakpoints({ 'userUnhandled' })
dap.listeners.after["event_initialized"]["pytest.lua"] = function (session, body)
dap.set_exception_breakpoints({ "userUnhandled", })
end
end