@@ -102,7 +102,7 @@ Create a launch configuration in your editor:
102102 "host" : " localhost" ,
103103 "port" : 9966 ,
104104 "sourcePaths" : [
105- " ${workspaceFolder} "
105+ " path/to/your/workspace "
106106 ],
107107 "ext" : [
108108 " .lua" ,
@@ -122,24 +122,183 @@ Create a launch configuration in your editor:
122122
123123## 🔧 Editor Integration
124124
125- ### VS Code
125+ <details >
126+ <summary ><b >VS Code</b ></summary >
127+
126128Currently, the EmmyLua extension does not use this project as its DAP implementation.
127129
128- ### Neovim
129- 1 . Use ` nvim-dap ` plugin
130- 2 . Configure the DAP adapter
131- 3 . Set up launch configuration
130+ </ details >
131+
132+ < details >
133+ < summary >< b >Neovim</ b ></ summary >
132134
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
135+ 1 . Install the ` nvim-dap ` plugin
136+ 2 . Configure the DAP adapter in your Neovim config:
137+
138+ ``` lua
139+ local dap = require (' dap' )
140+
141+ dap .adapters .emmylua = {
142+ type = ' executable' ,
143+ command = ' /path/to/emmylua_dap' ,
144+ args = {}
145+ }
146+
147+ dap .configurations .lua = {
148+ {
149+ type = ' emmylua' ,
150+ request = ' launch' ,
151+ name = ' EmmyLua Debug' ,
152+ host = ' localhost' ,
153+ port = 9966 ,
154+ sourcePaths = { ' path/to/your/workspace' }, -- maybe exist some env variable
155+ ext = { ' .lua' },
156+ ideConnectDebugger = true
157+ }
158+ }
159+ ```
160+
161+ 3 . Start debugging with ` :DapContinue `
162+
163+ </details >
164+
165+ <details >
166+ <summary ><b >IntelliJ IDEA</b ></summary >
167+
168+ 1 . Install the ** "EmmyLua"** or ** "LSP4IJ"** plugin
169+ 2 . Go to ** Run** → ** Edit Configurations**
170+ 3 . Add a new ` Debug Adapter Protocol ` configuration
171+ 4 . set command path to ` emmylua_dap ` executable
172+ 5 . write working directory
173+ 6 . debug mode: launch
174+ 7 . debug parameters:
175+ ``` json
176+ {
177+ "type" : " emmylua_new" ,
178+ "request" : " launch" ,
179+ "name" : " EmmyLua Debug Session" ,
180+ "host" : " localhost" ,
181+ "port" : 9966 ,
182+ "sourcePaths" : [
183+ " ${workspaceFolder}"
184+ ],
185+ "ext" : [
186+ " .lua" ,
187+ " .lua.txt" ,
188+ " .lua.bytes"
189+ ],
190+ "ideConnectDebugger" : true
191+ }
192+
193+ ```
194+
195+
196+ </details >
197+
198+ <details >
199+ <summary ><b >Zed Editor</b ></summary >
200+
201+ 1 . Open your project in Zed
202+ 2 . Create or edit ` .zed/launch.json ` :
203+
204+ ``` json
205+ {
206+ "version" : " 0.2.0" ,
207+ "configurations" : [
208+ {
209+ "type" : " emmylua" ,
210+ "request" : " launch" ,
211+ "name" : " EmmyLua Debug" ,
212+ "program" : " /path/to/emmylua_dap" ,
213+ "host" : " localhost" ,
214+ "port" : 9966 ,
215+ "sourcePaths" : [" $ZED_WORKTREE_ROOT" ],
216+ "ext" : [" .lua" , " .lua.txt" , " .lua.bytes" ],
217+ "ideConnectDebugger" : true
218+ }
219+ ]
220+ }
221+ ```
222+
223+ 3 . Start debugging from the Debug panel
224+
225+ </details >
226+
227+ <details >
228+ <summary ><b >Vim (with vim-dap)</b ></summary >
229+
230+ 1 . Install a DAP plugin like ` vimspector ` or ` vim-dap `
231+ 2 . Configure ` .vimspector.json ` :
232+
233+ ``` json
234+ {
235+ "configurations" : {
236+ "EmmyLua Debug" : {
237+ "adapter" : " emmylua" ,
238+ "configuration" : {
239+ "request" : " launch" ,
240+ "host" : " localhost" ,
241+ "port" : 9966 ,
242+ "sourcePaths" : [" ${workspaceFolder}" ],
243+ "ext" : [" .lua" , " .lua.txt" , " .lua.bytes" ],
244+ "ideConnectDebugger" : true
245+ }
246+ }
247+ },
248+ "adapters" : {
249+ "emmylua" : {
250+ "command" : [" /path/to/emmylua_dap" ]
251+ }
252+ }
253+ }
254+ ```
255+
256+ 3 . Start debugging with ` :VimspectorLaunch `
257+
258+ </details >
259+
260+ <details >
261+ <summary ><b >Emacs (with dap-mode)</b ></summary >
262+
263+ 1 . Install ` dap-mode ` package
264+ 2 . Add to your Emacs config:
265+
266+ ``` elisp
267+ (require 'dap-mode)
268+
269+ (dap-register-debug-template
270+ "EmmyLua Debug"
271+ (list :type "emmylua"
272+ :request "launch"
273+ :name "EmmyLua Debug Session"
274+ :host "localhost"
275+ :port 9966
276+ :sourcePaths (list (lsp-workspace-root))
277+ :ext (list ".lua" ".lua.txt" ".lua.bytes")
278+ :ideConnectDebugger t))
279+ ```
280+
281+ 3 . Start debugging with ` M-x dap-debug `
282+
283+ </details >
284+
285+ <details >
286+ <summary ><b >Other Editors</b ></summary >
287+
288+ Any editor that supports the Debug Adapter Protocol can be used with EmmyLua DAP:
137289
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)
142290- ** Eclipse** (with DAP extensions)
291+ - ** Sublime Text** (with DAP plugins)
292+ - ** Atom** (with DAP packages)
293+ - ** Kate** (KDE Advanced Text Editor with DAP support)
294+
295+ General steps:
296+ 1 . Find and install a DAP plugin/extension for your editor
297+ 2 . Configure the adapter executable path
298+ 3 . Set up the launch configuration with the parameters shown above
299+ 4 . Connect to your Lua application on port 9966
300+
301+ </details >
143302
144303## 📋 Configuration Options
145304
@@ -167,5 +326,6 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
167326## 🙏 Acknowledgments
168327
169328- [ EmmyLuaDebugger] ( https://github.com/EmmyLua/EmmyLuaDebugger ) - The core debugging engine
329+ - [ emmy_dap_types] ( https://github.com/EmmyLuaLs/emmy_dap_types )
170330- Contributors who help improve this project
171331
0 commit comments