[READY] Do not use BufReadPre autocommand
This autocommand has a bug that makes the cursor goes to the first line of the current buffer when opening the preview window with `:pedit`. Since the `BufRead` autocommand is always called after, we can drop it by moving the `s:OnBufferReadPre` logic into the `s:OnBufferRead` function.
Fixes#2466.
<!-- 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/2469)
<!-- Reviewable:end -->
As discussed in https://github.com/Valloric/YouCompleteMe/pull/2454,
this code doesn't do what it claims to do on the surface, so we should
delete it.
I'll follow up with a commit to explain in the README how to actually
defer loading of the plug-in.
[READY] Remove outdated Syntastic option
The `ycm_register_as_syntastic_checker` option was introduced a long time ago in commit 16b6f877c6 and became obsolete when [Syntastic support was replaced](6c01881e1a). Since then, it doesn't serve any purpose except being an alias to the `ycm_show_diagnostics_ui` option which can be an issue (see #2455) so we remove it.
Fixes#2455.
<!-- 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/2456)
<!-- Reviewable:end -->
[READY] Add client logfile
We have a lot of issue reports with Python exceptions that interrupt user workflow or even worse make the editor unusable and force users to restart it (e.g. issue https://github.com/Valloric/YouCompleteMe/issues/2192). We really want to avoid that but at the same time we can't just silence these exceptions because they are useful to debug the issue. Logging them to Vim `:messages` is not practical because we can't write to it without displaying messages in the status line which, in addition to distract users, may lead to various issues like the infamous `Press ENTER or type command to continue` message. This is why a logfile is needed.
For now, only server crashes are logged but more logging will be added: connection issues with the server (`ConnectTimeout`, `ReadTimeout`, etc. exceptions), UltiSnips unavailability, requests sent to the server, etc.
The behavior of the `:YcmToggleLogs` command is changed to accept multiple arguments where each argument is a logfile name. Each of these files is opened in a separate window or closed if already open. When no argument is given, the list of available logfiles is displayed to the user. Example:
```
Available logfiles are:
ycm_pz83u7.log
ycmd_23830_stderr_gf6j3i.log
ycmd_23830_stdout_gmpa_k.log
```
With this change and PR #2342, we will add the completers logfiles to the list of files that can be opened with the `:YcmToggleLogs` command.
A bunch of tests are added that cover almost all changes introduced by this PR.
<!-- 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/2430)
<!-- Reviewable:end -->
[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 -->
Don't set omnifunc when not allowed
# 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.]
See pull request: [#2072](https://github.com/Valloric/YouCompleteMe/pull/2072)
Unfortunately I was not able to reproduce the original author's results. I tried using a clean .vim and .vimrc. The only plugins I used were YCM and ctrlfs.vim, just as the original author mentioned. The .vimrc looks like this:
```VimL
syntax on
set history=500
set nocp
filetype plugin indent on
set encoding=GBK
```
Whatever I tried to do with configuration, I couldn't get a start without an error, but it is already known that YCM doesn't work properly with any file not using UTF encoding.
The error I was getting on vim start up:
```
Error detected while processing function youcompleteme#Enable[67]..<SNR>36_OnBufferRead[6]..<SNR>36_AllowedToCompleteInCurrentBuffer[1]..<SNR>36_AllowedToCompleteInBuffer:
line 15:
E715: Dictionary required
Press ENTER or type command to continue
Error detected while processing function <SNR>36_OnCursorMovedNormalMode[1]..<SNR>36_AllowedToCompleteInCurrentBuffer[1]..<SNR>36_AllowedToCompleteInBuffer:
line 15:
E715: Dictionary required
Press ENTER or type command to continue
```
Error I was having after almost every key press:
```
Error detected while processing function <SNR>36_OnCursorMovedNormalMode[1]..<SNR>36_AllowedToCompleteInCurrentBuffer[1]..<SNR>36_AllowedToCompleteInBuffer:
line 15:
E715: Dictionary required
Press ENTER or type command to continue
```
[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/2434)
<!-- Reviewable:end -->
Fix InsertNamespace
# 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
Auto-inserting namespace imports in C# is broken because the `ReplaceChunk()` call is missing an argument
[cont]: https://github.com/Valloric/YouCompleteMe/blob/master/CONTRIBUTING.md
[code]: https://github.com/Valloric/YouCompleteMe/blob/master/CODE_OF_CONDUCT.md
ReplaceChunk must have changed to require the buffer at some point
No test is included because it's a one-line change; the method is theoretically covered, so I'm not sure why the missing argument error was not caught (not familiar with these tests). Happy to add one if needed (and I can get pointed in the right direction).
<!-- 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/2425)
<!-- Reviewable:end -->
[READY] Add Gitter badge and encourage users to ask questions on Gitter
This may help reduce the number of issues opened for questions or misconfigurations. This is also an alternative to the Google group for users that can't access it because of country regulations.
<!-- 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/2423)
<!-- Reviewable:end -->
[READY] Enable coverage on AppVeyor
I forgot to do that when adding coverage.
Also, the `cover` folder is created at the project root, not in the `python` folder.
<!-- 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/2412)
<!-- Reviewable:end -->
[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 -->
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 -->