-
-
Notifications
You must be signed in to change notification settings - Fork 242
Closed as not planned
Description
Debug adapter definition and debug configuration
I installed vscode-go
by mason
.
dap.adapters.go = {
type = "executable",
command = "node",
args = {
require("mason-registry").get_package("go-debug-adapter"):get_install_path()
.. "/extension/dist/debugAdapter.js",
},
}
dap.configurations.go = {
{
type = "go",
name = "Debug (file)",
request = "launch",
cwd = "${workspaceFolder}",
program = utils.input_file_path(),
console = "integratedTerminal",
dlvToolPath = vim.fn.exepath("dlv"),
showLog = true,
showRegisters = true,
stopOnEntry = false,
},
{
type = "go",
name = "Debug (file with args)",
request = "launch",
cwd = "${workspaceFolder}",
program = utils.input_file_path(),
args = utils.input_args(),
console = "integratedTerminal",
dlvToolPath = vim.fn.exepath("dlv"),
showLog = true,
showRegisters = true,
stopOnEntry = false,
},
{
type = "go",
name = "Debug (executable)",
request = "launch",
cwd = "${workspaceFolder}",
program = utils.input_exec_path(),
args = utils.input_args(),
console = "integratedTerminal",
dlvToolPath = vim.fn.exepath("dlv"),
mode = "exec",
showLog = true,
showRegisters = true,
stopOnEntry = false,
},
{
type = "go",
name = "Debug (test file)",
request = "launch",
cwd = "${workspaceFolder}",
program = utils.input_file_path(),
console = "integratedTerminal",
dlvToolPath = vim.fn.exepath("dlv"),
mode = "test",
showLog = true,
showRegisters = true,
stopOnEntry = false,
},
{
type = "go",
name = "Debug (using go.mod)",
request = "launch",
cwd = "${workspaceFolder}",
program = "./${relativeFileDirname}",
console = "integratedTerminal",
dlvToolPath = vim.fn.exepath("dlv"),
mode = "test",
showLog = true,
showRegisters = true,
stopOnEntry = false,
},
}
Debug adapter version
0.39.1
Steps to Reproduce
Create a test project:
mkdir test_dap_io
cd test_dap_io
touch test_dap_io.go
go mod init
nvim test_dap_io.go
Fill the file content with:
package main
import "fmt"
func main() {
var n = 0
fmt.Printf("Enter a number: ")
_, err := fmt.Scanf("%d", &n)
if err != nil {
fmt.Println(err)
return
}
fmt.Printf("The enter number is n = %d\n", n)
}
- Set the breakpoint at line 8.
- Start debug.
- Next
Expected Result
Can input in the terminal and redirect it to dap session.
AFAIK vscode-go
supports this feature:
https://github.com/golang/vscode-go/wiki/debugging#configuration
https://github.com/golang/vscode-go/wiki/debugging#handling-stdin
Thanks in advance!
Actual Result
Metadata
Metadata
Assignees
Labels
No labels