Commit Graph

2505 Commits

Author SHA1 Message Date
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
micbou
5cbf76456f Update Omnisharp instructions in documentation
The /property:Configuration=Release option is not mentioned when
building the OmniSharp server in the full installation guide.
2016-08-18 18:29:20 +02:00
micbou
4c040f8de9 Update to latest ycmd 2016-08-18 18:28:47 +02:00
Homu
80ae455852 Auto merge of #2279 - micbou:flake8, r=Valloric
[READY] Disable flake8 for Python 2.6 on Travis

See https://github.com/Valloric/ycmd/pull/570.

<!-- 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/2279)
<!-- Reviewable:end -->
2016-08-19 01:04:43 +09:00
micbou
eace44f7d5 Disable flake8 for Python 2.6 on Travis
Since version 3.0.0, flake8 does not support Python 2.6, 3.2 and 3.3
anymore. It is still working for our Python 3.3 runs on Travis but
not for the Python 2.6 one so we only disable it for this version.
2016-08-12 02:25:16 +02:00
Homu
576bef62e6 Auto merge of #2281 - micbou:documentation-windows-python-bug, r=micbou
[READY] Recommend a more recent version for Python bug on Windows

<!-- 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/2281)
<!-- Reviewable:end -->
2016-08-12 06:32:33 +09:00
Homu
2af3ebbb05 Auto merge of #2282 - micbou:syntax-preproc-group, r=Valloric
[READY] Extract keywords from the whole PreProc syntax group

Fixes #2269.

<!-- 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/2282)
<!-- Reviewable:end -->
2016-08-12 05:06:03 +09:00
micbou
77843d7624 Recommend a more recent version for Python bug 2016-08-11 20:08: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
Homu
b50984be76 Auto merge of #2274 - micbou:improve-syntax-extraction, r=Valloric
[READY] Improve extraction of keywords from syntax list

This PR is an attempt at improving the extraction of keywords from Vim syntax files. Current approach is to go through the `syntax list` output and:
  - ignore lines where the first word is a reserved keyword for syntax highlighting except for `contained`;
  - ignore all words used by Vim as arguments in the syntax commands;
  - add remaining words to the list of identifiers.

The main issue with this approach is that syntax arguments that could be valid language keywords are always ignored. There is also a bug where the `match` keyword is extracted while not being a language keyword (see the Python, C++, and Java tests).
With the new approach, we try to ignore Vim keywords only when necessary, that is:
  - ignore `syntax match` (fix the `match` keyword bug) and `syntax region` commands: they mostly contain arguments, syntax groups and regular expressions;
  - ignore  `nextgroup=` if in first position and subsequent arguments `skipempty`, `skipwhite`, and `skipnl`;
  - ignore `contained` argument if in first position;
  - add remaining words to the list of identifiers.

This strategy is based on observations of the `syntax list` output.

<!-- 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/2274)
<!-- Reviewable:end -->
2016-08-09 06:22:22 +09: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
Homu
390d2e1c79 Auto merge of #2273 - micbou:syntax-tests, r=Valloric
[READY] Rewrite syntax tests

While trying to fix a bug when extracting identifiers from Vim syntax files, I found out that errors from syntax tests are not really helpful because `eq_` assertions don't tell which items are missing when comparing lists (or sets). So, we use matchers from hamcrest instead to get useful assertion errors.

Note that with these changes, we don't test anymore if the value returned by `_KeywordsFromSyntaxListOutput` is a set. I don't think it's an issue but if you feel that's important, we can probably check for it too.

<!-- 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/2273)
<!-- Reviewable:end -->
2016-08-06 18:46:31 +09: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
Homu
9968a43f7e Auto merge of #2245 - micbou:shutdown, r=puremourning
[READY] Implement shutdown handler

This PR depends on https://github.com/Valloric/ycmd/pull/282.

We don't want to block Vim exit if the server takes too much time to answer the shutdown request so we use a timeout of 100ms for this request. In my experience, it takes ~5ms.

The `YcmStopServer` command only exists for testing purpose. It will be removed in the final version of this PR.

Fixes #876.

<!-- 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/2245)
<!-- Reviewable:end -->
2016-07-23 22:18:24 +09:00
micbou
4e94d7cad6 Update to latest ycmd 2016-07-23 11:28:47 +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
Homu
c1047bee9a Auto merge of #2242 - micbou:replace-chunk-bytes, r=Valloric
[READY] Fix Python 3 bytes issue in ReplaceChunk function

This PR updates the `ReplaceChunk` tests by using plain strings instead of byte objects to mimic Vim buffers returning byte objects on Python 2 and unicode objects on Python 3.

We are only updating the tests for now to show that these changes make the tests fail on Python 3 with the same error as issue #2240.

Fixes #2240.

<!-- 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/2242)
<!-- Reviewable:end -->
2016-07-17 01:15:41 +09: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
Homu
d5610e577c Auto merge of #2223 - puremourning:fixit-multiple-choice, r=micbou
[READY] Support selecting from the list of FixIts when multiple are supplied

# 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

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

This PR presents the user with a list to choose from supplied FixIt suggestions when there are multiple suggestions on the same line. This not only helps with the child diagnostics mentioned in the ycmd PR, but also for cases where there are simply 2 diagnostics on the current line; the user can now select which of them to apply. Previously the one closest to the cursor was applied (which was always the first one supplied from the server).

I created a new `SelectFromList` method which uses `inputlist()` as the user interface from `confirm()` does not work well with long prompts. This interface is more like the suggestions when `set spell` is enabled, which should be familiar to many Vim users.

I considered updating the "auto namespace import" c sharp stuff to use the new `SelectFromList` method, but we know that the current implementation of that functionality is broken, so cannot be widely used.

[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="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2223)
<!-- Reviewable:end -->
2016-07-12 07:28:49 +09:00
Ben Jackson
61ccd1b088 Update ycmd to include server changes 2016-07-11 21:52:41 +01:00
Ben Jackson
cfd4bbd531 Support selecting from the list of FixIts when multiple are supplied 2016-07-11 21:52:41 +01:00
Homu
c44489af16 Auto merge of #2084 - lifepillar:packages, r=puremourning
Support lazy loading with :packadd.

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

Vim recently has introduced a new feature called 'packages', which
permits, among the rest, to disable automatic loading a plugin at
startup. Plugins that are disabled at startup may be manually loaded
during a session using `:packadd` (see `:h packages`, `:h :packadd`).
Of course, a plugin that is loaded after startup cannot rely on VimEnter
events.

In order to support lazy loading YCM, check whether YCM is sourced
during startup or at a later time. In the former case, define an
autocommand as before; in the latter case, enable YCM immediately.

Why would one want to load YCM lazily? I use YCM only for certain file
types (Python), and I prefer not to have pop up menus appearing
all the time for other file types. In my workflow, I may enable YCM only
if I start Vim for Python coding sessions.

Tests not included because the change is in VimScript code only, and
testing this feature is not trivial.

<!-- 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/2084)
<!-- Reviewable:end -->
2016-07-11 06:29:59 +09:00
Homu
c4a410b2ca Auto merge of #2225 - Valloric:update-ycmd, r=puremourning
Updating to latest ycmd

This comes with a ~70% reduction to memory usage! (See https://github.com/Valloric/ycmd/pull/475)

<!-- 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/2225)
<!-- Reviewable:end -->
2016-07-04 16:41:37 +09:00
Val Markovic
a74deed44e
Updating to latest ycmd
This comes with a ~70% reduction to memory usage!
2016-07-03 21:26:40 -07:00
Homu
0de1c0c9bb Auto merge of #2210 - Valloric:neobundle-rm, r=micbou
[READY] Removing NeoBundle mentions from README

NeoBundle has been abandoned.

Also deleting the super-obsolete Bitdeli badge.

