Commit Graph

1895 Commits

Author SHA1 Message Date
micbou
993f0ef7b6
Move client tests to the main tests folder 2016-10-20 00:24:38 +02:00
Homu
ddf18cc6ec Auto merge of #2389 - micbou:coverage-test-utils, r=Valloric
[READY] Move test_utils.py file to tests folder

We don't want `test_utils.py` to appear in the coverage reports. Instead of blacklisting it in `.coveragerc`, we move it to the tests folder.

This will decrease coverage.

<!-- 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/2389)
<!-- Reviewable:end -->
2016-10-15 21:19:46 +09:00
micbou
fa10f33c2a
Move test_utils to tests folder
This remove the file from coverage.
2016-10-15 04:03:48 +02:00
Homu
5cf5f04dd7 Auto merge of #2386 - micbou:refactor-tests, r=Valloric
[READY] Refactor tests using a YouCompleteMe instance

This PR adds a decorator function, similar to the `IsolatedYcmd` and `SharedYcmd` decorators from ycmd, that passes a YouCompleteMe object to tests. Its options can be customized with the parameter of the decorator. I need this to write new tests.

There is one thing annoying with this change is that Vim does not highlight a decorator function with no character between the parentheses so `@YouCompleteMeInstance()` will not be highlighted. I've contacted the maintainer of the Python syntax file about this bug. Anyway, that's not a good reason to not make this change.

<!-- 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/2386)
<!-- Reviewable:end -->
2016-10-15 10:30:12 +09: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
Homu
0a13855419 Auto merge of #2382 - micbou:postcomplete-test, r=puremourning
[READY] Rename postcomplete tests file to be consistent with other tests name

I couldn't resist.

<!-- 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/2382)
<!-- Reviewable:end -->
2016-10-13 02:02:56 +09: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
Homu
768aea435b Auto merge of #2367 - micbou:on-buffer-unload, r=Valloric
[READY] Use deleted buffer instead of current buffer when sending BufferUnload event notification

When deleting a buffer, we use the current buffer to send the `BufferUnload` event notification request to ycmd instead of the buffer being deleted. This is an issue when the current buffer is not of the same filetype as the deleted one. In this case, three different scenarios may occur:
 - the current buffer filetype is not allowed: no request is sent to the ycmd server. The `OnBufferUnload` method from the completer corresponding to the filetype of the deleted buffer is not called. If the filetype is a C-family language, the translation unit is not destroyed. If it is TypeScript, we don't tell TSServer to close the file (not really an issue unless the file is modified elsewhere);
 - the current buffer filetype has no semantic support in ycmd: the request is sent to the ycmd server but no semantic completer is used. Same result;
 - the current buffer filetype has semantic support in ycmd: the `OnBufferUnload` method from the wrong completer is called in ycmd. LibClang and TSServer are able to cope with that and ignore the file. Same result in definitive.

The solution is obvious: build the request for the deleted buffer in this case. However, this involves more changes than expected because the code was written with the assumption that requests are always for the current buffer.

The `include_buffer_data` parameter from `BuildRequestData` was removed as it is always used with its default value.

This fix may alleviate issue https://github.com/Valloric/YouCompleteMe/issues/2232 in the sense that it now gives a reliable way to limit memory usage by deleting buffers in the case of multiple TUs.

Next step is to update PR https://github.com/Valloric/ycmd/pull/542 by removing the `unloaded_buffer` parameter from ycmd API then remove it from the `BufferUnload` request in YCM.

<!-- 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/2367)
<!-- Reviewable:end -->
2016-10-11 07:15:16 +09: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
Homu
b6d5af3424 Auto merge of #2370 - jlebar:JoinLinesAsUnicode, r=micbou
Use JoinLinesAsUnicode in GetUnsavedAndCurrentBufferData().

# 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.

Rationale: Tests are in https://github.com/Valloric/ycmd/pull/617.  This does not change any behavior in YCM itself, only makes things go faster.

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

