Commit Graph

47 Commits

Author SHA1 Message Date
micbou
09a08d3240
Import requests module lazily
The requests module is slow to load so we should import it only when needed to reduce startup time.
2017-03-04 03:21:58 +01:00
micbou
10aba99782
Remove healthy check 2017-01-28 16:54:33 +01:00
micbou
6e8aeeac15
Catch ConnectionError instead of ConnectTimeout
On non-Windows platforms, a ConnectionError exception is raised instead
of a ConnectTimeout one when the connection cannot be established (e.g.
the server crashed). Since the latter is a subclass of the former, we
only need to catch ConnectionError.
2017-01-27 03:33:43 +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
deddca8927
Handle exceptions from loading/ignoring extra conf 2017-01-03 15:29:12 +01:00
micbou
85d5844873
Add docstring to HandleServerException
Wrap request with HandleServerException in YcmdKeepalive class.
2016-12-12 02:53:57 +01:00
micbou
fd41d52dfe
Catch and log all server exceptions 2016-12-12 02:36:15 +01: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
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
Ben Jackson
edd2bdbe0f Update flake8 config 2016-03-06 17:39:55 +00:00
Val Markovic
0ed1096040 Support multiline exception message
Also stopped adding the "ycmd exception:" prefix to error messages
because it lies; some exceptions hitting this may not come from ycmd.
2016-03-01 19:29:21 -08:00
Val Markovic
1e72f4d421 Making it clearer an exception came from ycmd
Makes debugging easier when you know where the error lies.
2016-02-28 14:38:23 -08:00
Val Markovic
1941d8bfb2 Fixing issues with bytes vs unicode for hmac 2016-02-27 17:38:38 -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
micbou
4835b49a89 Remove interpreter line from Python sources 2016-02-05 16:24:03 +01:00
Ben Jackson
258951ece4 If errors are returned in addition to completion suggestions, print them 2015-08-17 01:13:20 +01:00
Strahinja Val Markovic
a70bf21d29 Updating to latest ycmd
This required changing the HMAC calculation logic.
2015-04-17 15:01:29 -07:00
Strahinja Val Markovic
2fafab88c4 Ignoring the new "already being parsed" message
This exception comes from ycmd and is not something the user can do
anything about, so let's rather not show it.
2014-12-10 13:46:10 -08:00
Strahinja Val Markovic
c032cf30c0 Removing default server_location. 2014-08-22 11:25:58 -07:00
Strahinja Val Markovic
09d4723fcc Updating to latest ycmd
Top-level 'filetypes' property not needed in request data anymore.
2014-05-29 10:42:46 -07:00
Strahinja Val Markovic
4cf9cfcdff Updating to latest ycmd
Since ycmd doesn't need 'query', 'start_column' and 'line_value' params, we
don't send them anymore.
2014-05-27 14:30:22 -07:00
Strahinja Val Markovic
a69bbb3009 Updating code to work with new ycmd location 2014-05-13 13:09:19 -07:00
Strahinja Val Markovic
d56ec1ea7a ycmd's JSON interface now uses 1-based indices
This makes far more sense because editors manipulate user-level errors/warnings
on a 1-based system, not a 0-based one.
2014-05-09 15:57:04 -07:00
Strahinja Val Markovic
9691bd9236 Encoding the x-ycm-hmac header value as base64.
We need to respect RFC 5987.
2014-05-09 10:37:20 -07:00
Strahinja Val Markovic
e965e02847 Client/server communication now uses HMAC for auth
This is to prevent a convoluted exploit that can trigger remote code execution.
2014-04-25 11:07:08 -07:00
Strahinja Val Markovic
2f051ee9f1 YCM client now sends utf-8 encoded JSON.
Previously, we'd just use json.dumps() to dump out JSON. By default,
ensure_ascii is set to true and non-ASCII chars are encoded as \uXXXX.

Problems seem to happen with other text in the data then not being utf8. I'm not
sure why, still can't repro. This should go away now that we explicitly build a
unicode string which we then encode as utf8.

Hopefully fixes #821.
2014-03-19 13:16:49 -07:00
Strahinja Val Markovic
7a4f5a4a53 Minor var naming changes 2014-03-19 10:27:34 -07:00
Strahinja Val Markovic
18be5c254a Increasing worker thread count to 30
If it takes a while to compile the user's C++ file, the YCM client/server may
run out of threads. Vim gets laggy then.

This is a stopgap measure until I think of something better.
2014-02-07 12:46:45 -08:00
Strahinja Val Markovic
b1bba2e201 Changing copyright headers from me to Google
When I initially released this project, I released it under my own copyright. I
have since then worked on it in my 20% time at Google (and want to continue
doing this) and my life becomes much simpler if the copyright is Google's.

