[READY] Drop Python 2.6 and Python 3.3
# 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.]
Since we are dropping support for Python 2.6 and 3.3 in Valloric/ycmd#904 we should drop support for them in YCM as well.
[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/2887)
<!-- Reviewable:end -->
[READY] Fix truncation of messages when len(message) == vim_width
# 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.]
When the message is exactly as wide as the vim window, vim still
displays "press enter..." message.
The bug can be demonstrated if we hardcode the `message` to `&columns * 'a'` and forcing `truncate` to `True`.
No tests because I didn't think it was necessary.
[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/2889)
<!-- Reviewable:end -->
When the message is exactly as wide as the vim window, vim still
displays "press enter..." message.
Wen we want to avoid that we need to cut the message one character
shorter.
[READY] Optimize request building
This PR significantly reduces the time spent to build the request when there are a lot of buffers. This is done by:
- using the `options` property on the buffer object to get the `mod` variable instead of evaluating `getbufvar`;
- not computing the buffer filepath if the buffer is not modified;
- passing the number of the unloaded buffer instead of its filepath on the `BufferUnload` event. Getting the Python buffer object from its number is easier than from its filepath.
Here are the times spent to edit a new empty buffer (i.e. two event notifications `BufferVisit` and `FileReadyToParse`) for different numbers of buffers already open in the editor before and after the changes:
<table>
<tr>
<th>Number of buffers open</th>
<th>Before (ms)</th>
<th>After (ms)</th>
</tr>
<tr>
<td>1</td>
<td>1.2</td>
<td>1.0</td>
</tr>
<tr>
<td>10</td>
<td>1.2</td>
<td>1.0</td>
</tr>
<tr>
<td>100</td>
<td>2.4</td>
<td>1.1</td>
</tr>
<tr>
<td>1000</td>
<td>13.5</td>
<td>2.2</td>
</tr>
<tr>
<td>10000</td>
<td>139.8</td>
<td>17.3</td>
</tr>
</table>
Results obtained with the `prof.py` script from [that branch](https://github.com/micbou/YouCompleteMe/tree/profiling-request-building).
<!-- 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/2871)
<!-- Reviewable:end -->
Reduce the time spent to build the request when there are a lot of buffers by:
- using the options property on the buffer object to get the mod variable
instead of evaluating getbufvar;
- not computing the buffer filepath if the buffer is not modified;
- passing the number of the unloaded buffer instead of its filepath on the
BufferUnload event. Getting the Python buffer object from its number is
easier than from its filepath.
[READY] Signpost the contact details earlier in the 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
At the request of the nice folk over at `#vim` on free node, this PR signposts the contact details and installation instructions at the top of the readme so that users seeking help use our contact details, rather than asking over there.
Overall it is better for users to seek support from us because:
* we have better knowledge and can solve issues more quickly
* we get better visibility of in-the-wild issues and sticking points
* certain #vim users feel that they are unduly burdened with supporting setup issues for YCM
cc @romainl
[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/2866)
<!-- Reviewable:end -->
[READY] Use fake filetype for omni completion test
# 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
Now that the server supports Java natively (or will soon), we need to use a
filetype that does not have native support to ensure that we call the
mocked omnifunc, but also one for which YCM has a semantic trigger.
Rather than picking another random languagse, which might break in the
future, we invent a language (ycmtest) and supply a manual trigger
mapping to the YouCompleteMe object.
References:
* Part 2 of the java completer client changes
* You probably previously saw this using ruby, but this was always a hack. This solution is permanent.
[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/2862)
<!-- Reviewable:end -->
Now that the server supports Java natively, we need to use a
filetype that does not have native support to ensure that we call the
mocked omnifunc, but also one for which YCM has a semantic trigger.
Rather than picking another random languagse, which might break in the
future, we invent a language (ycmtest) and supply a manual trigger
mapping to the YouCompleteMe object.
[READY] Always supply working directory
This allows completer servers to detect the correct directory to launch
no matter what request initialises the completer server.
# 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
This change ensures that the client supplies the working directory to the server on each request, in particular, event notifications; the java and javascript completers use this to start the server in the `FileReadyToParse` event, rather than on construction of the completer. The subtle difference allows them to use the client's working directory, rather than the _server's_ working directory to do things like project detection.
See also:
* This is PR 1 of the set of changes related to #2827 - client changes required to support Java and other language-server protocols.
* ycmd change for javascript that makes use of this now: https://github.com/Valloric/ycmd/pull/886
* updated API doc: http://puremourning.github.io/ycmd-1
The ycmd API change is simply to allow `working_dir` on all requests.
cc for minor optional API change: @abingham @Qusic @LuckyGeck @mawww @richard1122 @jakeanq @orsonteodoro
[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/2861)
<!-- Reviewable:end -->
When no argument is given to the YcmToggleLogs command, instead of displaying
the list of available logfiles, prompt the user to open (or close if already
open) one of them.
[READY] Update ycmd
Include the following changes:
- PR Valloric/ycmd#856: update JediHTTP;
- PR Valloric/ycmd#860: improve diagnostics location in C-family languages;
- PR Valloric/ycmd#865: use Objective-C triggers for Objective-C++;
- PR Valloric/ycmd#869: support TypeScript 2.6.1;
- PR Valloric/ycmd#875: allow switching to a different JavaScript project with `RestartServer`;
- PR Valloric/ycmd#877: support `-idirafter` include flag in C-family languages.
Update the JavaScript documentation on how to switch to a different project. We only mention the `:YcmCompleter RestartServer` way as other methods involve restarting ycmd and losing all its data like stored identifiers.
<!-- 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/2839)
<!-- Reviewable:end -->
Include the following changes:
- update JediHTTP;
- improve diagnostics location in C-family languages;
- use Objective-C triggers for Objective-C++;
- support TypeScript 2.6.1;
- allow switching to a different JavaScript project with RestartServer;
- support -idirafter include flag in C-family languages.
On Windows, Vim returns buffer filepaths with forward slashes instead of
backward ones if the shellslash option is set. Since we always expect backward
slashes from the server, we normalize these paths.
RVM overrides the cd, popd, and pushd shell commands, causing the
"shell_session_update: command not found" error on macOS when executing those
commands.
Mention in the docs that you need the exact version of Python that Vim is looking for
# 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.]
No tests needed since it's just a README change. Resolves#2824.
[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/2825)
<!-- Reviewable:end -->
[READY] Fix error when filetype is a number
When the filetype is set to a number (e.g. `set filetype=42`), YCM raises the following error:
```python
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\\Users\\micbou\\projects\\YouCompleteMe\\autoload\..\python\ycm\youcompleteme.py", line 571, in HandleFileParseRequest
self.NativeFiletypeCompletionUsable() ):
File "C:\\Users\\micbou\\projects\\YouCompleteMe\\autoload\..\python\ycm\youcompleteme.py", line 362, in NativeFiletypeCompletionUsable
return ( self.CurrentFiletypeCompletionEnabled() and
File "C:\\Users\\micbou\\projects\\YouCompleteMe\\autoload\..\python\ycm\youcompleteme.py", line 674, in CurrentFiletypeCompletionEnabled
filetypes = vimsupport.CurrentFiletypes()
File "C:\\Users\\micbou\\projects\\YouCompleteMe\\autoload\..\python\ycm\vimsupport.py", line 592, in CurrentFiletypes
return VimExpressionToPythonType( "&filetype" ).split( '.' )
AttributeError: 'int' object has no attribute 'split'
```
This happens because `VimExpressionToPythonType` automatically converts a string representing a number to an integer and an integer cannot be split.
Closes https://github.com/Valloric/YouCompleteMe/pull/2762.
<!-- 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/2833)
<!-- Reviewable:end -->
[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 -->