[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 -->
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.
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 -->
Update vim documentation with html2vimdoc
# 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
Regenerated vim documentation with html2vimdoc.py to match README.md.
[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/2196)
<!-- Reviewable:end -->
Update go installation details to match others
# 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
The golang details in the README are different than details for other additional languages. Adding a link to the golang download page and updating the wording makes the languages look the same.
[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/2193)
<!-- Reviewable:end -->
[READY] Fixes for multi-byte errors
# 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
There are a number of recent errors with unicode (most of which caused by the server, see PR https://github.com/Valloric/ycmd/pull/455. In testing I fixed a number of client-side tracebacks also.
This is by no means a comprehensive set of fixes for the client - I have simply fixed those that I came across in testing.
Summary:
- fixes for errors when typing in c-sharp files due to the completion done handler
- fixes for FixIts to apply correctly with multi-byte characters
- fixes for unicode characters in return from the omni completer
[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/2108)
<!-- Reviewable:end -->
[READY] Avoid evaluating Vim globals in Python
### Problem
See the commit message and issue #2127.
### How to reproduce
Make Vim to use Python 3 for YCM by either using Vim with only Python 3 support or by editing the `s:UsingPython2` function in `autoload/youcompleteme.vim` to always return 0.
Create the following `vimrc`:
```
set nocompatible
set runtimepath+=~/.vim/bundle/YouCompleteMe
set encoding=utf8
filetype plugin indent on
let g:dummy_variable = '€'[0]
```
and start Vim with it. The following error will occur:
```
YouCompleteMe unavailable: 'utf-8' codec can't decode byte 0xe2 in position 0: unexpected end of data
```
with the traceback in `:messages`:
```python
Traceback (most recent call last):
File "<string>", line 24, in <module>
File "C:\\Users\\micbou\\.vim\\bundle\\YouCompleteMe\\autoload\..\python\ycm\setup.py", line 49, in SetUpYCM
base.LoadJsonDefaultsIntoVim()
File "C:\\Users\\micbou\\.vim\\bundle\\YouCompleteMe\\autoload\..\python\ycm\base.py", line 60, in LoadJsonDefaultsIntoVim
vimsupport.LoadDictIntoVimGlobals( vim_defaults, overwrite = False )
File "C:\\Users\\micbou\\.vim\\bundle\\YouCompleteMe\\autoload\..\python\ycm\vimsupport.py", line 305, in LoadDictIntoVimGlobals
extend_option ) )
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe2 in position 0: unexpected end of data
```
### Solution
Do not evaluate the Vim globals when loading the YCM default options into Vim and when building the options for the ycmd server.
Depending on the number of global variables and custom YCM options, this may be slower or faster than the current code but by a negligible margin (~1ms).
Fixes#2127 and #2150.
<!-- 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/2151)
<!-- Reviewable:end -->
On Python 3, evaluating a Vim expression will raise a unicode exception
if it contains an invalid sequence of bytes for the current encoding.
We can't really do anything about it because this is the way Vim and
Python 3 interact. However, we can prevent this situation to occur by
not evaluating Vim data that we have no control over: in particular,
the Vim globals. This is done by:
- adding one by one the YCM default options instead of extending the
Vim globals with them;
- only evaluating the Vim global variable names (and not their values)
when building the YCM options for the ycmd server.
Display an error message to the user depending on the status code
returned by the ycmd server.
Remove ycm_core checks in plugin/youcompleteme.vim. These checks are
now done by the ycmd server.
Do not start a separate process to check the core version but rely on
ycmd returning a specific exit code. This slightly improves the Vim
startup time.
[READY] Fix PostComplete test
A refactoring of PostComplete tests made the `GetCompletionsUserMayHaveCompleted_ReturnEmptyIfPendingMatches_OldVim` test identical to
`GetCompletionsUserMayHaveCompleted_ReturnEmptyIfPendingMatches_NewVim`. Revert to original test.
This PR also updates the tests with small changes. See the commit message.
<!-- 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/2097)
<!-- Reviewable:end -->
Add how to build python to avoid startup problems (in particular, pyenv)
# 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
I spent a while trying to find where I had written the instructions for building python with pyenv to work with YCM, then I thought the README was a good place for it.
ycmd must use pythons with `--enable-shared` or `--enable-framework` else boom.
[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/2083)
<!-- Reviewable:end -->
[READY] Rename ycmd python option
# 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
As requested in https://github.com/Valloric/YouCompleteMe/issues/2052#issuecomment-195631106 I'm sending this PR. I've marked it as WIP because I've renamed only the `ycmd` option and that is because keeping the backward compatibility here was straight forward since is a client only option. For the jedihttp option instead I would like some opinion on how to procede: should we keep the backward compatibility here on the client or should we make the backward compatibility layer on the ycmd side? Keeping it here would be easier but it would mean that other clients should implement this theirself. Thoughts?
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2054)
<!-- Reviewable:end -->