Skip to content

Commit 60831f8

Browse files
committed
debug debugger
* `.vscode/launch.json` helping debugging extension. * commit debugging workspace (which is being excluded at the build time, thankas to .vscodeignore) Bonus track: * proper .luacheckrc to check generated lua sources
1 parent 56264ed commit 60831f8

File tree

4 files changed

+92
-2
lines changed

4 files changed

+92
-2
lines changed

.luacheckrc

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
std = "luajit"
2+
globals = {"box", "_TARANTOOL", "tonumber64", "utf8"}
3+
ignore = {
4+
-- Accessing an undefined field of a global variable <debug>.
5+
"143/debug",
6+
-- Accessing an undefined field of a global variable <os>.
7+
"143/os",
8+
-- Accessing an undefined field of a global variable <string>.
9+
"143/string",
10+
-- Accessing an undefined field of a global variable <table>.
11+
"143/table",
12+
-- Unused argument <self>.
13+
"212/self",
14+
-- Redefining a local variable.
15+
"411",
16+
-- Redefining an argument.
17+
"412",
18+
-- Shadowing a local variable.
19+
"421",
20+
-- Shadowing an upvalue.
21+
"431",
22+
-- Shadowing an upvalue argument.
23+
"432",
24+
-- Unused variable with `_` prefix.
25+
"212/_.*",
26+
-- Unused loop variable with `_` prefix.
27+
"213/_.*",
28+
}
29+
30+
include_files = {
31+
"**/*.lua",
32+
}
33+
34+
exclude_files = {
35+
"debug-workspace/*.lua",
36+
".rocks/**/*.lua",
37+
".git/**/*.lua",
38+
}

.vscode/launch.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
"request": "launch",
88
"runtimeExecutable": "${execPath}",
99
"args": [
10-
"--extensionDevelopmentPath=${workspaceFolder}"
10+
"--extensionDevelopmentPath=${workspaceFolder}",
11+
"${workspaceFolder}/debug-workspace"
1112
],
1213
"outFiles": [
1314
"${workspaceFolder}/**/*.js"
1415
],
15-
// "preLaunchTask": "npm: watch"
16+
"preLaunchTask": "Build Debugger"
1617
},
1718
{
1819
"name": "Server",

debug-workspace/.vscode/launch.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Tarantool Lua Debug",
9+
"type": "lua-tarantool",
10+
"request": "launch",
11+
"program": {
12+
"tarantool": "/home/tsafin/datetime/tarantoolt/build/src/tarantool",
13+
"file": "${file}",
14+
},
15+
"args": ["-1", "-2", "-3"]
16+
}
17+
]
18+
}

debug-workspace/debug-dbg.lua

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
local date = require 'datetime'
2+
local fiber = require('fiber')
3+
4+
print(#arg)
5+
for i = -1,#arg,1 do
6+
if arg[i] ~= nil then
7+
print('arg['..i..'] = ' .. arg[i])
8+
end
9+
end
10+
print('1.out:', fiber.id())
11+
local function fiber_function()
12+
print('1.in:', "I'm a fiber")
13+
print('2.in:', fiber.id())
14+
fiber.yield()
15+
fiber.sleep(10)
16+
print('3.in:')
17+
end
18+
print('2.out:', fiber.id())
19+
20+
local fiber_object = fiber.create(fiber_function)
21+
print('3.out:', "Fiber started")
22+
23+
local T = date.new{hour = 3, tzoffset = '+0300'}
24+
print('4.out:', T)
25+
26+
local fmt = '%Y-%m-%dT%H%M%z'
27+
local S = T:format(fmt)
28+
print('5.out:', S)
29+
local T1 = date.parse(S, {format = fmt})
30+
print('6.out:', T1)
31+
fiber.sleep(30)
32+
33+
os.exit(0)

0 commit comments

Comments
 (0)