GetUnsavedAndCurrentBufferData() is invoked on every kepress.  On a large file (15+k loc), using this new function takes kepress latency down to <10ms from ~100ms.

The function used here is added to ycmd in https://github.com/Valloric/ycmd/pull/617.  I will update this PR to include a ycmd submodule update if and when that PR is merged.

<!-- 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/2370)
<!-- Reviewable:end -->
2016-10-08 17:51:18 +09: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
Homu
c1cd62dc3c Auto merge of #2362 - micbou:documentation-ubuntu, r=vheon
[READY] Bump Ubuntu version to 14.10 in documentation

Ubuntu 14.10 has Vim 7.4.273.

Closes #2361.

<!-- 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/2362)
<!-- Reviewable:end -->
2016-10-04 01:54:38 +09:00
micbou
a68f59410f
Bump Ubuntu version to 14.10 in documentation
Ubuntu 14.10 has Vim 7.4.273.
2016-10-03 13:00:54 +02:00
Homu
09054f036a Auto merge of #2359 - puremourning:update-ycmd, r=micbou
[READY] Update ycmd. Update docs for GetTypeImprecise and GetDocImprecise

# 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

Updates ycmd submodule to latest (see below), and updates the subcommand documentation to cover `GetDocImprecise` and the new `GetTypeImprecise`.

Other user-visible changes being included (Release notes):
- PR 590: Enable KeepGoing option when creating translation units in Clang completer
- PR 595: Fix default include paths for macOS Sierra
- PR 596: Fix javascript subcommand errors for relative paths.
- Fix for #607
- PR 609: Support GetTypeQuick completer subcommand in clang completer
- PR 615: Rename GetDocQuick subcommand to GetDocImprecise

Text in the subcommand documentation is deliberately almost identical to `GoToImprecise`

[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/2359)
<!-- Reviewable:end -->
2016-10-03 06:04:46 +09:00
Ben Jackson
1e8be57708 Use g++ 4.8 on YouCompleteMe builds too as the new boost requires this 2016-10-02 21:36:35 +01:00
Ben Jackson
94a81144af Update ycmd. Update docs for GetTypeImprecise and GetDocImprecise 2016-10-02 18:36:11 +01:00
Homu
cd6a16f0ae Auto merge of #1901 - oblitum:use-TextChangedI-when-available, r=micbou
[READY] Bumps required Vim to 7.4.143 and adopts TextChangedI.

Long and personal experience, when TextChangedI gets used, YCM seems
to perform better, diagnostics will trigger much less frequently at
inappropriate occasions, even less with whitespace agnostic triggers,
if I recall correctly...

There's a previous discussion at #1337. At the time this change was bundled in
a single pull request with other changes.

It has gone through the test of the time, sole issue I've stumbled upon was reported
by @puremourning at https://github.com/oblitum/YouCompleteMe/issues/10. This
is what me and other users of my fork use daily.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1901)
<!-- Reviewable:end -->
2016-10-01 21:46:05 +09:00
Homu
f928f7dd97 Auto merge of #2346 - micbou:documentation-server-subcommand, r=Valloric
[READY] Update miscellaneous commands in documentation

With PR https://github.com/Valloric/ycmd/pull/506, we removed the `StartServer` subcommand in favor of the `RestartServer` one and we hid the `StopServer` subcommand from the user. Update the documentation to reflect this.

<!-- 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/2346)
<!-- Reviewable:end -->
2016-09-21 06:02:13 +09:00
Homu
d2cda80398 Auto merge of #2344 - micbou:documentation-semantic-completion-other-languages, r=Valloric
[READY] Mention all natively supported languages in documentation

We mention all supported languages except C-family languages and JavaScript in the `Semantic Completion for Other Languages` section of the documentation. Add them.

