Commit Graph

734 Commits

Author SHA1 Message Date
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
dhleong
68cf0220e5 Remove unnecessary print() 2016-10-22 23:31:46 -04:00
dhleong
4c53e5d006 Use future.utils iterkeys; fix some more style issues 2016-10-22 23:31:46 -04:00
dhleong
ca29f6abe8 Verify that an empty list overrides (disables) rules 2016-10-22 23:31:46 -04:00
dhleong
f15f9f2255 Fix style/lint issues 2016-10-22 23:31:46 -04:00
dhleong
d274dcd37a Fix test error 2016-10-22 23:31:46 -04:00
dhleong
73343bd98f Support filtering on level/kind 2016-10-22 23:31:46 -04:00
dhleong
f7fbbd16f7 Implement a preliminary quest_messages with regex support 2016-10-22 23:31:46 -04:00
micbou
993f0ef7b6
Move client tests to the main tests folder 2016-10-20 00:24:38 +02:00
micbou
234658f30b
Use helper function to get current directory
Fix tests.
2016-10-18 15:35:51 +02:00
micbou
3109c9d8a4
Add tests for current directory 2016-10-18 02:22:28 +02:00
micbou
fa10f33c2a
Move test_utils to tests folder
This remove the file from coverage.
2016-10-15 04:03:48 +02:00
micbou
8d015c95cc
Refactor tests using a YouCompleteMe instance 2016-10-14 02:18:51 +02:00
Homu
5465bb0892 Auto merge of #2385 - micbou:coverage, r=vheon
[READY] Add coverage support

There should not have anything to configure on codecov website.

I updated the `run_tests` script to behave exactly like the one in ycmd repository: when passing tests as arguments, you need to specify the path from the root project, not the `python` folder. For instance:
```
./run_tests.py --skip-build -- python/ycm/tests/event_notification_test.py
```
instead of
```
./run_tests.py --skip-build -- ycm/tests/event_notification_test.py
```
This way, you can now complete the path to the test.

<!-- 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/2385)
<!-- Reviewable:end -->
2016-10-14 04:06:41 +09:00
micbou
9d6a17b140
Add coverage support
Use codecov for coverage reports. Add badge to README.
2016-10-12 23:03:37 +02:00
micbou
cbe53c1f3e
Rename postcomplete tests file
Rename postcomplete_tests.py file to be consistent with other tests
name. Update its copyright date.
2016-10-12 05:13:06 +02:00
micbou
92f1bbda94
Add event notification tests
Add tests for the BufferVisit and BufferUnload event notifications.
2016-10-10 16:27:29 +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
Justin Lebar
a33f20d690 Update ycmd, and use JoinLinesAsUnicode in GetUnsavedAndCurrentBufferData().
This function is invoked on every kepress.  On a large file (15+k loc),
using this new function takes kepress latency down to <10ms from ~100ms.
2016-10-07 18:27:09 -07: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
ef49f3e052 Fix diagnostic highlighting at line ending
When columns are clamped to not be past the contents of the line for
highlighting diagnostics, we need to account for the column end not
being included in the diagnostic range.
2016-08-18 21:21:10 +02:00
micbou
d3916a8752 Extract keywords from whole PreProc syntax group
Reorder syntax groups to follow documentation order.
2016-08-09 11:59:35 +02:00
micbou
75d41d1137 Improve extraction of syntax keywords
Use the following strategy to extract identifiers from syntax
highlighting:
 - ignore match and region: they mostly contain arguments,
   syntax groups and regular expressions;
 - ignore "nextgroup=" if first word and subsequent arguments
   "skipempty", "skipwhite", and "skipnl";
 - ignore "contained" argument if first word;
 - add remaining words to the list of identifiers.
Fix a bug where the word "match" was extracted while not being a keyword
of the syntax language.
2016-08-06 13:39:06 +02:00
micbou
f14485acb9 Rewrite syntax tests
Use matchers from hamcrest instead of eq_ assertions in syntax tests
to get more detailed assertion errors when tests are failing.
2016-08-06 01:12:59 +02:00
micbou
7b2155ab64 Refactor tests using a server instance
Create a Server_test class for tests that need a server instance.
2016-07-23 11:21:38 +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
micbou
899746d51c Convert Vim buffers to bytes in ReplaceChunk 2016-07-14 02:39:33 +02:00
micbou
a986b3ed0e Update ReplaceChunk tests
Do not convert strings to bytes but instead use plain strings to mimic
Vim buffers returning a list of byte objects on Python 2 and unicode
objects on Python 3.
2016-07-14 00:46:30 +02:00
Ben Jackson
cfd4bbd531 Support selecting from the list of FixIts when multiple are supplied 2016-07-11 21:52:41 +01:00
micbou
805911b56b Use SetQuickFixList for GoTo* subcommands
Open the quickfix window to full width at the bottom of the screen with
its height set to fit all entries. This behavior can be overridden by
using the YcmQuickFixOpened autocommand.
Add a new section for autocommands in the documentation.
Update GoTo and ReplaceChunks tests.
2016-06-13 00:25:12 +02:00
Homu
e0f2da0885 Auto merge of #2160 - micbou:open-file-encoding, r=Valloric
[READY] Fix LookupError exception when opening a file

Fixes #2159.

I think the issue is caused by `locale.getpreferredencoding()` returning an empty string on some configurations (especially on OS X with Python 2). This is [the value used by default when no encoding is specified](https://docs.python.org/2/library/io.html?highlight=open#io.open). The same error is raised if we do:
```python
open( 'some_file', encoding = '' )
```

For references, similar issues: https://github.com/Valloric/ycmd/issues/395, https://github.com/Valloric/ycmd/issues/419

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2160)
<!-- Reviewable:end -->
2016-05-11 02:01:22 +09:00
micbou
b0786d5c4f Fix LookupError exception when opening a file
Open the file in binary mode in CheckFilename function.
Use ReadFile helper in syntax_parse tests.
2016-05-10 16:30:04 +02:00
Ben Jackson
e73426187d Add tests for omni completer GetCompletions 2016-05-08 15:47:58 +01: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
b923431d7d Avoid evaluating Vim globals in Python
On Python 3, evaluating a Vim expression will raise a unicode exception
if it contains an invalid sequence of bytes for the current encoding.
We can't really do anything about it because this is the way Vim and
Python 3 interact. However, we can prevent this situation to occur by
not evaluating Vim data that we have no control over: in particular,
the Vim globals. This is done by:
 - adding one by one the YCM default options instead of extending the
   Vim globals with them;
 - only evaluating the Vim global variable names (and not their values)
   when building the YCM options for the ycmd server.
2016-05-06 20:14:10 +02: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
Val Markovic
8fe90b43c4 Starting ycmd with Python used to build it
Note: depends on Valloric/ycmd#466 being merged and the ycmd submodule
ref then being updated.

Fixes #2136
2016-04-27 19:42:00 -07:00
micbou
638550384e Update PostComplete tests
Move with-statement patch as decorator when possible.
Use single quote everywhere instead of double quote (for consistency).
Remove empty lines.
2016-04-07 00:42:43 +02:00