Commit Graph

161 Commits

Author SHA1 Message Date
zzbot
8aa617ec03 Auto merge of #2861 - puremourning:always-supply-wd, r=micbou
[READY] Always supply working directory

This allows completer servers to detect the correct directory to launch
no matter what request initialises the completer server.

# PR Prelude

Thank you for working on YCM! :)

**Please complete these steps and check these boxes (by putting an `x` inside
the brackets) _before_ filing your PR:**

- [X] I have read and understood YCM's [CONTRIBUTING][cont] document.
- [X] I have read and understood YCM's [CODE_OF_CONDUCT][code] document.
- [X] I have included tests for the changes in my PR. If not, I have included a
  rationale for why I haven't.
- [X] **I understand my PR may be closed if it becomes obvious I didn't
  actually perform all of these steps.**

# Why this change is necessary and useful

This change ensures that the client supplies the working directory to the server on each request, in particular, event notifications; the java and javascript completers use this to start the server in the `FileReadyToParse` event, rather than on construction of the completer. The subtle difference allows them to use the client's working directory, rather than the _server's_ working directory to do things like project detection.

See also:

* This is PR 1 of the set of changes related to #2827 - client changes required to support Java and other language-server protocols.
* ycmd change for javascript that makes use of this now: https://github.com/Valloric/ycmd/pull/886
* updated API doc: http://puremourning.github.io/ycmd-1

The ycmd API change is simply to allow `working_dir` on all requests.

cc for minor optional API change: @abingham @Qusic @LuckyGeck @mawww @richard1122 @jakeanq @orsonteodoro

