Local Lua Debugger for Visual Studio Code 使用教程
1. 项目的目录结构及介绍
local-lua-debugger-vscode/
├── .vscode/
│ └── launch.json
├── resources/
│ └── Lua-Logo_128x128.png
├── test/
│ ├── start-cli.lua
│ ├── start-interpreter.lua
│ └── ...
├── .gitignore
├── LICENSE
├── README.md
├── package.json
└── ...
目录结构介绍
- .vscode/: 包含 Visual Studio Code 的配置文件,如
launch.json
。 - resources/: 包含项目使用的资源文件,如图标。
- test/: 包含项目的测试文件。
- .gitignore: Git 忽略文件列表。
- LICENSE: 项目的开源许可证。
- README.md: 项目的说明文档。
- package.json: 项目的元数据文件,包含项目的基本信息和依赖。
2. 项目的启动文件介绍
启动文件
- test/start-cli.lua: 用于启动命令行界面的测试脚本。
- test/start-interpreter.lua: 用于启动解释器的测试脚本。
启动文件内容示例
-- test/start-cli.lua
if os.getenv("LOCAL_LUA_DEBUGGER_VSCODE") == "1" then
require("lldebugger").start()
end
describe("a test", function() end)
-- test/start-interpreter.lua
-- busted should be required before hooking debugger to avoid double-hooking
require("busted.runner")()
if os.getenv("LOCAL_LUA_DEBUGGER_VSCODE") == "1" then
require("lldebugger").start()
end
describe("a test", function() end)
3. 项目的配置文件介绍
配置文件
- .vscode/launch.json: 用于配置 Visual Studio Code 的调试设置。
配置文件内容示例
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug",
"type": "lua-local",
"request": "launch",
"program": {
"command": "dmengine"
},
"args": ["/build/default/game.projectc"],
"scriptRoots": [""] // Required for debugger to find scripts
}
]
}
配置文件说明
- name: 调试配置的名称。
- type: 调试类型,这里是
lua-local
。 - request: 请求类型,这里是
launch
。 - program: 启动命令,这里是
dmengine
。 - args: 启动命令的参数。
- scriptRoots: 脚本根目录,用于调试器查找脚本文件。
以上是 Local Lua Debugger for Visual Studio Code 项目的目录结构、启动文件和配置文件的介绍。希望这份教程能帮助你更好地理解和使用该项目。