-
Notifications
You must be signed in to change notification settings - Fork 766
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
[READY] Overhaul Go completer #505
Conversation
171f8e6
to
daed0ff
Compare
Excellent stuff! Thanks for taking this on. Some comments left.
|
daed0ff
to
f401a26
Compare
Reviewed 5 of 5 files at r1, 1 of 1 files at r2. ycmd/completers/go/go_completer.py, line 127 [r1] (raw file):
|
Review status: all files reviewed at latest revision, 6 unresolved discussions. ycmd/completers/go/go_completer.py, line 316 [r1] (raw file):
|
|
f401a26
to
f36f014
Compare
Reviewed 1 of 1 files at r3. ycmd/completers/go/go_completer.py, line 316 [r1] (raw file):
|
I see coverage decreasing. Not good. Could we add some more tests? Idea is to aim for >=95% test coverage for new code. |
f36f014
to
5ff026c
Compare
I added tests for the
|
5ff026c
to
dd3463b
Compare
Move the
|
|
2a8b7b6
to
9bb2745
Compare
Reviewed 1 of 1 files at r6. ycmd/completers/go/go_completer.py, line 316 [r1] (raw file):
|
|
Improve Go completer with the following changes: - start GoCode as a server; - add locks when starting and stopping the server; - create logfiles for GoCode; - implement DebugInfo method; - add StopServer and RestartServer subcommands; - do not expose the StopServer command to users; - improve exception handling for GoTo subcommand; - implement ServerIsRunning, ServerIsHealthy, and ServerIsReady methods; - change error message when no completions found; - update Gocode to latest commit; - update Go binaries paths; - rewrite Go tests; - add tests for DebugInfo, DefinedSubcommands, and _ComputeOffset methods; - add test for when unable to jump to definition; - raise an exception if unable to compute offset.
9bb2745
to
3fe7ea5
Compare
@micbou Any specific reason why you're not merging this? You have two LGTMs. |
No particular reason. Let's merge it. @homu r+
|
📌 Commit 3fe7ea5 has been approved by |
[READY] Overhaul Go completer This PR includes the changes mentioned in PR #282 for the Go completer and other small changes (listed in the commit message). The main change is the way we start the `gocode` daemon: instead of letting the client automatically start the daemon, we directly start it by running the `gocode` executable in server mode (using the `-s` parameter). This allows us to: - get its PID; - log stdout and stderr into files; - enable `gocode` debug mode; - set the port listened by `gocode`; - terminate the process; - implement the `_ServerIs*` methods; - etc. The second important change is the implementation of the `DebugInfo` method to show debug informations about the Go completer. The way informations are displayed will be adapted to other completers. Here's the output obtained in Vim when editing a Go file before and after the changes: Before: ``` Printing YouCompleteMe debug information... -- Server has Clang support compiled in: True -- Clang version: clang version 3.8.0 (branches/release_38) -- -- Server running at: http://127.0.0.1:59642 -- Server process ID: 4884 -- Server logfiles: -- c:\users\micbou\appdata\local\temp\ycm_temp\server_59642_stdout.log -- c:\users\micbou\appdata\local\temp\ycm_temp\server_59642_stderr.log ``` *How can I write a good issue report in these conditions?* After: ``` Printing YouCompleteMe debug information... -- Server has Clang support compiled in: True -- Clang version: clang version 3.8.0 (branches/release_38) -- Go completer debug information: -- Gocode running at: http://127.0.0.1:59667 -- Gocode process ID: 8720 -- Gocode binary: C:\Users\micbou\VIM~1\bundle\YOUCOM~2\THIRD_~1\ycmd\third_pa rty\gocode\gocode.exe -- Gocode logfiles: -- C:\Users\micbou\AppData\Local\Temp\ycm_temp\gocode_59667_stdout.log -- C:\Users\micbou\AppData\Local\Temp\ycm_temp\gocode_59667_stderr.log -- Godef binary: C:\Users\micbou\VIM~1\bundle\YOUCOM~2\THIRD_~1\ycmd\third_par ty\godef\godef.exe -- Server running at: http://127.0.0.1:59663 -- Server process ID: 2788 -- Server logfiles: -- c:\users\micbou\appdata\local\temp\ycm_temp\server_59663_stdout.log -- c:\users\micbou\appdata\local\temp\ycm_temp\server_59663_stderr.log ``` *Please help, I am overwhelmed by all this information.* Finally, the last important change (copied from the Python completer) is replacing the `StartServer` subcommand with the `RestartServer` one (reasoning is that if you can restart the server, you can start it too) and hiding the `StopServer` subcommand from the user (if users need to stop the server then something is wrong with the completer). <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/ycmd/505) <!-- Reviewable:end -->
☀️ Test successful - status |
This PR includes the changes mentioned in PR #282 for the Go completer and other small changes (listed in the commit message). The main change is the way we start the
gocode
daemon: instead of letting the client automatically start the daemon, we directly start it by running thegocode
executable in server mode (using the-s
parameter). This allows us to:gocode
debug mode;gocode
;_ServerIs*
methods;The second important change is the implementation of the
DebugInfo
method to show debug informations about the Go completer. The way informations are displayed will be adapted to other completers. Here's the output obtained in Vim when editing a Go file before and after the changes:Before:
How can I write a good issue report in these conditions?
After:
Please help, I am overwhelmed by all this information.
Finally, the last important change (copied from the Python completer) is replacing the
StartServer
subcommand with theRestartServer
one (reasoning is that if you can restart the server, you can start it too) and hiding theStopServer
subcommand from the user (if users need to stop the server then something is wrong with the completer).This change is![Reviewable](https://camo.githubusercontent.com/23b05f5fb48215c989e92cc44cf6512512d083132bd3daf689867c8d9d386888/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)