[cont]: https://github.com/Valloric/YouCompleteMe/blob/master/CONTRIBUTING.md
[code]: https://github.com/Valloric/YouCompleteMe/blob/master/CODE_OF_CONDUCT.md

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2861)
<!-- Reviewable:end -->
2017-12-22 17:36:34 -08:00
Ben Jackson
bc6ac461f3 Always supply working directory
This allows completer servers to detect the correct directory to launch
no matter what request initialises the completer server.
2017-12-23 00:51:21 +00:00
micbou
497a803188
Prompt the user to select a logfile with YcmToggleLogs
When no argument is given to the YcmToggleLogs command, instead of displaying
the list of available logfiles, prompt the user to open (or close if already
open) one of them.
2017-12-22 19:58:29 +01:00
micbou
2b8e86797c
Improve server crash notification at startup
Notify the user if the server crashed during server polling at startup.
2017-10-05 13:12:23 +02:00
micbou
ee25d5b8eb
Close options file before starting server
On Windows, the options file cannot be deleted while it is still open by
another process. Close the file before starting the server. Do not explicitly
flush the file as closing implies flushing.
2017-09-23 14:13:02 +02:00
micbou
5d78e4c2c0
Improve path to python interpreter error handling 2017-09-21 21:17:32 +02:00
micbou
031edea89e
Improve error message when server crashes
Give the exact command that the user needs to type to open the server logfile
when the server unexpectedly crashes.
2017-08-18 18:15:20 +02:00
micbou
bdac8ed43e
Do not read server stderr
Reading ycmd stderr blocks Vim if a subserver process is still up even if ycmd
is not running.
2017-08-17 20:16:54 +02:00
micbou
1e935db4b7
Fix unicode warning when unloading buffer on Python 2 2017-07-08 14:46:04 +02:00
micbou
600383fbac
Do not cache omnifunc on FileReadyToParse event 2017-07-07 21:39:27 +02:00
micbou
1ceabea26e
Stop polling for readiness if server crashed 2017-07-05 05:19:47 +02:00
micbou
223ae6ab9f
Rewrite completion system
Bring fully asynchronous completion by polling for completions with a timer
then calling completefunc once the completions are ready. Use the start column
returned by the server in completefunc. Immediately display the last completion
on the TextChangedI event to prevent the popup menu disappearing while waiting
for the completions. Handle the TextChangedI event not being triggered while
the completion menu is open by closing the menu when inserting a character
through the InsertCharPre event, and when deleting a character on the <BS> and
<C-h> keys.
2017-06-21 02:32:57 +02:00
Davit Samvelyan
a70755aa40 Removed current buffer caching approach. 2017-06-12 15:23:14 +04:00
Davit Samvelyan
8c6efb4214 Cache current buffer on buffer visit. 2017-06-04 12:09:49 +04:00
Davit Samvelyan
fc745f74b3 Minor changes addressing review comments. 2017-05-29 22:24:55 +04:00
Davit Samvelyan
3a690fc8d4 Update based on the latest upstream changes. 2017-05-21 18:58:29 +04:00
Davit Samvelyan
0846673aa4 Latest upstream changes with buffer emulation.
Contains diagnostic interface improvents as well.
2017-05-21 18:26:50 +04:00
Davit Samvelyan
979f14acfd Moved change tracking to python. Per buffer diags 2017-05-21 11:47:27 +04:00
micbou
1fc6b4a43b
Clean C# inserting namespace code
Remove code that automatically insert namespaces in C# for Vim versions prior
to 7.4.774.
2017-05-17 19:44:02 +02:00
micbou
3ac2951c7b
Parse current buffer when server is ready 2017-05-15 23:57:09 +02:00
micbou
4e08cde268
Shut down ycmd after 30 minutes of inactivity 2017-05-15 11:20:48 +02:00
Andrey Pikas
ebc3856121 Merge branch 'master' into fork_master 2017-03-30 20:26:11 +03:00
Mike Perri
656ddc34e3 Enable diagnostics for TypeScript and update README 2017-03-25 11:22:02 -04:00
micbou
f3ccafe3ae
Do not install aliases from future
Installing aliases from python-future is unreliable and slow.
2017-03-18 18:24:48 +01:00
Andrey Pikas
3db1413cd9 Send extra_conf_vim_data in requests from :YcmCompleter and :YcmDebugInfo commands. It's needed for passing compile_commands.json directory to every call of FlagsForFile in client_data argument. 2017-03-11 13:34:37 +03:00
micbou
7e31634072
Convert stderr from server to unicode
On Python 3, reading stderr from server returns bytes. We need to convert it to
unicode for splitlines.
2017-03-08 17:30:00 +01:00
micbou
0d476a0164
Refactor diagnostic commands
Move s:ShowDiagnostics and s:ForceCompileAndDiagnostics logic to the Python layer.
Clear message about compilation blocking Vim once it is done.
2017-02-20 18:28:49 +01:00
micbou
c349980bce
Send requests again when server becomes ready 2017-02-18 14:04:03 +01:00
micbou
05256d6719
Define connect timeout
Rely on connect timeout instead of checking if the server is alive.
2017-01-24 22:43:40 +01:00
micbou
ab758e4c64
Include subservers logfiles in YcmToggleLogs 2017-01-21 13:42:58 +01:00
micbou
18aba7a582
Implement new debugging information API 2017-01-18 11:13:11 +01:00
micbou
fd41d52dfe
Catch and log all server exceptions 2016-12-12 02:36:15 +01:00
micbou
b93c1fd47c
Add client logfile 2016-11-19 18:47:43 +01:00
micbou
c33a844e5f
Fix flake8 error 2016-11-15 11:15:16 +01:00
micbou
f6ffe1f1a6
Remove unloaded_buffer parameter 2016-10-27 01:48:33 +02:00
micbou
c991f04905
Create temporary files in a secure manner
Fixes #2395.
2016-10-24 22:45:15 +02:00
micbou
234658f30b
Use helper function to get current directory
Fix tests.
2016-10-18 15:35:51 +02:00
micbou
2fabac5a67
Fix BufferUnload event notification
Send the request as the unloaded buffer instead of the current buffer
for the BufferUnload event notification. This fixes the issue where
the filetype of the current buffer is not the same as the unloaded
buffer one, making the ycmd server uses the wrong completer when
handling the request.
2016-10-08 16:43:50 +02:00
micbou
981a07ded7
Handle keyboard interruption from Vim 2016-09-13 00:53:31 +02:00
micbou
5dca552d5d
Do not depend on UltiSnips internals
Use UltiSnips#SnippetsInCurrentScope to fetch snippets.
Add an entry in the FAQ about the :UltiSnipsAddFiletypes command.
2016-09-11 17:11:32 +02:00
micbou
391757eec2 Avoid hit-enter prompts during completions
When an error occurs during completions, a message is displayed on
the status line. If this message is longer than the width of the
current window, Vim will prompt the user to press enter or type a
command to hide the message, interrupting user workflow. We prevent
that by truncating the message to window width.
Merge PostMultiLineNotice, EchoText, and EchoTextVimWidth functions
into PostVimMessage.
2016-08-28 09:19:07 +02:00
micbou
630b85ad01 Use shutdown request to stop server
Use shutdown request to stop ycmd server in a portable way.
2016-07-23 11:21:20 +02:00
Ben Jackson
4d7b386a37 Fix a number of multi-byte errors and tracebacks
- Correct FixIts when there are unicode characters
- Fix errors in CompleteDone handler
- Fix tracebacks when omnifunc returns unicode chars
2016-05-08 15:32:36 +01:00
micbou
b440f682a8 Add error messages when ycmd crashed
Display an error message to the user depending on the status code
returned by the ycmd server.
Remove ycm_core checks in plugin/youcompleteme.vim. These checks are
now done by the ycmd server.
Do not start a separate process to check the core version but rely on
ycmd returning a specific exit code. This slightly improves the Vim
startup time.
2016-05-02 23:08:32 +02:00
micbou
d59dfb0a7e Do not send request if server is down
Do not send an "event_notification" request in OnFileReadyToParse
function if server process is terminated. Otherwise, it blocks Vim
for one second or results in a traceback each time the InsertLeave,
CursorMoved, CursorHold, and BufferVisit events are triggered.
2016-03-09 16:53:20 +01:00
Ben Jackson
edd2bdbe0f Update flake8 config 2016-03-06 17:39:55 +00:00
Val Markovic
be1bb3617d Minor tweaks 2016-02-28 19:23:40 -08:00
Val Markovic
123c5c4acb Fixing ycmd startup under py3
Some syntax rules are different for py3 plus the standard bytes vs
unicode nonsense.
2016-02-28 14:41:09 -08:00
Val Markovic
4e82409cc1 Futurize pass + manual fixes 2016-02-27 16:12:44 -08:00
Val Markovic
f986bf19db Updating to latest ycmd 2016-02-22 09:50:15 -08:00