[READY] Only call completion function if needed
Currently, YCM calls the `completefunc` at each key press even if there are no candidates. This has the side effect of always keeping the user in completion mode while typing in insert mode, which causes the following issues:
- the `<C-U>`, `<C-N>`, `<C-P>`, and `<C-E>` keys are not working as expected in insert mode when the completion menu is not visible;
- automatic comment formatting is broken in some situations. See issue https://github.com/Valloric/YouCompleteMe/issues/2552.
This is solved by only calling the `completefunc` if suggestions are available (or if the start column is not after the current column) and by closing the completion menu otherwise.
Updates the `<C-U>` entry in the FAQ.
Fixes https://github.com/Valloric/YouCompleteMe/issues/2552.
<!-- 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/2801)
<!-- Reviewable:end -->
The VimExpressionToPythonType function automatically convert a number
represented as a string to an integer. This causes an error when used to
evaluate a filetype set to a number as the result is split on the dot character
to get a list of filetypes and an integer cannot be split. Use vim.eval and
ToUnicode instead.
[READY] Change GetBufferNumberForFilename default behavior
While I was looking at PR https://github.com/Valloric/YouCompleteMe/pull/2827, I noticed that the default behavior of `GetBufferNumberForFilename` is to create a buffer for the given filename if no buffer already exists for that filename. This behavior is rather unexpected given the name of that function. In fact, `GetBufferNumberForFilename` is almost always called with the `open_file_if_needed` parameter (renamed `create_buffer_if_needed` for clarity) sets to `False`. This really suggests that the default value should be `False` instead of `True`.
In addition, that default behavior may lead to performance issues when the server returns diagnostics for a lot of files with no corresponding buffers since this will create a buffer for each one of these files.
<!-- 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/2828)
<!-- Reviewable:end -->
If no buffer exists for a given filename, the GetBufferNumberForFilename
function will create a buffer for that file by default. This behavior is
unexpected given the name of that function and may lead to performance issues
when ycmd returns diagnostics for a lot of files with no corresponding buffers.
The default behavior for that function should be to not create a buffer.
Do not call user's completion function if the start column is after the current
column or if there are no candidates. This avoids keeping the user in
completion mode even if there is no completion menu.
Include the following changes:
- automatically find Rust sources through rustup;
- do not return canonical type if identical to type in C-family languages;
- improve support of system Boost and system libclang on Gentoo;
- improve Red Hat and CentOS detection;
- consider header file entries in compilation database;
- improve completion of include statements in C-family languages;
- rename completer options in installation script;
- only include one macOS toolchain.
[READY] Improve server crash notification at startup
Instead of notifying the user if the server crashed immediately after starting it (which is unlikely to work because the server process is necessarily up at this point), do it during polling.
<!-- 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/2798)
<!-- Reviewable:end -->
Added instructions for cmake3
- Updated Linux64 instructions for older systems where cmake(2.8) might be causing compilation issues.
- Using cmake3 may likely address issues (in certain scenarios)
# 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
This is a non-code PR adding instructions to the README.md file for situations where `cmake` may be the issue. The instructions simply specify that under certain scenarios, using `cmake3` instead of `cmake` may address the compilation-issues of YCM (eg. on older systems like Ubuntu 14.04). A reference to this issue can be found under the discussion here: [link](https://github.com/Valloric/YouCompleteMe/issues/2729#issuecomment-332961003)
[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/2792)
<!-- Reviewable:end -->
- Updated Linux64 instructions for older systems where cmake(2.8) might be causing compilation issues.
- Using cmake3 may likely address issues (in certain scenarios)
On Windows, the options file cannot be deleted while it is still open by
another process. Close the file before starting the server. Do not explicitly
flush the file as closing implies flushing.
[READY] Improve path to python interpreter error handling
YCM returns the cryptic error `YouCompleteMe unavailable: [Errno 2] No such file or directory` when the Python interpreter path used to start the server doesn't exist. See issues https://github.com/Valloric/YouCompleteMe/issues/2773 and https://github.com/Valloric/YouCompleteMe/issues/2775.
This PR improves that by using the `FindExecutable` and `GetExecutable` functions from ycmd to check if the Python interpreter path exists (and is an executable) and by returning a much more helpful message if it doesn't. We use `FindExecutable` instead of `GetExecutable` on the `g:ycm_server_python_interpreter` option so that the user can specify a Python path with just the executable name (e.g. `python`, `python2`, `python3`).
This also fixes a Python traceback in Vim that occurs when, after successfully starting the server, the `g:ycm_server_python_interpreter` option is set to an invalid path and the server is restarted with `:YcmRestartServer`. Steps to reproduce are:
- start Vim with a working YCM;
- type `:let g:ycm_server_python_interpreter = '/invalid/python/path'`;
- type `:YcmRestartServer`.
<!-- 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/2787)
<!-- Reviewable:end -->
[READY] Do not open location list at the bottom of screen
The location list is specific to the current window so it should be opened inside the current window (default behavior), not to full width at the bottom of the screen (with `:botright`).
<!-- 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/2781)
<!-- Reviewable:end -->
[READY] Update ycmd
This new version of ycmd includes the following changes:
- PR Valloric/ycmd#795: add option to make relative paths in flags from extra conf absolute;
- PR Valloric/ycmd#802: fix compilation on Haiku;
- PR Valloric/ycmd#804: add libclang detection on FreeBSD;
- PR Valloric/ycmd#808: write python used during build before installing completers;
- PR Valloric/ycmd#810: support unknown languages from tags;
- PR Valloric/ycmd#811: update Universal Ctags languages list;
- PR Valloric/ycmd#814: resolve symlinks in extra conf glob patterns;
- PR Valloric/ycmd#815: update JediHTTP;
- PR Valloric/ycmd#816: update Boost to 1.65.0;
- PR Valloric/ycmd#819: filter and sort candidates when query is empty;
- PR Valloric/ycmd#820: improve LLVM root path search for prebuilt binaries;
- PR Valloric/ycmd#822: inline critical utility functions;
- PR Valloric/ycmd#824: do not sort header paths in filename completer;
- PR Valloric/ycmd#825: implement partial sorting;
- PR Valloric/ycmd#830: add max_num_candidates option;
- PR Valloric/ycmd#831: fix multiline comments and strings issues;
- PR Valloric/ycmd#832: update Clang to 5.0.0.
The `g:ycm_max_num_candidates` and `g:ycm_max_num_identifier_candidates` options are added to the documentation.
The link to ycmd extra conf is updated.
Fixes#2562.
<!-- 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/2768)
<!-- Reviewable:end -->
Include following changes:
- add option to make relative paths in flags from extra
conf absolute;
- fix compilation on Haiku;
- add libclang detection on FreeBSD;
- write python used during build before installing
completers;
- support unknown languages from tags;
- update Universal Ctags languages list;
- resolve symlinks in extra conf glob patterns;
- update JediHTTP;
- update Boost to 1.65.0;
- filter and sort candidates when query is empty;
- improve LLVM root path search for prebuilt binaries;
- inline critical utility functions;
- do not sort header paths in filename completer;
- implement partial sorting;
- add max_num_candidates option;
- fix multiline comments and strings issues;
- update Clang to 5.0.0.
[READY] Update ClearCompilationFlagCache docs
Update the documentation for the `ClearCompilationFlagCache` subcommand by taking into account that:
- the `do_cache` parameter is set to `True` by default;
- the flags from the compilation database are also cached;
- restarting the server clears the cache.
<!-- 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/2763)
<!-- Reviewable:end -->