Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve debugger #2075

Merged
merged 6 commits into from
Nov 26, 2018
Merged

Improve debugger #2075

merged 6 commits into from
Nov 26, 2018

Conversation

bhcleek
Copy link
Collaborator

@bhcleek bhcleek commented Nov 26, 2018

reset current directory after each test
use go list to get import path via go#package#FromPath
fix uses of g:go_debug_commands
  • use go#config#DebugCommands() when reading the value so that it
    doesn't have to be set before the read.
  • return an empty list instead of an empty dictionary for its default
    value.
Shutdown and detach from delve correctly

Use a single connection to delve to simplify detaching properly. The
previous implementation was making a connection to delve for each
request and was never closing any of them. Instead, create a single
connection to delve and reuse it for each rpc call. This allows vim-go
to not have to pass --accept-multiclient, which in turn shutsdown
delve when detach is called.

As part of this work, call_jsonrpc was refactored to not deal with
callbacks explicitly. Because Neovim requires a callback to get data
from a socket, the on_data callback was moved into out_cb and
improved to deal with the edge cases that Neovim has with regard to
partial messages.

delay changing working directory for dlv test

Delay changing the working directory for debugging tests only if the
package to be debugged could be determined.

Return early and show an error if the package could not be determined.

add debug tests

Add debug tests to ensure that :GoDebugStart and :GoDebugStop work as
expected with no arguments, a relative package and package specified
with its full import path

The test package source file is in a package named debugmain instead of
following the usual pattern (e.g. debug), because delve seems to choke
pretty hard on when the package being debugged is named debug...

* use go#config#DebugCommands() when reading the value so that it
  doesn't have to be set before the read.
* return an empty list instead of an empty dictionary for its default
  value.
Use a single connection to delve to simplify detaching properly. The
previous implementation was making a connection to delve for each
request and was never closing any of them. Instead, create a single
connection to delve and reuse it for each rpc call. This allows vim-go
to not have to pass `--accept-multiclient`, which in turn shutsdown
delve when detach is called.

As part of this work, `call_jsonrpc` was refactored to not deal with
callbacks explicitly. Because Neovim requires a callback to get data
from a socket, the `on_data` callback was moved into `out_cb` and
improved to deal with the edge cases that Neovim has with regard to
partial messages.
Delay changing the working directory for debugging tests only if the
package to be debugged could be determined.

Return early and show an error if the package could not be determined.
Add debug tests to ensure that :GoDebugStart and :GoDebugStop work as
expected with no arguments, a relative package and package specified
with its full import path

The test package source file is in a package named debugmain instead of
following the usual pattern (e.g. debug), because delve seems to choke
pretty hard on when the package being debugged is named debug...
@bhcleek bhcleek merged commit 7d1ff58 into fatih:master Nov 26, 2018
@bhcleek bhcleek deleted the improve-debugger branch November 26, 2018 05:09
bhcleek added a commit that referenced this pull request Nov 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant