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