You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Support for scenes (`.tscn`) and script (`.gd`) files.
18
47
- Comment wrapping when using `fill-paragraph`.
@@ -233,111 +262,120 @@ Code example:
233
262
(setq gdscript-gdformat-save-and-format t) ;; Save all buffers and format them with gdformat anytime Godot executable is run.
234
263
```
235
264
236
-
## Debugger
265
+
## Using the debugger
266
+
267
+
Emacs GDScript mode includes support for the GDScript debugger. You can use breakpoints, use code stepping functions, see your nodes' state at runtime, and more.
268
+
269
+
To get started with this feature, you need to add a least one breakpoint.
237
270
238
-
Use <kbd>C-c C-d b</kbd> to add breakpoint to your GDScript file. Red dot will appear in the left fringe to indicate position where breakpoint is placed.
239
-
Use <kbd>C-c C-d r</kbd> to remove breakpoint.
271
+
### Adding and removing breakpoints
240
272
241
-
Once first breakpoint is added to the project, buffer named `* Breakpoints *` is created. This buffer displays all existing breakpoints in a project. Pressing <kbd>D</kbd> on breakpoint line deletes the breakpoint. Pressing <kbd>RET</kbd> on breakpoint line shows GDScript file with that breakpoint in other buffer.
273
+
You can add a breakpoint on the current line with `gdscript-debug-add-breakpoint` (<kbd>C-c C-d b</kbd>). A red dot should appear in the left fringe. Use `gdscript-debug-remove-breakpoint` (<kbd>C-c C-d r</kbd>) to remove a breakpoint on the current line.
242
274
243
-
When any breakpoint exists, running project will automatically start debugger server (if one isn't already running) and connect to it.
244
-
Debugger server runs on `localhost` with port specified by `gdscript-debug-port` customizable variable (`6010` by default).
275
+
After adding at least one breakpoint to the project, a buffer named `* Breakpoints *` is created. This buffer displays all existing breakpoints in a project. In that buffer, pressing <kbd>D</kbd> on a breakpoint line deletes the breakpoint. Pressing <kbd>RET</kbd> opens the corresponding GDScript file in another buffer.
245
276
246
-
Once breakpoint is hit in your code, Emacs will show two special buffers with information related to a position of the breakpoint:
277
+
### Running the project with the debugger active
247
278
248
-
-`* Stack frame vars *` - Display locals/members/globals variables for current stack point. It show variable name, its type and its value.
249
-
-`* Inspector *` - Display detailed information about selected `ObjectId`. By default it show `self` reference.
279
+
When any breakpoint exists, running the project with `gdscript-godot-run-project` will automatically start the debugger's server if one isn't already running and connect to it.
250
280
251
-
Any `ObjectId` in those two buffers can be inspected by pressing <kbd>RET</kbd> when point is on corresponding line.
281
+
The debugger's server runs on `localhost` through port `6010` by default. You can customize the port with the `gdscript-debug-port` variable.
252
282
253
-
### Oneline/multiline display
283
+
Once Godot hits a breakpoint, Emacs displays two new buffers:
254
284
255
-
Variable values of types `Dictionary`, `PoolRealArray`, `PoolStringArray`, `PoolVector2Array`, `PoolVector3Array` and `PoolColorArray` could be toggled from one line display to multiline display by pressing `TAB` on corresponding line.
285
+
-`* Stack frame vars *` displays the locals, members, and globals variables for the current stack point. It show variable name, its type and its value.
286
+
-`* Inspector *` displays detailed information about the selected object. By default, it shows the properties of `self`.
256
287
257
-
### Fetching `ObjectId` details
288
+
You can inspect any object in those two buffers by pressing <kbd>RET</kbd> on the corresponding line.
258
289
259
-
Pressing <kbd>d</kbd> in `* Stack frame vars *` or `* Inspector *` buffers (or on Debug Hydra) will fetch on the background data for all `ObjectId`s present in those two buffers and once all `ObjectId`s data are fetched, these two buffer are redisplayed. This redisplay will contain two additional informations about given `ObjectId`:
260
-
- real type (for example `KinematicBody2D` instead of `ObjectId`)
261
-
- node path
290
+
#### Multi-line display
262
291
263
-
Also fetched data are cached and not fetched again when said `ObjectId` is inspected later on (until new breakpoint is hit).
292
+
You can toggle between one-line and multi-line display for values of type `Dictionary`, `PoolRealArray`, `PoolStringArray`, `PoolVector2Array`, `PoolVector3Array` and `PoolColorArray`. To do so, press `TAB` on the corresponding line.
264
293
265
-
On breakpoint hit Debug Hydra will be displayed below `* Stack frame vars *` and `* Inspector *` buffers.
294
+
### Fetching an object's details
295
+
296
+
Pressing <kbd>d</kbd> in `* Stack frame vars *` or `* Inspector *` buffers (or in the debug hydra) will fetch on the background data for all objects present in those two buffers and redisplay once done. Doing that adds two extra bits of information about the objects:
297
+
298
+
- Their real type, for example, `KinematicBody2D` instead of `ObjectId`.
299
+
- Their node path.
266
300
267
301
### Debug Hydra
268
302
303
+
If `hydra` is available, the debug hydra displays below `* Stack frame vars *` and `* Inspector *` buffers upon hitting a breakpoint.
304
+
305
+
You can also call it by pressing <kbd>C-c n</kbd>.
306
+
269
307
```
270
308
n next c continue m step b breakpoints s stack v vars i inspector t scene-tree d details
271
309
o pin u unpin q quit
272
310
```
273
311
274
-
- <kbd>n</kbd> - Jump to next line and stops there
275
-
- <kbd>c</kbd> - Continue program execution until another breakpoint is hit
276
-
- <kbd>m</kbd> - Step into
277
-
- <kbd>s</kbd> - Show `* Stack dump *` buffer
278
-
- <kbd>v</kbd> - Show `* Stack frame vars *` buffer
279
-
- <kbd>i</kbd> - Show `* Inspector *` buffer
280
-
- <kbd>t</kbd> - Show `* Scene tree *` buffer
281
-
- <kbd>d</kbd> - Fetch details for all `ObjectId`s present in `* Stack frame vars *` and `* Inspector *` buffers and redisplay them
282
-
- <kbd>o</kbd> - Pin current `self``ObjectId`in `* Inspector *` buffer. It stays displayed until it cease to exists or until it get unpinned
283
-
- <kbd>u</kbd> - Unpin currently pinned `ObjectId`
284
-
- <kbd>q</kbd> - Close Debug Hydra
285
-
286
-
### `* Stack frame vars *` buffer
287
-
288
-
Main source of information about running program. Contains information about locals/members/globals variables.
289
-
290
-
-Press <kbd>TAB</kbd> to toggling oneline/multiline display for selected types
291
-
-Press <kbd>RET</kbd> on `ObjectId`line to display its details in `* Inspector *`buffer
292
-
-Press <kbd>l</kbd> to display`* Stack dump *` buffer
293
-
-Press <kbd>d</kbd> to display additional details for `ObjectId` variables
294
-
-Press <kbd>p</kbd> to go to previous line
295
-
-Press <kbd>n</kbd> to go to next line
296
-
-Press <kbd>o</kbd> to pin current `ObjectId` in `* Inspector *` buffer
297
-
-Press <kbd>u</kbd> to unpin currently pinned `ObjectId`
298
-
-Press <kbd>q</kbd> to close the buffer
312
+
- <kbd>n</kbd> - Steps to the next line of code.
313
+
- <kbd>c</kbd> - Continue program execution until the next breakpoint.
314
+
- <kbd>m</kbd> - Steps into the code.
315
+
- <kbd>s</kbd> - Shows the `* Stack dump *` buffer.
316
+
- <kbd>v</kbd> - Shows the `* Stack frame vars *` buffer.
317
+
- <kbd>i</kbd> - Shows the `* Inspector *` buffer.
318
+
- <kbd>t</kbd> - Shows the `* Scene tree *` buffer.
319
+
- <kbd>d</kbd> - Fetches details for all object present in the `* Stack frame vars *` and `* Inspector *` buffers and redisplay the buffers.
320
+
- <kbd>o</kbd> - Pins `self` in the `* Inspector *` buffer. It stays displayed until Godot frees the instance or you unpin it.
321
+
- <kbd>u</kbd> - Unpins the currently pinned object.
322
+
- <kbd>q</kbd> - Closes the debug hydra.
323
+
324
+
### The `* Stack frame vars *` buffer
325
+
326
+
The stack frame buffer displays the locals, members, and globals variables for the current stack point. Here are available keyboard shortcuts:
327
+
328
+
- <kbd>TAB</kbd> toggles multi-line display for selected types.
329
+
- <kbd>RET</kbd> on an object line to display its details in the `* Inspector *`buffer.
- <kbd>d</kbd> displays additional details for `ObjectId` variables.
332
+
- <kbd>p</kbd> goes to the previous line.
333
+
- <kbd>n</kbd> goes to the next line.
334
+
- <kbd>o</kbd> pins the current object in the `* Inspector *` buffer.
335
+
- <kbd>u</kbd> unpins the currently pinned object.
336
+
- <kbd>q</kbd> closes the buffer.
299
337
300
338
### `* Inspector *` buffer
301
339
302
340
Contains information about inspected object. By default `self` variable from `* Stack frame vars *` is displayed. Inspected object is kept to be focused until other object is inspected or until inspected object cease to exists, in which case current `self` is displayed instead.
303
341
304
-
- Press <kbd>TAB</kbd> to toggling oneline/multiline display for selected types
305
-
- Press <kbd>RET</kbd> on `ObjectId` line to display its details
306
-
- Press <kbd>RET</kbd> on `Node/path` line (second line from the top) to show given `ObjectId` in `* Scene Tree *`buffer
307
-
- Press <kbd>l</kbd> deep in nested `ObjectId` to navigate one level up in the structure (ie. back). Pressing `l` while on top level object displays `* Stack frame vars *`buffer
308
-
- Press <kbd>d</kbd> to display additional details for `ObjectId` variables
309
-
- Press <kbd>p</kbd> to go to previous line
310
-
- Press <kbd>n</kbd> to go to next line
311
-
- Press <kbd>o</kbd> to pin current `ObjectId` in `* Inspector *`buffer
312
-
- Press <kbd>u</kbd> to unpin currently pinned `ObjectId`
313
-
- Press <kbd>q</kbd> to close the buffer
342
+
- Press <kbd>TAB</kbd> to toggle multi-line display for selected typess.
343
+
- Press <kbd>RET</kbd> on object line to display its detailss.
344
+
- Press <kbd>RET</kbd> on `Node/path` line (second line from the top) to show given object in `* Scene Tree *`buffers.
345
+
- Press <kbd>l</kbd> deep in nested object to navigate one level up in the structure (ie. back). Pressing `l` while on top level object displays `* Stack frame vars *`buffers.
346
+
- Press <kbd>d</kbd> to display additional details for object variabless.
347
+
- Press <kbd>p</kbd> to go to the previous lines.
348
+
- Press <kbd>n</kbd> to go to the next lines.
349
+
- Press <kbd>o</kbd> to pin current object in `* Inspector *`buffers.
350
+
- Press <kbd>u</kbd> to unpin currently pinned objects.
351
+
- Press <kbd>q</kbd> to close the buffers.
314
352
315
353
### `* Stack dump *` buffer
316
354
317
355
Contains stack dump information.
318
356
319
-
- Press <kbd>SPC</kbd> to jump to gdscript file where stack frame points to
320
-
- Press <kbd>RET</kbd> to jump to gdscript file and to show `* Stack frame vars *`, `* Inspector *` buffers and a Debug Hydra
321
-
- Press <kbd>l</kbd> to display `* Stack frame vars *` buffer
322
-
- Press <kbd>p</kbd> to go to previous line
323
-
- Press <kbd>n</kbd> to go to next line
324
-
- Press <kbd>q</kbd> to close the buffer
357
+
- Press <kbd>SPC</kbd> to jump to gdscript file where stack frame points to.
358
+
- Press <kbd>RET</kbd> to jump to gdscript file and to show `* Stack frame vars *`, `* Inspector *` buffers and a debug hydra.
359
+
- Press <kbd>l</kbd> to display the `* Stack frame vars *` buffer.
360
+
- Press <kbd>p</kbd> to go to the previous line.
361
+
- Press <kbd>n</kbd> to go to the next line.
362
+
- Press <kbd>q</kbd> to close the buffer.
325
363
326
364
### `* Breakpoints *` buffer
327
365
328
-
Contains list of all existing breakpoints.
366
+
Lists all existing breakpoints in the project.
329
367
330
-
- Press <kbd>SPC</kbd> to enable/disable all breakpoints
331
-
- Press <kbd>RET</kbd> to open gdscript file where on give breakpoint position
332
-
- Press <kbd>TAB</kbd> to display `* Stack dump *` buffer
333
-
- Press <kbd>D</kbd> to delete the breakpoint
334
-
- Press <kbd>q</kbd> to close the buffer
368
+
- Press <kbd>SPC</kbd> to enable or disable all breakpoints.
369
+
- Press <kbd>RET</kbd> to jump to the file and line corresponding to the breakpoint..
370
+
- Press <kbd>TAB</kbd> to display the `* Stack dump *` buffer.
371
+
- Press <kbd>D</kbd> to delete the breakpoint.
372
+
- Press <kbd>q</kbd> to close the buffer.
335
373
336
374
### `* Scene tree *` buffer
337
375
338
-
Contains tree visualisation of all `ObjectId`s in the running program.
376
+
Contains a tree visualisation of all objects in the running program.
339
377
340
-
- Press <kbd>RET</kbd> to open corresponding `ObjectId` in `* Inspector *` buffer
341
-
- Press <kbd>p</kbd> to go to previous line
342
-
- Press <kbd>n</kbd> to go to next line
343
-
- Press <kbd>q</kbd> to close the buffer
378
+
- Press <kbd>RET</kbd> to open the corresponding object in the `* Inspector *` buffer.
0 commit comments