1- # EmmyLua Debug Adapter
1+ < div align = " center " >
22
3- EmmyLua Debug Adapter is dap based on [ EmmyLuaDebugger ] ( https://github.com/EmmyLua/EmmyLuaDebugger )
3+ # 🚀 EmmyLua Debug Adapter
44
5- ## basic usage
5+ <p align =" center " >
6+ <strong >A powerful Debug Adapter Protocol (DAP) implementation for Lua debugging</strong >
7+ </p >
68
7- insert debug code:
9+ <p align =" center " > <img src =" https://img.shields.io/badge/language-Rust-orange?style=for-the-badge&logo=rust " alt =" Rust " >
10+ <img src =" https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20macOS-blue?style=for-the-badge " alt =" Platform " >
11+ <img src =" https://img.shields.io/badge/lua-5.1%20%7C%205.2%20%7C%205.3%20%7C%205.4%20%7C%20LuaJIT-purple?style=for-the-badge&logo=lua " alt =" Lua " >
12+ <img src =" https://img.shields.io/badge/LuaJIT-2.0%20%7C%202.1-red?style=for-the-badge " alt =" LuaJIT " >
13+ </p >
814
9- ### Windows
15+ <p align =" center " >
16+ Built on top of the robust <a href =" https://github.com/EmmyLua/EmmyLuaDebugger " >EmmyLuaDebugger</a > foundation
17+ </p >
18+
19+ ---
20+
21+ </div >
22+
23+ ## ✨ Features
24+
25+ - 🎯 ** Debug Adapter Protocol (DAP)** compatible
26+ - 🔧 ** Cross-platform** support (Windows, Linux, macOS)
27+ - 🚀 ** Easy integration** with any DAP-compatible editor
28+ - 🐛 ** Advanced debugging** capabilities for Lua applications
29+ - 🌟 ** LuaJIT support** for high-performance Lua applications
30+ - 📁 ** Multiple file extensions** support (.lua, .lua.txt, .lua.bytes)
31+ - 🌐 ** TCP connection** for remote debugging
32+
33+ ## 🚀 Quick Start
34+
35+ ### 📦 Installation
36+
37+ 1 . Download the latest release from the [ releases page] ( https://github.com/EmmyLua/emmylua_dap/releases )
38+ 2 . Extract the executable to your desired location
39+ 3 . Ensure the ` emmy_core ` library is available in your Lua environment
40+
41+ ### 🛠️ Setup Your Lua Application
42+
43+ Add the following debug code to your Lua application:
44+
45+ #### 🖥️ Windows
1046``` lua
11- package.cpath = package.cpath .. " ;<path to emmy_core>/?.dll"
47+ -- Add the emmy_core library to your package path
48+ package.cpath = package.cpath .. " ;<path_to_emmy_core>/?.dll"
49+
50+ -- Initialize the debugger
51+ local dbg = require (" emmy_core" )
52+ dbg .tcpListen (" localhost" , 9966 )
53+
54+ -- Optional: Wait for IDE connection
55+ -- dbg.waitIDE()
56+
57+ -- Optional: Set a breakpoint
58+ -- dbg.breakHere()
59+ ```
60+
61+ #### 🐧 Linux
62+ ``` lua
63+ -- Add the emmy_core library to your package path
64+ package.cpath = package.cpath .. " ;<path_to_emmy_core>/?.so"
65+
66+ -- Initialize the debugger
1267local dbg = require (" emmy_core" )
1368dbg .tcpListen (" localhost" , 9966 )
14- dbg .waitIDE () -- donot need
15- dbg .breakHere () -- donot need
69+
70+ -- Optional: Wait for IDE connection
71+ -- dbg.waitIDE()
72+
73+ -- Optional: Set a breakpoint
74+ -- dbg.breakHere()
1675```
1776
18- ### Other OS
77+ #### 🍎 macOS
1978``` lua
20- package.cpath = package.cpath .. " ;<path to emmy_core>/?.dll"
79+ -- Add the emmy_core library to your package path
80+ package.cpath = package.cpath .. " ;<path_to_emmy_core>/?.dylib"
81+ -- Initialize the debugger
2182local dbg = require (" emmy_core" )
2283dbg .tcpListen (" localhost" , 9966 )
23- dbg .waitIDE () -- donot need
24- dbg .breakHere () -- donot need
84+
85+ -- Optional: Wait for IDE connection
86+ -- dbg.waitIDE()
87+
88+ -- Optional: Set a breakpoint
89+ -- dbg.breakHere()
2590```
2691
27- And start your program, waitting for dap connected.
2892
29- ### Dap config
93+ ### ⚙️ DAP Configuration
94+
95+ Create a launch configuration in your editor:
96+
3097``` json
3198{
3299 "type" : " emmylua_new" ,
33100 "request" : " launch" ,
34- "name" : " EmmyLua New Debug" ,
101+ "name" : " 🐛 EmmyLua Debug Session " ,
35102 "host" : " localhost" ,
36103 "port" : 9966 ,
37104 "sourcePaths" : [
38- " ${workspaceFolder}" ,
105+ " ${workspaceFolder}"
39106 ],
40107 "ext" : [
41108 " .lua" ,
@@ -46,6 +113,59 @@ And start your program, waitting for dap connected.
46113}
47114```
48115
49- ## editor example
116+ ## 🎮 Usage
117+
118+ 1 . ** Add debug code** to your Lua application (see setup section above)
119+ 2 . ** Start your Lua program** - it will wait for the debugger to connect
120+ 3 . ** Launch the debug session** from your editor using the DAP configuration
121+ 4 . ** Set breakpoints** and start debugging! 🎉
122+
123+ ## 🔧 Editor Integration
124+
125+ ### VS Code
126+ Currently, the EmmyLua extension does not use this project as its DAP implementation.
127+
128+ ### Neovim
129+ 1 . Use ` nvim-dap ` plugin
130+ 2 . Configure the DAP adapter
131+ 3 . Set up launch configuration
132+
133+ ### IntelliJ IDEA
134+ 1 . Install the "LSP4IJ" plugin
135+ 2 . Configure the DAP adapter in the dap configuration
136+ 3 . Set up a run configuration for your Lua application
137+
138+ ### Other Editors
139+ Any editor that supports the Debug Adapter Protocol can be used:
140+ - ** Vim** (with DAP plugins)
141+ - ** Emacs** (with DAP mode)
142+ - ** Eclipse** (with DAP extensions)
143+
144+ ## 📋 Configuration Options
145+
146+ | Option | Type | Description | Default |
147+ | --------| ------| -------------| ---------|
148+ | ` host ` | string | Debug server host | ` "localhost" ` |
149+ | ` port ` | number | Debug server port | ` 9966 ` |
150+ | ` sourcePaths ` | array | Source code directories | ` ["${workspaceFolder}"] ` |
151+ | ` ext ` | array | Supported file extensions | ` [".lua", ".lua.txt", ".lua.bytes"] ` |
152+ | ` ideConnectDebugger ` | boolean | IDE initiates connection | ` true ` |
153+
154+ ## 🤝 Contributing
155+
156+ We welcome contributions! Please feel free to:
157+
158+ - 🐛 Report bugs
159+ - 💡 Suggest features
160+ - 🔧 Submit pull requests
161+ - 📚 Improve documentation
162+
163+ ## 📜 License
164+
165+ This project is licensed under the MIT License - see the [ LICENSE] ( LICENSE ) file for details.
166+
167+ ## 🙏 Acknowledgments
168+
169+ - [ EmmyLuaDebugger] ( https://github.com/EmmyLua/EmmyLuaDebugger ) - The core debugging engine
170+ - Contributors who help improve this project
50171
51- TODO: I don't know how to use it in other editor, please help me to add it.
0 commit comments