chore: configure lua-local debugger for Teal 🧙
ci/woodpecker/pr/docker-build Pipeline was successful Details
ci/woodpecker/pr/lint Pipeline was successful Details
ci/woodpecker/pr/build Pipeline was successful Details
ci/woodpecker/pr/test Pipeline was successful Details

This commit is contained in:
Aire-One 2023-05-05 00:04:25 +02:00
parent 129f15ea9d
commit 9165e98db3
6 changed files with 36 additions and 16 deletions

View File

@ -1,3 +1,7 @@
if os.getenv "LOCAL_LUA_DEBUGGER_VSCODE" == "1" then
require("lldebugger").start()
end
require("tl").loader() require("tl").loader()
local version <const> = _VERSION:match "%d+%.%d+" local version <const> = _VERSION:match "%d+%.%d+"
@ -10,11 +14,14 @@ local function lua_module_paths(module_base_path)
end end
return { return {
default = { _all = {
lpath = lua_module_paths("lua_modules/share/lua/" .. version) lpath = lua_module_paths("lua_modules/share/lua/" .. version)
.. lua_module_paths "types" .. lua_module_paths "types"
.. lua_module_paths "./src/awesomewm.d.tl", .. lua_module_paths "./src/awesomewm.d.tl",
cpath = "lua_modules/lib/lua/" .. version .. "/?.so;", cpath = "lua_modules/lib/lua/" .. version .. "/?.so;",
loaders = { "teal" }, loaders = { "teal" },
}, },
coverage = {
coverage = true,
},
} }

13
.vscode/launch.json vendored
View File

@ -8,7 +8,18 @@
"program": { "program": {
"command": "just" "command": "just"
}, },
"args": ["debug"] "args": ["run"],
"scriptFiles": ["${workspaceFolder}/**/*.tl"]
},
{
"name": "Debug specs",
"type": "lua-local",
"request": "launch",
"program": {
"command": "just"
},
"args": ["test"],
"scriptFiles": ["${workspaceFolder}/**/*.tl"]
} }
] ]
} }

13
.vscode/settings.json vendored
View File

@ -1,10 +1,8 @@
{ {
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"[markdown]": { "[markdown]": {
"editor.wordWrap": "on", "editor.acceptSuggestionOnEnter": "off",
"editor.renderWhitespace": "all", "editor.renderWhitespace": "all",
"editor.acceptSuggestionOnEnter": "off" "editor.wordWrap": "on"
}, },
"cSpell.words": [ "cSpell.words": [
"aire-one", "aire-one",
@ -43,9 +41,12 @@
"woodpeckerci", "woodpeckerci",
"writefunction" "writefunction"
], ],
"debug.allowBreakpointsEverywhere": true,
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"files.associations": { "files.associations": {
".busted": "lua",
".luacheckrc": "lua", ".luacheckrc": "lua",
"*.rockspec": "lua", "*.rockspec": "lua"
".busted": "lua"
} }
} }

View File

@ -49,11 +49,3 @@ validate:
test: test:
busted busted
# TODO : how to run a debugger on Teal code?
debug:
{{ lua }} debug.lua build/awesomewm.d.tl/init.lua
debug-gen:
cyan gen --output set_paths.lua --gen-compat "off" set_paths.tl
sed -i 's/"src\/awesomewm.d.tl"/"build\/awesomewm.d.tl"/g' set_paths.lua
stylua set_paths.lua

View File

@ -1,3 +1,7 @@
if os.getenv("LOCAL_LUA_DEBUGGER_VSCODE") == "1" then
require("lldebugger").start()
end
local crawler = require "crawler" local crawler = require "crawler"
local filesystem = require "filesystem" local filesystem = require "filesystem"
local generator = require "generator" local generator = require "generator"

5
types/lldebugger.d.tl Normal file
View File

@ -0,0 +1,5 @@
local record Lldebugger
start: function()
end
return Lldebugger