Skip to content

Commit

Permalink
Auto merge of #505 - micbou:go-completer-overhaul, r=micbou
Browse files Browse the repository at this point in the history
[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 -->
  • Loading branch information
homu committed Jun 6, 2016
2 parents e00b7ce + 3fe7ea5 commit 24ccb3b
Show file tree
Hide file tree
Showing 6 changed files with 594 additions and 270 deletions.