<!-- 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/2344)
<!-- Reviewable:end -->
2016-09-21 06:00:54 +09:00
Francisco Lopes
54474c448c Remove obsolete FAQ entry 2016-09-19 18:36:41 -03:00
micbou
35f594ff1c
Update miscellaneous commands in documentation
Remove StartServer and StopServer subcommands from documentation.
Update the list of languages supporting the RestartServer subcommand.
2016-09-19 15:33:32 +02:00
micbou
1a93583a4a
Mention all natively supported languages 2016-09-18 15:11:12 +02:00
Francisco Lopes
362e4df713 Better wording 2016-09-17 19:30:54 -03:00
Francisco Lopes
a3ee4a5bfc Remove unused variable 2016-09-17 17:05:50 -03:00
Francisco Lopes
5576c9cf09 Bump Vim version a bit more to 7.4.143.
Reason:

  A fix has been applied to bring back triggering of TextChangedI events.

- e21b6b2a8d
2016-09-16 17:41:40 -03:00
Francisco Lopes
85bdbdb206 Bump minimun Vim version to 7.4. 2016-09-16 17:41:40 -03:00
Francisco Lopes
1b72bc2fbf Use native TextChangedI instead of an emulation.
Long and personal experience, when TextChangedI gets used, YCM seems
to perform better, diagnostics will trigger much less frequently at
inappropriate occasions, even less with whitespace agnostic triggers,
if I recall correctly...
2016-09-16 17:41:39 -03:00
Homu
6bafb6c272 Auto merge of #2329 - micbou:keyboard-interrupt, r=vheon
[READY] Handle keyboard interruption when evaluating Vim expression with user input

When evaluating a Vim expression in Python that involves code expecting user input (e.g. `input()`, `inputlist()`, `complete_check()`, etc.), if this evaluation is interrupted by the user (with `CTRL-C` for instance), Vim will pass the interruption to the Python interpreter which in turn will raise a `KeyboardInterrupt` exception. We don't want these exceptions to be displayed to the user (because the way Vim handles Python exceptions is really annoying) so we catch them where appropriate.

Fixes #2289.

<!-- 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/2329)
<!-- Reviewable:end -->
2016-09-15 00:02:26 +09:00
micbou
981a07ded7
Handle keyboard interruption from Vim 2016-09-13 00:53:31 +02:00
Homu
30871bcebb Auto merge of #2321 - micbou:improve-ultisnips-support, r=micbou
[READY] Do not depend on UltiSnips internals to fetch snippets

Use the `UltiSnips#SnippetsInCurrentScope` public function instead of the `UltiSnips_Manager` internal object to fetch snippets. Fixes #2320.

Give a workaround in the FAQ for snippets not suggested as candidates if added with the `:UltiSnipsAddFiletypes` command.

<!-- 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/2321)
<!-- Reviewable:end -->
2016-09-12 00:52:17 +09: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
Homu
e8047050cd Auto merge of #2324 - micbou:documentation-faq-entry-issue, r=puremourning
[READY] Fix FAQ entry in README

Wrong section level for this FAQ entry.

<!-- 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/2324)
<!-- Reviewable:end -->
2016-09-12 00:00:16 +09:00
micbou
333958c5c4
Fix FAQ entry in README 2016-09-11 11:14:14 +02:00
Homu
058c654ca3 Auto merge of #2319 - xai:update-docs, r=micbou
Update instructions for FreeBSD

Newer version of clang and llvm is required now.

<!-- 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/2319)
<!-- Reviewable:end -->
2016-09-11 03:33:56 +09:00
Homu
e03b49e3be Auto merge of #2312 - micbou:on-buffer-visit-changed, r=puremourning
[READY] Do not send BufferVisit and FileReadyToParse notification events when current allowed buffer has not changed

See discussion in PR #2265 and the commit message.

Since only the `BufEnter` autocommand event is concerned, we are splitting `s:OnBufferVisit` in two functions:
 - `s:OnBufferRead`, identical to current `s:OnBufferVisit`, for the `BufRead` and `FileType` autocommand events;
 - `s:OnBufferEnter` for the `BufEnter` event.

