Disable sitecustomize when checking python version
# 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:
- This seems quite difficult to test in a cross-platform, cross-version fashion, but
- I might have missed something, I am not a python expert. :)
- [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.]
Sitecustomize files can be slow or broken and might hang editor
startup. Since they aren't necessary for checking the python version,
disable them to get a small speed boost for everyone, and an editor
that doesn't hang indefinitely on startup if the sitecustomize gets
into an infinite loop (due to a bad NFS mount or similar).
[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/2502)
<!-- Reviewable:end -->
Sitecustomize files can be slow or broken and might hang editor
startup. Since they aren't necessary for checking the python version,
disable them to get a small speed boost for everyone, and an editor
that doesn't hang indefinitely on startup if the sitecustomize gets
into an infinite loop (due to a bad NFS mount or similar).
[READY] Update readme for compilation database support
# 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.
> only changes docs
- [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 change:
- updates the c-family completer documentation to describe the built in support for compilation databases added in https://github.com/Valloric/ycmd/pull/680
- explains more about why ycmd needs compiler flags, and how to go about providing them
- recommends using a compilation database (as that seems to be the fashion)
- standardises formatting for `NOTE` (it was inconsistent before)
- states that the preferred installation method is `install.py` (rather than the full installation instructions)
- update the vim doc
- update the ycmd submodule
### ycmd update release note
- valloric/ycmd#678 - Bump Boost version to 1.63.0
- valloric/ycmd#686 - Update JediHTTP for Python 3.6 support
- valloric/ycmd#684 - Fix JavaScript identifier regex
- valloric/ycmd#680 - Automatically load a compilation database if found
[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/2495)
<!-- Reviewable:end -->
[READY] Improve issue template - guide the user in completing it
# 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.
> project administration-only change
- [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
The issue template has worked very well and a larger number of reported issues include useful diagnostics. However, this is still far from ubiquitous.
I've noticed two recurring problems, that I've tried to solve with an update to the template:
- when reporting a build failure, not including the _entire_ `install.py` log or the command used to run it
- when reporting issues, stating that something doesn't work, but not stating what the expected behaviour was (this is a common human mistake).
Meanwhile, I've encouraged the reporter to fill in the sections by actually providing such sections in the template for them to fill in.
This is unlikely to get us to 100%, but hopefully another incremental increase in the quality of reports will come out of it.
[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/2496)
<!-- Reviewable:end -->
[READY] Handle server exceptions from loading/ignoring extra conf
Since PR #2453, we don't catch anymore exceptions raised from loading or ignoring a `.ycm_extra_conf.py` file. For instance, loading this extra conf:
```python
raise Exception
```
will result in a Python traceback inside Vim. This is fixed by catching the `UnknownExtraConf` exception in its own block (as [it was before](48b7ccef76/python/ycm/client/event_notification.py (L64-L73))).
<!-- 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/2488)
<!-- Reviewable:end -->
[READY] Fix large file message appearing twice
In PR #2469, we moved the large file logic inside `s:OnBufferRead` but forgot this function was not only called on the `BufRead` event but also on the `FileType` one. This makes the large file message appears twice when opening such file. We fix that by not displaying the message when the `b:ycm_largefile` variable is already set.
Also, the message is now displayed with `PostVimMessage` to avoid the `Press ENTER or type command to continue` prompt.
Fixes#2485.
<!-- 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/2487)
<!-- Reviewable:end -->
Vim automatically adds a space between strings when concatenating them
without the dot operator. This is not obvious so we always use the dot
operator.
Minor coding style changes when writing statements on multiple lines to
be more consistent.
[READY] Update ycmd
# 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.
> ycmd tests itself
- [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
A number of enhancements have been made in the server. They seem stable in my testing. Let's push them live now.
Includes all of the following PRs:
* Auto merge of valloric/ycmd#631 - vheon:refactor-request-wrap, r=micbou: [READY] Add 'first_filetype' to RequestWrap
* Auto merge of valloric/ycmd#634 - vheon:fix-previous-identifier, r=micbou: [READY] Avoid to wrap around when searching for previous identifier
* Auto merge of valloric/ycmd#635 - micbou:resource-warning, r=Valloric: [READY] Fix warnings when resetting process handle
* Auto merge of valloric/ycmd#637 - vheon:refactor-tags-file, r=micbou: [READY] Extract filtering of tags as a generator
* Auto merge of valloric/ycmd#639 - mixedCase:tern_0.20, r=micbou: Bump Tern to version 0.20
* Auto merge of valloric/ycmd#640 - vheon:test-identifier-completer, r=micbou: [READY] Additional test for the identifier completer
* Auto merge of valloric/ycmd#636 - puremourning:coverage-c++, r=micbou: [READY] Coverage for c++ code
* Auto merge of valloric/ycmd#641 - micbou:remove-tests-folder, r=vheon: [READY] Remove unused tests folderS
* Auto merge of valloric/ycmd#643 - micbou:javascript-identifiers, r=Valloric: [READY] Add regex for JavaScript and TypeScript identifiers
* Auto merge of valloric/ycmd#644 - micbou:flake8, r=Valloric: [READY] Fix flake8 errors
* Auto merge of valloric/ycmd#645 - micbou:global-config-exception, r=Valloric: [READY] Catch exceptions from global extra conf
* Auto merge of valloric/ycmd#649 - micbou:codecov, r=puremourning: [READY] Use codecov bash uploader on Travis
* Auto merge of valloric/ycmd#652 - micbou:remove-executable-mode, r=Valloric: [READY] Remove executable mode
* Auto merge of valloric/ycmd#650 - vheon:remove-unused-assert, r=micbou: Remove unused CustomAssert
* Auto merge of valloric/ycmd#651 - micbou:global-extra-conf-reuse, r=Valloric: [READY] Do not reload extra conf file
* Auto merge of valloric/ycmd#657 - micbou:gocode-submodule, r=Valloric: [READY] Update Gocode submodule (Fixes#2449)
* Auto merge of valloric/ycmd#665 - micbou:flake8, r=micbou: [READY] Do not disable Flake8 on Python 2.6 Travis but restrict its version
* Auto merge of valloric/ycmd#667 - haifengkao:SupportObjcImportModule, r=Valloric: Support objc import module
* Auto merge of valloric/ycmd#677 - puremourning:dev-flags, r=micbou: [READY] Enable dev flags when --enable-debug is supplied
[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/2486)
<!-- Reviewable:end -->
[READY] Fix exception when response future is not set
An `AttributeError` exception is raised when `Done` is called before `Start` in the `CompletionRequest` and `EventNotification` classes because the `_response_future` attribute is not yet defined.
Fixes#2461.
<!-- 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/2465)
<!-- Reviewable:end -->
[READY] Catch and log all server exceptions
A lot of different errors may occur when sending a request to ycmd and receiving its response:
- [any exception from the requests module](http://docs.python-requests.org/en/master/_modules/requests/exceptions/);
- exceptions from ycmd: `ServerError` and `UnknownExtraConf`;
- `RuntimeError` exception from invalid HMAC;
- and possibly others.
Thanks to PR #2430, we can now catch and log these exceptions.
I am marking this PR as WIP because I'd like to add tests but I am not sure on how to implement them. Should we use actual code for these tests or mock the response from the ycmd server?
Fixes#2216.
Fixes#2272.
<!-- 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/2453)
<!-- Reviewable:end -->
This is another attempt at:
https://github.com/Valloric/YouCompleteMe/pull/2473
Which removed the apparently flawed attempt at "lazy" loading of YCM.
While it fails to get the load out of the critical startup path, it
*does* serve the useful purpose when starting up gvim of avoiding a
deadlock situation in gvim.
So, this time, we keep VimEnter, but only for the gui-starting case. We
update the comment to explain what is actually happening. And we can
keep the docs about how to defer loading.
[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 -->