[READY] Fix traceback when syntax files contain unicode characters
# 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.
- [ ] 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
Fixes https://github.com/Valloric/YouCompleteMe/issues/2036
I'm submitting this without tests for now because it's probably quite important, and adding tests is going to be quite time consuming because we somehow need to mock out the output of `:syntax list` with unicode chars, etc.
I have tested manually and got people experiencing the issue to also confirm that it fixes it.
I've also surveyed other uses of `vim.eval` that return string and wrapped them in a `ToUnicode` where there is a possibility of it not working. This is much more speculative, so feel free to say ditch this and just fix the issue at hand.
Also, of course feel free to say we can't merge this without tests, which is also valid :)
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2037)
<!-- Reviewable:end -->
vim.eval returns a str() object on py2, but our internal strings are all unicode().
We use vimsupport.VimExpressionToPythonType to wrap the conversion complexities.
Update tern_runtime directory in README
# 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.
- [ ] 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
Was following the guides and saw this referencing a wrong path so I decided to fix it with the proper one.
Should be useful sine this will keep the docs up-to-date!
[cont]: https://github.com/Valloric/YouCompleteMe/blob/master/CONTRIBUTING.md
[code]: https://github.com/Valloric/YouCompleteMe/blob/master/CODE_OF_CONDUCT.mdhttps://reviewable.io/reviews/valloric/youcompleteme/2047
[READY] Do not send request in OnFileReadyToParse function if server is down
Even if `ycmd` process is terminated, YCM will try to send the `event_notification` request in `OnFileReadyToParse` function, blocking Vim for one second if the server crashed at the start (because of [this request](https://github.com/Valloric/YouCompleteMe/blob/master/python/ycm/client/base_request.py#L222)) or resulting in a traceback with `ConnectionError` exception otherwise. This will happen for the `InsertLeave`, `CursorMoved`, `CursorHold`, `BufferVisit` events, making Vim almost unusable.
This is fixed by returning early if the process is terminated.
<!-- 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/2041)
<!-- Reviewable:end -->
Do not send an "event_notification" request in OnFileReadyToParse
function if server process is terminated. Otherwise, it blocks Vim
for one second or results in a traceback each time the InsertLeave,
CursorMoved, CursorHold, and BufferVisit events are triggered.
[READY] Fix multiline title entry in FAQ
Apparently, it is not possible to write a header on multiple lines using the `#` syntax in markdown, so we write it on one line.
Update the vim docs too.
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2035)
<!-- Reviewable:end -->
[READY] Update flake8 config
# 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
Python is a dynamic language and as a result shares the dynamic language mentality of "Fail Late". Admittedly, Python fails earlier than most dynamic languages, but in any case it is extremely useful to have static analysis and syntax checking tools available prior to runtime execution.
YCM uses flake8 for this as part of its test runs. However, due to code _style_ being more important to most of the checkers than code _quality_, we have not always taken full advantage (for example, syntax checking was disabled). This PR continues https://github.com/Valloric/ycmd/pull/416 and adds the same set of checks to YCM client.
This benefits developers because it speeds up the code/test cycle (using Syntactic now requires _no_ additional configuration for flake8 to be correct for YCM and ycmd), and benefits users, because we should produce better quality code :)
This PR also updates to the latest ycmd to include https://github.com/Valloric/ycmd/pull/416
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2031)
<!-- Reviewable:end -->
[READY] Catch ReadTimeout exception on requests
In PR #2016, we have changed the way we are catching exceptions on requests by only catching the `ServerError` instead of all exceptions, which is great for debugging purposes. However, due to this change, we don't catch the exception from a timed out request, leading to a ugly traceback in Vim. This PR fixes that.
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2029)
<!-- Reviewable:end -->
[READY] Add --all option to README
# 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 use the `--all` flag for every build. I know this is probably a flag that's more useful for YCM contributors than most users, but it makes sense to document it.
# No tests
It's only an update to the README, so I just tested it by eyeballing the output.
[cont]: https://github.com/Valloric/YouCompleteMe/blob/master/CONTRIBUTING.md
[code]: https://github.com/Valloric/YouCompleteMe/blob/master/CODE_OF_CONDUCT.md
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2027)
<!-- Reviewable:end -->
[READY] Making YCM run in Vim with only python3
Since https://github.com/Valloric/ycmd/pull/358, ycmd has supported Python 3. Now's the time to make the YCM client work in Python 3 too. As with the ycmd PR, **until we merge this, no other code-changing PR should be merged.** We need to get to a state where we have green Travis for Python 3 before any other PRs start landing.
This was substantially easier than porting ycmd, but it was still a massive pain. It's likely to fail in certain corner cases, so please give this a spin!
The best way to test it out is to build a Vim that has only Python 3 support. Our wiki page on [building Vim from source](https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source) is a great start; you'll probably need to change `--enable-pythoninterp` to `--enable-python3interp` and similar for `--with-python-config-dir`. Or just get yourself a beta image of Ubuntu 16.04 LTS and run it in a VM (16.04 doesn't even ship Python 2 in the base image!). You can verify that you're running the right Vim by looking at the output of `vim --version`. It should have `-python` and `+python3`.
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2016)
<!-- Reviewable:end -->
On Windows and Python 2, the full exception message from IOError
in CheckFilename will contain the filepath formatted as a unicode
string. Since the filepath is already added in the RuntimeError
message, use the strerror attribute to only display the error.
Move PostComplete tests inside a class that defines setUp and tearDown
methods. Clean YCM object in tearDown method. This fixes the error
"OSError: [WinError 6] The handle is invalid" on Windows with
Python 3.5.
Python 3 is much stricter around mixing bytes with unicode (and by
"stricter," I mean it doesn't allow it at all) so we're making
vimsupport only return `unicode` objects (`str` on py3). The idea is
that YCM (and ycmd) internals only ever deal with unicode.
[READY] Fix entries in table of contents
Rename entries of `YcmCompleter subcommands` section in table of contents so that they correspond to their sections title. Add `Miscellaneous commands` missing entry.
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2011)
<!-- Reviewable:end -->
Make headings and TOC entries have the same text.
Use Title Case for TOC entries.
Add "Miscellaneous commands" and "Functions" entries.
Set "And That's not all..." heading in bold instead.
Move "Diagnostic highlighting groups" to a third-level entry.