forked from fatih/vim-go
-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Documentation for debugger mode (WIP) #4
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Previously using `:GoDebugStart` without `dlv` installed would give the error: E117: Unknown function: go#debug#Start Which is not very clear. With this it's: vim-go: could not find 'dlv'. Run :GoInstallBinaries to fix it Which is a lot better :-)
Otherwise they will be lost when the using `:colorscheme` and some other commands.
Inheriting it from the colour scheme is problematic, since it can be anything. In my case (the default colour scheme), it's black. Black on dark blue is hard to read :-)
I think this makes more sense? No need for a long path for e.g. `a.go`. Stuff like e.g. `/usr/lib/go/src/runtime/proc.go` is still shown as the full path.
To allow folk to configure their own window layout, or even hide certain windows.
In case folk already have something running on port 8181 or something
Some small improvements for GoDebug
Previously it would error out with some undefined error.
Display error for Vim 7.4
This sets up the structure for the documentation for the new debug mode; it's not 100% complete yet. I also added a bunch of TODOs There are a bunch of TODOs sprinkled around for stuff I noticed that behaved unexpected/buggy. I added it as a new section instead of putting it in the regular commands/etc. sections. This seemed to make the most sense to me personally: this way there is an obvious location for a "getting started" section, and we can keep the docs for :GoDebugStart as a short and to the point reference doc.It also avoids having to add "This command/mapping is only available after using :GoDebug" on all the commands. I can move stuff around if you want.
Wow! Great! |
arp242
pushed a commit
to fatih/vim-go
that referenced
this pull request
Feb 27, 2018
* add GoDebug * set rpcid * abort immediately * implement stacktrace, balloon text * highlight * output window * start without breakpoint * add callback to handle delayed event * cancel next * logger * better to be partical callback * variable tree * delay start * buffer should be readonly * goto file * syntax support * function arguments * fix bug in variable viewer * arguments * remove expanded variables * update doc * check binary * display errors * Add modeline * More graceful handling when `dlv` isn't found Previously using `:GoDebugStart` without `dlv` installed would give the error: E117: Unknown function: go#debug#Start Which is not very clear. With this it's: vim-go: could not find 'dlv'. Run :GoInstallBinaries to fix it Which is a lot better :-) * Put the `highlight` commands inside a `ColorScheme` autocmd Otherwise they will be lost when the using `:colorscheme` and some other commands. * Define foreground colours too Inheriting it from the colour scheme is problematic, since it can be anything. In my case (the default colour scheme), it's black. Black on dark blue is hard to read :-) * Show paths relative to current working directory when it makes sense I think this makes more sense? No need for a long path for e.g. `a.go`. Stuff like e.g. `/usr/lib/go/src/runtime/proc.go` is still shown as the full path. * Add g:go_debug_windows setting To allow folk to configure their own window layout, or even hide certain windows. * Add g:go_debug_address setting In case folk already have something running on port 8181 or something * fix eval string * fix eval_var * open/close tree * string is array of byte * change directory * clear state before restart * reset state * unplace sign * add GoDebugStartWith to add options * fix GoDebugStart argments * Display error for Vim 7.4 Previously it would error out with some undefined error. * Run dlv from a temporary directory This fixes two things: - My comments here: 8d617ec#r138018608 It's true that `:lcd` is only for the current window, but me personally I still wouldn't expect any user-visible changes in the current directory when using `:GoDebugStart`. - It prevents `dlv` from creating a binary in the directory. At best this is an annoying side-effect, but at worst it could cause people to lose files: consider what would happen if someone has a package named `foo` but also had a file named `foo` in that directory? If you always use `go install` (like I do) then this is fine, and `:GoDebugStart` creating this file can be rather surprising. Note: this PR requires this patch to work correctly: #1435 * Show error for Neovim As it's not yet supported; otherwise it will give a confusing error. #1390 (comment) * Make temp dir in cross-platform way Since tempnam() seems to behave different on Linux and Windows. * Add documentation Was previously mattn#4 * Rename :GoDebugToggleBreakpoint to :GoDebugBreakpoint Such a mouthful otherwise... * Make :GoDebugStart accept a package name We need this because otherwise there is no way to debug a non-main package. For example if `arp242.net/foo` is the main package, and I want to add a breakpoint to e.g. `arp242.net/foo/bar`. Also use `g:go_build_tags` and remove `:GoDebugStartWith`; I don't think we really need to pass arguments to `dlv`, and if we do we can add an option for it or something. * Add ability to debug tests Need to call `dlv test` for that. * Clean tmpdir on job stop and exit s:exit() isn't called when using `:wq`, so also hook in to VimLeave * Remove :GoDebugStart command in debug mode It doesn't do anything. * Check for a:status > 0 It's -1? * Use go#util#Echo* helpers * Use g:go_debug for debug/development flags This is a more generic system we can also use for other stuff; for example one thing I'd like to add is a "cmd" flag to show all external commands that are being called. We could also add other flags. * Show more information in the variable window * Bugfix: log output would make windows switch Go back to previous window. Also fix lint errors: https://travis-ci.org/Carpetsmoker/vim-go/jobs/306457592 * Run "continue" when using :GoDebug{Next,Step} etc. if the program isn't running Otherwise it will just error out. * Don't error out if localVars or functionArgs aren't defined * Fix some more instances where it would jump windows * Rename :GoDebugEval to :GoDebugPrint I think this command makes more sense, as it "prints the result from an expression". It's also the command that the dlv commandline uses (`p` or `print`). * Remove :GoDebugCommand I'm not sure when this is useful? Remove for now. * Fix stepOut, expand g:go_debug, and remove stepIn - Delve needs `stepOut`, not `stepout`. This took me an insane amount of time to track down :-/ - Add `debugger-commands` to `g:go_debug`; useful to track down the above. - Remove stepin, as Delve doesn't seem to support that. The current implementation doesn't do anything, and it's not listed as one of the constants in `service/api/types.go` (around like 265). * Make :GoDebugBreakpoint accept a line number * Make it possible to define breakpoints before calling :GoDebugStart Much better UX, I think. Especially since starting dlv can take a bit; this will reduce the time people will need spend fiddling their thumbs. * Use --output instead of tmp dir * Make :GoDebugRestart work Need to remove the BufWipe events, as that would cause problems with them stopping the newly created async job. Not sure if that was a good idea in the first place to be honest, why shouldn't I be allowed to remove one of the windows from the layout? * Show string vars better in window * silent! the BalloonExpr Otherwise hovering over a string and lots of other stuff will show errors. * Some small fixes to the documentation. * Small documentation tweaks * Fix GoDebugBreakpoint colours on cterm
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This sets up the structure for the documentation for the new debug mode;
it's not 100% complete yet. I also added a bunch of TODOs There are a
bunch of TODOs sprinkled around for stuff I noticed that behaved
unexpected/buggy.
I added it as a new section instead of putting it in the regular
commands/etc. sections. This seemed to make the most sense to me
personally: this way there is an obvious location for a "getting
started" section, and we can keep the docs for :GoDebugStart as a short
and to the point reference doc.It also avoids having to add "This
command/mapping is only available after using :GoDebug" on all the
commands.
I can move stuff around if you want.