We only send the `BufferVisit` and `FileReadyToParse` event notifications to `ycmd` in `s:OnBufferEnter` when the entered buffer, in which we are allowed to complete, is different from the last one.

Closes #2265.

<!-- 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/2312)
<!-- Reviewable:end -->
2016-09-10 22:37:45 +09:00
Homu
12153361d7 Auto merge of #2318 - micbou:update-ycmd, r=vheon
[READY] Update to latest ycmd

See https://github.com/Valloric/ycmd/pull/592#issuecomment-245324170.

<!-- 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/2318)
<!-- Reviewable:end -->
2016-09-09 05:12:30 +09:00
Olaf Lessenich
b53ada758f Update instructions for FreeBSD
Newer version of clang and llvm is required now.
2016-09-08 11:58:52 +02:00
micbou
d3af3302ea
Update to latest ycmd 2016-09-07 17:59:41 +02:00
micbou
aca0f21a3d
Trigger BufferVisit event only when buffer has changed
When selecting candidates during completion, Vim jumps to the preview
window (if enabled) and jumps back to the actual buffer, triggering
twice the BufEnter autocommand event. This results in YCM sending
two BufferVisit and one FileReadyToParse event notifications to
ycmd, which is completely unnecessary since the current buffer
did not change. We improve this by only sending these events when the
entered buffer allowed to be completed has changed.
2016-09-07 11:21:41 +02:00
Homu
ada4ca94cf Auto merge of #2302 - micbou:completions-avoid-hit-enter, r=Valloric
[READY] Avoid hit-enter prompts during completions

Being interrupted by the `Press ENTER or type command to continue` prompt while writing code is annoying. This happens when an error occurs during completion and the error message displayed on the status line is longer than the window width. We prevent that by truncating the message.

Note that the message logged to the command-line history will also be truncated.

4 functions to display messages on the status line (`PostVimMessage`, `PostMultiLineNotice`, `EchoText`, and `EchoTextVimWidth`) is a little too much. Merge them into one.

<!-- 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/2302)
<!-- Reviewable:end -->
2016-09-06 07:15:35 +09:00
Homu
e332cdb2a0 Auto merge of #2307 - micbou:update-ycmd, r=puremourning
[READY] Update to latest ycmd

Include PR https://github.com/Valloric/ycmd/pull/579 which fixes #2293 and probably #2306.

<!-- 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/2307)
<!-- Reviewable:end -->
2016-09-01 07:05:17 +09:00
micbou
c6eaa55ee6 Update to latest ycmd 2016-08-31 20:02:18 +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
Homu
d38ffc5446 Auto merge of #2284 - micbou:full-instructions-omnisharp-completer, r=puremourning
[READY] Update C# instructions in full installation guide

Add the `/property:Configuration=Release` option when building the OmniSharp server in the full installation guide.

Fixes #2188.

<!-- 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/2284)
<!-- Reviewable:end -->
2016-08-20 21:00:31 +09:00
Homu
358363972a Auto merge of #2292 - micbou:diagnostic-highlight-end-of-line, r=Valloric
[READY] Fix diagnostic highlighting at line ending

When highlighting a range of characters for a diagnostic, we make sure that the start and end positions do not go paste the line contents or the range will not be highlighted at all (don't ask, this is a Vim feature). However, we don't account for the end position not being included in the diagnostic range. So, when this position ends at line ending or after it, we move it just before the `EOL` character. Since the end position is not part of the range, this character will not be highlighted, which is not what we want. We fix this behavior by decrementing the end column before clamping it and incrementing it after.

Fixes https://github.com/Valloric/YouCompleteMe/issues/846.

<!-- 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/2292)
<!-- Reviewable:end -->
2016-08-20 18:43:22 +09: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
Homu
b94fcb2c9e Auto merge of #2290 - micbou:update-ycmd, r=vheon
[READY] Update to latest ycmd

PR #2279 needs to be merged before this one.

<!-- 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/2290)
<!-- Reviewable:end -->
2016-08-19 02:25:11 +09:00