Commit Graph

773 Commits

Author SHA1 Message Date
Andrey Pikas
2495dffa59 Fix tests under Windows. 2017-03-12 23:06:05 +03:00
Andrey Pikas
822010fe4c Move import to the top of file. 2017-03-12 20:18:24 +03:00
Andrey Pikas
592b85516b Tests for checking that extra_conf_data sended to server from :DebugInfo and :YcmCompleter commands. 2017-03-12 19:03:07 +03: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
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
414782bc74
Add tests for diagnostic commands 2017-02-20 18:28:49 +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
Andrea Cedraro
fda5c7e6c6 Use bang version of normal
Fixes #2519
2017-01-31 22:09:40 +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
8426191655
Update test 2017-01-24 22:43:41 +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
Kyle Lippincott
b5b2fb57e1 Disable sitecustomize when checking python version
Sitecustomize files can be slow or broken and might hang editor
startup.  Since they aren't necessary for checking the python version,
disable them to get a small speed boost for everyone, and an editor
that doesn't hang indefinitely on startup if the sitecustomize gets
into an infinite loop (due to a bad NFS mount or similar).
2017-01-11 12:18:39 -08:00
micbou
deddca8927
Handle exceptions from loading/ignoring extra conf 2017-01-03 15:29:12 +01:00
Homu
8161d35030 Auto merge of #2465 - micbou:response-future, r=Valloric
[READY] Fix exception when response future is not set

An `AttributeError` exception is raised when `Done` is called before `Start` in the `CompletionRequest` and `EventNotification` classes because the `_response_future` attribute is not yet defined.

Fixes #2461.

<!-- 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/2465)
<!-- Reviewable:end -->
2016-12-23 09:41:21 +09:00
Homu
e1e7e648d4 Auto merge of #2453 - micbou:handle-server-exception, r=puremourning
[READY] Catch and log all server exceptions

A lot of different errors may occur when sending a request to ycmd and receiving its response:
 - [any exception from the requests module](http://docs.python-requests.org/en/master/_modules/requests/exceptions/);
 - exceptions from ycmd: `ServerError` and `UnknownExtraConf`;
 - `RuntimeError` exception from invalid HMAC;
 - and possibly others.

Thanks to PR #2430, we can now catch and log these exceptions.

I am marking this PR as WIP because I'd like to add tests but I am not sure on how to implement them. Should we use actual code for these tests or mock the response from the ycmd server?

Fixes #2216.
Fixes #2272.

<!-- 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/2453)
<!-- Reviewable:end -->
2016-12-23 09:20:22 +09:00
micbou
3033203ca5
Add Flake8 requirement for Python 2.6 and 3.3 2016-12-18 16:31:29 +01:00
micbou
85d5844873
Add docstring to HandleServerException
Wrap request with HandleServerException in YcmdKeepalive class.
2016-12-12 02:53:57 +01:00
micbou
01aa54ee2d
Add tests 2016-12-12 02:36:15 +01:00
micbou
fd41d52dfe
Catch and log all server exceptions 2016-12-12 02:36:15 +01:00
micbou
bd890428a4
Fix exception when response future is not set 2016-12-11 20:51:45 +01:00
micbou
b93c1fd47c
Add client logfile 2016-11-19 18:47:43 +01:00
Homu
fbe53de5a2 Auto merge of #2441 - micbou:flake8, r=Valloric
[READY] Fix flake8 error

This fixes a new error detected by the last version of `pycodestyle` (2.2.0), which is a dependency of `flake8`:
```
C:\projects\youcompleteme\python\ycm\youcompleteme.py:69:1: E305 expected 2 blank lines after class or function definition, found 1
```

