Skip to content

Commit

Permalink
Complete the documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
cyb3rd4d committed Jul 19, 2024
1 parent be9d514 commit a3cd1ef
Showing 1 changed file with 48 additions and 3 deletions.
51 changes: 48 additions & 3 deletions doc/nvim-dap-go.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ CONTENTS *dap-go-toc*
4. Debugging Individual Tests ............ |dap-go-debug-test|
5. Debugging With Command-Line Arguments . |dap-go-debug-cli-args|
6. Debugging With dlv in Headless Mode ... |dap-go-debug-headless|
7. Mappings .............................. |dap-go-mappings|
7. VSCode launch config .................. |dap-go-vscode-launch|
8. Mappings .............................. |dap-go-mappings|

========================================================================
FEATURES *dap-go-features*
Expand All @@ -35,6 +36,10 @@ FEATURES *dap-go-features*

- Configuration to run tests in a debug session.

- Final Delve configuration is resolved when a debug session starts.
This allows to use different addresses and ports for each project or
launch configs in a project.

This plugin makes usage of treesitter to find the nearest test to
debug. Make sure you have the Go treesitter parser installed. If using
|nvim-treesitter| plugin you can install with `:TSInstall go`.
Expand Down Expand Up @@ -79,7 +84,9 @@ The example bellow shows all the possible configurations:
initialize_timeout_sec = 20,
-- a string that defines the port to start delve debugger.
-- default to string "${port}" which instructs nvim-dap
-- to start the process in a random available port
-- to start the process in a random available port.
-- if you set a port in your debug configuration, its value will be
-- assigned dynamically.
port = "${port}",
-- additional args to pass to dlv
args = {},
Expand Down Expand Up @@ -159,6 +166,45 @@ Debugging With dlv in Headless Mode *dap-go-debug-headless*
3. Call `:lua require('dap').continue()` to start debugging.
4. Select the new registered option `Attach remote`.

-----------------------------------------------------------------------
VSCode launch config *dap-go-vscode-launch

1. In your neovim configuration, load the VSCode extension BEFORE
calling the `setup()` function:
>lua
require("dap.ext.vscode").load_launchjs()
require("dap-go").setup()
<

2. Create in your Go project a VSCode launch config file (by
default its path must be `.vscode/launch.json` relative to your
project's root directory):
>json
{
"version": "0.2.0",
"configurations": [
{
"name": "Remote debug API server",
"type": "go",
"request": "attach",
"mode": "remote",
"port": 4444,
"host": "127.0.0.1",
"substitutePath": [
{
"from": "${workspaceFolder}", "to": "/usr/src/app"
}
]
}
]
}
<

3. A debug session `Remote debug API server` will appear in the choices,
and the Delve port will be dynamically set to `4444`.

Please see `:h dap-launch.json` for more information.

========================================================================
MAPPINGS *dap-go-mappings*

Expand All @@ -172,5 +218,4 @@ mappings. You can do this by adding the lines bellow to your
vim.keymap.set("n", "<leader>dt", dapgo.debug_test)
vim.keymap.set("n", "<leader>dl", dapgo.debug_last_test)
<

vim:tw=78:et:ft=help:norl:

0 comments on commit a3cd1ef

Please sign in to comment.