Fixes #2208.

<!-- 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/2210)
<!-- Reviewable:end -->
2016-06-19 18:30:56 +09:00
Val Markovic
9c287cde91
NeoBundle has been abandoned.
Also deleting the super-obsolete Bitdeli badge.
2016-06-18 18:22:06 -07:00
Homu
88abc4fc8c Auto merge of #2207 - micbou:install-script-python-version, r=micbou
[READY] Check Python version in install script

Closes #2206.

<!-- 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/2207)
<!-- Reviewable:end -->
2016-06-17 04:12:54 +09:00
micbou
2b27dd7903 Check Python version in install script
Add future imports for Python backward compatibility.
2016-06-16 10:55:32 +02:00
Homu
7101afc239 Auto merge of #2205 - vheon:document-find-executable, r=micbou
[RFC] Document find first executable for ycm_python_binary_path

# 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 will document the enhancement that https://github.com/Valloric/ycmd/pull/429 brought to YCM. When this will be ready I will update the vim documentation too.

[Please explain **in detail** why the changes in this PR are needed.]

[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="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2205)
<!-- Reviewable:end -->
2016-06-16 06:34:09 +09:00
Andrea Cedraro
ca87429816 Update vimdoc 2016-06-15 23:30:36 +02:00
Andrea Cedraro
773b52e6ea Update ycmd 2016-06-15 23:29:14 +02:00
Andrea Cedraro
240184eb72 Document find first executable for ycm_python_binary_path 2016-06-15 23:29:14 +02:00
Homu
871387bd2a Auto merge of #2190 - micbou:goto-set-quickfix-list, r=Valloric
[READY] Use SetQuickFixList function for GoTo* subcommands

From discussion in PR #2101, we reuse the `SetQuickFixList` function for the `GoTo*` subcommands. This automatically makes the quickfix window height equal to the number of locations.

Unfortunately, there is no Vim option to change the default height (10) of the quickfix window so we can't really use the heuristic `min(number of Locations, default height)` because users would not be able to change the default height (and we don't want to add another option). However, there are still solutions to set a default height. For instance, a user could add the following line in its vimrc:
```viml
autocmd FileType qf exe "20wincmd _"
```
to set the default height to 20. This will override YCM behavior.

I didn't reproduce the `lazyredraw` boilerplate from `youcompleteme#OpenGoToList`. I guess it was used to avoid flickering but I didn't experienced any without it. In addition, it was not properly implemented because the `lazyredraw` state was not preserved if the option was already set.
I also threw away the `cclose` command. It resets the quickfix window to its default position if already opened, which I think is not a desirable behavior.

Closes #2101.

<!-- 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/2190)
<!-- Reviewable:end -->
2016-06-13 07:51:31 +09: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
80079ec3c2 Auto merge of #2204 - micbou:mono-install-readme, r=Valloric
[READY] Add instructions to install Mono in README

Closes #2188.

<!-- 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/2204)
<!-- Reviewable:end -->
2016-06-12 04:29:55 +09:00
micbou
6b6f326ffc Update Vim documentation 2016-06-11 05:19:22 +02:00
micbou
4bbda99cc0 Minor changes to README
Add capital letters to languages when appropriate.
Be more specific with the tools needed in the PATH when using the
--all option.
2016-06-11 05:18:19 +02:00
micbou
93381b1d72 Add instructions to install Mono in README 2016-06-11 05:17:49 +02:00
Homu
454a564510 Auto merge of #2128 - 3e4:patch-2, r=Valloric
Add warning about Python 2.7.11 bug to FAQ

# 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

[Please explain **in detail** why the changes in this PR are needed.]

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

There is a bug in vim with Python 2.7.11 on Windows. Adding information in the FAQ.

This is a modification of this pull request: https://github.com/Valloric/YouCompleteMe/pull/2122.

<!-- 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/2128)
<!-- Reviewable:end -->
2016-06-11 05:49:18 +09:00