From the perspective of how this project is run and managed, **NOTHING**
changes. YCM is not a Google product, merely a project run by someone who just
happens to work for Google.

Please note that the license of the project is **NOT** changing.

People sending in future pull requests will have to sign the Google
[CLA](https://developers.google.com/open-source/cla/individual) (you can sign
online at the bottom of that page) before those pull requests could be merged
in. People who sent in pull requests that were merged in the past will get an
email from me asking them to sign the CLA as well.
2014-01-13 11:08:43 -08:00
Strahinja Val Markovic
cf6211055e Removing the server_idle_suicide_seconds option
This option existed so that the user can tweak it if they found the default idle
timeout too short, for instance if they leave their machine on over the weekend.

This use case is now covered by the new YcmdKeepalive system that pings ycmd
every 10 minutes as long as Vim is running. This prevents ycmd shutting down if
one leaves their Vim instance alone for a long time.

Thus the old option is useless now; ycmd now shuts down after 3 hours of
inactivity, which should only ever happen when its corresponding Vim instance
has shut down abnormally.
2013-11-20 12:33:57 -08:00
Strahinja Val Markovic
7bfb4c3402 Use a thread pool that doesn't join workers
By default, a ThreadPoolExecutor will wait at Python interpreter shutdown for
all the threads to stop by themselves before letting the interpreter shut down.

We don't want that for the network requests thread pool, it causes a shutdown
latency if there are outstanding requests. Killing the threads in our pool is
perfectly safe so we can avoid the latency by introducing an
UnsafeThreadPoolExecutor.
2013-10-30 18:08:35 -07:00
Strahinja Val Markovic
acae8e4e9d Tweaked the request retries logic.
We now send more retry requests that are less spaced apart.
2013-10-17 14:45:53 -07:00
Strahinja Val Markovic
40464f6e0d Resolving issues with event requests timing out
It appears that the issue comes from sending a None timeout to Requests. It
seems it's a bug in Requests/urllib3. So we just pick an arbitrary long timeout
of 30s as the default.
2013-10-17 14:21:37 -07:00
Strahinja Val Markovic
bc607724f0 Ensuring ident completion works always
A bug turned it off when omni completion was available.

Fixes #583.
2013-10-14 13:29:28 -07:00
Strahinja Val Markovic
c3fcaf2b29 Strict 0.5s time budget for completion requests
Vim still loves to block the main GUI thread on occasion when asking for
completions... to counteract this stupidity, we enforce a hard budget of 0.5s
for all completion requests. If the server doesn't respond by then (it should,
unless something really bad happened), we give up.
2013-10-14 11:08:15 -07:00
Strahinja Val Markovic
a04ae37ead Client & server threads increased from 4 to 10 2013-10-11 20:12:04 -07:00
Strahinja Val Markovic
7afd76b4d4 Better url joining in base_request 2013-10-08 20:49:00 -07:00
Strahinja Val Markovic
3d55748400 Correctly handling ycm_extra_conf files now
The user is asked about loading unknown extra conf files, as they were before.
2013-10-08 16:21:43 -07:00
Strahinja Val Markovic
4b73739b09 Removing some obsolete todos 2013-10-07 14:21:46 -07:00
Strahinja Val Markovic
a9d7105e1b YCM now working on new buffers with ft set
We used to demand a name be set for the buffer.

Fixes #568.
2013-10-07 11:03:30 -07:00
Strahinja Val Markovic
7248979bb4 We now handle the starting FileReadyToParse event
The problem was that when you start vim like "vim foo.cc", the FileReadyToParse
event is sent to the server before it's actually started up. Basically, a race
condition.

We _really_ don't want to miss that event. For C++ files, it tells the server to
start compiling the file.

So now PostDataToHandlerAsync in BaseRequest will retry the request 3 times
(with exponential backoff) before failing, thus giving the server time to boot.
2013-10-07 11:03:29 -07:00
Strahinja Val Markovic
9d0a6c96d7 Event and completion request are now async
This results in a much snappier Vim.
2013-10-07 11:03:28 -07:00
Strahinja Val Markovic
fe0c0a1607 GoTo commands work again 2013-10-07 11:03:27 -07:00
Strahinja Val Markovic
10469d318d Passing user options to server now 2013-10-07 11:03:27 -07:00
Strahinja Val Markovic
17716ff51f Whitespace fix 2013-10-07 11:03:26 -07:00
Strahinja Val Markovic
1730660555 A (barely) working version of ycmd + client
Still a lot of work to do.
2013-10-07 11:03:26 -07:00