<!-- 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/2441)
<!-- Reviewable:end -->
2016-11-16 04:10:30 +09:00
micbou
c33a844e5f
Fix flake8 error 2016-11-15 11:15:16 +01:00
Nader Akoury
f4f12f3c9b Fix another test failure
* Because I cannot seem to run the tests locally I am relying on the CI
tests which kind of sucks...
2016-11-11 11:28:20 -08:00
Nader Akoury
659746eaaf Doh, forgot to revert my previous changes. Fixed! 2016-11-11 10:53:26 -08:00
Nader Akoury
9c93244d3b Addressed review comments and fixed tests 2016-11-11 10:15:22 -08:00
Nader Akoury
74951adcc7 Address #1366 by reusing a single preview buffer
* Additionally set the preview buffer to be unlisted so it does not
interfere with commands like :bnext
2016-11-11 07:53:01 -08:00
dhleong
8eabf580ad Rename argument 2016-11-03 13:47:26 -04:00
dhleong
0babb4b102 Cleanup 2016-11-03 11:21:15 -04:00
dhleong
0523ad02c0 Fix InsertNamespace indent matching
Aso updates the appropriate tests and adds docs to some
relevant methods whose behavior might be confusing
2016-11-02 08:08:30 -04:00
dhleong
26141253a5 Add some tests for InsertNamespace 2016-11-01 08:28:28 -04:00
dhleong
62a815275f Fix InsertNamespace
ReplaceChunk must have changed to require the buffer at some point
2016-10-31 17:00:45 -04:00
Homu
6e52536f70 Auto merge of #2407 - micbou:remove-unloaded-buffer-parameter, r=vheon
[READY] Remove unloaded_buffer parameter

See PR https://github.com/Valloric/ycmd/pull/542.

<!-- 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/2407)
<!-- Reviewable:end -->
2016-10-28 01:44:10 +09:00
micbou
f6ffe1f1a6
Remove unloaded_buffer parameter 2016-10-27 01:48:33 +02:00
Homu
d55b5c09d6 Auto merge of #2394 - micbou:move-client-tests, r=Valloric
[READY] Move client tests to the main tests folder

This makes it possible to configure all tests at a package level by implementing the `setUpPackage` and `tearDownPackage` functions in `python/ycm/tests/__init__.py` file.

<!-- 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/2394)
<!-- Reviewable:end -->
2016-10-26 07:46:33 +09:00
micbou
62ff65006f
Remove unused code in shutdown request 2016-10-25 17:59:17 +02:00
micbou
c991f04905
Create temporary files in a secure manner
Fixes #2395.
2016-10-24 22:45:15 +02:00
Homu
f27787f263 Auto merge of #2377 - dhleong:dhleong/#2021-quiet_messages, r=micbou
Implement ycm_quiet_messages options (See #2021)

# PR Prelude

- [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

See issue #2021. This is a partial implementation based on the syntastic option referenced, supporting the `!` flag and filters of type `regex` and `level`. Also supports filetype specific filters using `ycm_<ft>_quiet_messages`, but I couldn't think of a great way to fall back to syntastic configs for this one.

In terms of usefulness: I've been playing with C# recently, which has a bunch of style warnings that I don't want to follow, and prefer to only have the gutter showing if there are actually errors, or warnings that I *do* want to follow.

<!-- 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/2377)
<!-- Reviewable:end -->
2016-10-24 10:46:06 +09:00
dhleong
13fda74cc1 Refactor _FilterDiagnostics to rely on _ApplyDiagnosticFilter
Also builds the predicates using compilers from diagnostic_filter
2016-10-23 10:29:54 -04:00
dhleong
e2852a8b2b Update to use appropriate test_utils package after rebase 2016-10-22 23:33:43 -04:00
dhleong
7978215bca Refactor filter to not be initialized every time
We eagerly compile all the filters up front, then gather the
compiled filters into a DiagnosticFilter lazily, caching the
result to avoid garbage lists.
2016-10-22 23:31:46 -04:00
dhleong
b8280c7b19 Rename diagnostic_filter_tests -> diagnostic_filter_test 2016-10-22 23:31:46 -04:00
dhleong
18a25d45b3 Style refactor and cleanup 2016-10-22 23:31:46 -04:00
dhleong
bb793826b6 Refactor filter spec to filter_diagnostics; update tests, README 2016-10-22 23:31:46 -04:00
dhleong
3869830a65 Rename method for clarity and tweak style 2016-10-22 23:31:46 -04:00