[READY] Restore neovim 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.
- [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
Turns out neovim doesn't have `has('python_compiled')`, so we need to check if the user is running neovim before checking `has('python_compiled')`.
<!-- 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/3306)
<!-- Reviewable:end -->
[READY] Improve error message when unable to load Python
The current error when Python cannot be loaded
> YouCompleteMe unavailable: requires Vim compiled Python (2.7.1+ or 3.4+) support.
is misleading if Vim has been dynamically compiled against Python but is unable to find the library. See issue https://github.com/Valloric/YouCompleteMe/issues/3300 for instance. We should only return that error if `has( 'python_compiled' )` and `has( 'python3_compiled' )` are both false. Furthermore, we should check if Python 3 is available before Python 2 because on some platforms, only one Python library can be loaded at a time so if Python 2 is loaded first, Python 3 cannot be used.
<!-- 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/3303)
<!-- Reviewable:end -->
Check explicitely that Vim is compiled with Python support.
Attempt to load Python 3 before Python 2 since only one can be loaded at
a time on some platforms. Return an appropriate error if unable to load
both.
[READY] Workaround "Invalid channel" errors when NeoVim exits immediately after started
# PR Prelude
Thank you for working on YCM! :)
- [x] I have read and understood YCM's [CONTRIBUTING][cont] document.
- [x] I have read and understood YCM's [CODE_OF_CONDUCT][code] document.
- [ ] I have included tests for the changes in my PR. If not, I have included a
rationale for why I haven't.
Dunno how to write a test for such an _intermittent_ issue, sorry
- [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 was originally reported at https://github.com/neovim/neovim/issues/6840.
If I exit neovim immediately after it starts, there are error messages like this:
```
Error detected while processing function <SNR>96_PollServerReady[1]..<SNR>96_Pyeval[2]..provider#python3#Call:
line 18:
Invalid channel: 3
Error detected while processing function <SNR>96_PollServerReady[7]..<SNR>96_Pyeval[2]..provider#python3#Call:
line 18:
Invalid channel: 3
```
The issue is not always reproducible. Usually I get once in 5 neovim runs. With this patch I don't get these message in 20 neovim runs.
In https://github.com/neovim/neovim/issues/6840#issuecomment-309960751, @micbou mentions that
> Stopping the timers on the `VimLeave` event seems to fix that issue
So, here's my attempt!
[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/3292)
<!-- Reviewable:end -->
[READY] Update sign place regex pattern for newer versions
Among other things, [Vim 8.1.0614](162b71479b) changed the output of the `sign place` command by adding the `priority` field:
```
--- Signs ---
Signs for test.cpp:
line=4 id=100000000 name=YcmError priority=10
line=5 id=100000001 name=YcmError priority=10
```
This breaks [the `GetSignsForBuffer` function](7997fc5536/python/ycm/vimsupport.py (L204-L215)) which extract the signs from the output of that command. We need to update the regex pattern used to match the lines of `sign place` for Vim 8.1.0614 or later.
<!-- 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/3279)
<!-- Reviewable:end -->
[READY] Fix run_tests.py dependencies
The dependencies are now explicitly added to `PYTHONPATH` in the `run_tests.py` script. Adding the `argparse` module to `sys.path` is not needed anymore.
<!-- 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/3266)
<!-- Reviewable:end -->
[READY] Update FAQ entry about outdated libclang
The FAQ entry about libclang being too old is not relevant anymore. Replace it with the `undefined symbol: clang_getCompletionFixIt` error that occurs when ycmd loads a libclang older than 7.0.0.
<!-- 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/3269)
<!-- Reviewable:end -->
[READY] Fix candidate insertion adjustment
PR https://github.com/Valloric/YouCompleteMe/pull/3208 changed the way completion items are built by always defining all fields and in particular the `abbr` field. This caused a regression with the `AdjustCandidateInsertionText` function because that function checks if the `abbr` field exist which is now always the case. The function should instead check if the `abbr` field is empty.
I changed the order of the fields in the tests to follow the Vim documentation (`word` is defined before `abbr`) and I removed one of the tests since PR https://github.com/Valloric/YouCompleteMe/pull/3104 made it irrelevant.
<!-- 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/3258)
<!-- Reviewable:end -->
[READY] Remove user_options_store dependency
A small step in decoupling YCM and ycmd. Instead of loading the default settings from ycmd, define them directly in the `plugin/youcompleteme.vim` file along the other options. This removes the `frozendict` and `user_options_store` dependencies.
<!-- 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/3243)
<!-- Reviewable:end -->
[READY] Update ycmd
Include the following changes:
- PR Valloric/ycmd#1080: replace Boost canonical function with our own implementation;
- PR Valloric/ycmd#1104: improve filename completer;
- PR Valloric/ycmd#1121: support completion FixIts for C-family languages;
- PR Valloric/ycmd#1122: update jdt.ls to 0.26.0;
- PR Valloric/ycmd#1123: install fixed version of TypeScript in third-party folder;
- PR Valloric/ycmd#1124: only add the necessary directories to Python path.
Fixes#3173.
<!-- 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/3174)
<!-- Reviewable:end -->
[READY] Handle null characters in completion response
The `detailed_info` field may contain null characters e.g. `\x00` in Python docstrings (though it doesn't make sense to use such characters in a docstring). Since these characters cannot be evaluated through `pyeval` (and `py3eval`), we replace them with the symbol used by Vim to display them (`^@`).
This PR also rewrites the `_ConvertCompletionDataToVimData` function by relying on two things:
- [the `insertion_text` field is always defined](600f54de20/ycmd/responses.py (L109));
- [Vim ignores fields with an empty string](833e5dab14/src/edit.c (L2748-L2755)).
I did some measurements and the performance hit is negligible.
Fixes#3207.
<!-- 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/3208)
<!-- Reviewable:end -->
Include the following changes:
- replace Boost canonical function with our own implementation;
- improve filename completer;
- support completion FixIts for C-family languages;
- update jdt.ls to 0.26.0;
- install fixed version of TypeScript in third-party folder;
- only add the necessary directories to Python path.
The completion info field may contain null characters e.g. \x00 in
Python docstrings. These characters cannot be evaluated so they are
removed.
Rewrite the function that convert ycmd completion to Vim completion.
[READY] Recompute starting column on auto-wrapping
When auto-wrapping is enabled (`t` or `c` are present in `formatoptions`), Vim wraps the current line after the completion request is sent but before calling the completefunc. The column where the completion starts is invalid in that case and must be recomputed.
Fixes#2789.
<!-- 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/3192)
<!-- Reviewable:end -->