Commit Graph

2399 Commits

Author SHA1 Message Date
zzbot
39fe6d1f86
Auto merge of #2898 - micbou:line-overlapping-chunks, r=micbou
[READY] Apply chunks from bottom to top

Without the proposed fix, the test included in that PR fails as follows
```
FAIL: ycm.tests.vimsupport_test.ReplaceChunksInBuffer_LineOverlappingChunks_test
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Python36\lib\site-packages\nose\case.py", line 198, in runTest
    self.test(*self.arg)
  File "C:\Users\micbou\projects\YouCompleteMe\python\ycm\tests\vimsupport_test.py", line 768, in ReplaceChunksInBuffer_LineOverlappingChunks_test
    AssertBuffersAreEqualAsBytes( expected_buffer, result_buffer )
  File "C:\Users\micbou\projects\YouCompleteMe\python\ycm\tests\vimsupport_test.py", line 86, in AssertBuffersAreEqualAsBytes
    eq_( ToBytes( result_line ), ToBytes( expected_line ) )
AssertionError: b'    third line' != b'    third '
```
Found the issue while trying to add code formatting support to the language server completer. The test is based on a real-world scenario when formatting with jdt.ls (for some reason, jdt.ls is including the newline of the previous line when fixing indentation).

<!-- 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/2898)
<!-- Reviewable:end -->
2018-02-10 15:20:24 -08:00
micbou
4c6290ccb7
Merge pull request #2906 from puremourning/update-docs
Update help doc
2018-02-11 00:00:31 +01:00
Ben Jackson
aacff42403 Update help doc 2018-02-10 21:47:34 +00:00
micbou
c692b48bc6
Apply chunks from bottom to top 2018-02-10 21:42:41 +01:00
zzbot
0d495578b5
Auto merge of #2863 - puremourning:java-async-diagnostics, r=micbou
[READY] Java support with asynchronous diagnostics and messages

# 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 is required for a better user experience when using native
java support

This implements an asynchronous message system using a long-poll request
to the server.

The server provides an endpoint /receive_messages which blocks until
either a timeout occurs or we receive a batch of asynchronous messages.
We send this request asynchronously and poll it 4 times a second to see
if we have received any messages.

The messages may either be simply for display (such as startup progress)
or diagnostics, which override the diagnostics returned by
OnFileReqdyToParse.

In the former case, we simply display the message, accepting that this
might be overwritten by any other message (indeed, requiring this), and
for the latter we fan out diagnostics to any open buffer for the file in
question.

Unfortunately, Vim has bugs related to timers when there is something
displayed (such as a "confirm" prompt or other), so we suspend
background timers when doing subcommands to avoid vim bugs. NOTE: This
requires a new version of Vim (detected by the presence of the
particular functions used).

NOT_READY because:

- the submodule commit points at my repo and requires https://github.com/Valloric/ycmd/pull/857 to be merged
- my spider sense suggest i have more testing to do...

Notes:

- Part 3 (I think) of the Java support PRs. This one actually adds the minimal changes for working java support
- There are about 2 or 3 other PRs to come to add things like automatic module imports, etc.

[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="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2863)
<!-- Reviewable:end -->
2018-02-10 12:37:57 -08:00
zzbot
26a5e3cbc4
Auto merge of #2899 - micbou:catch-extra-conf-data-exception, r=bstaletic
[READY] Avoid traceback when computing extra conf data

Evaluating the values of [the `g:ycm_extra_conf_vim_data` option](https://github.com/Valloric/YouCompleteMe#the-gycm_extra_conf_vim_data-option) may raise a Python exception (e.g. one of the values is not defined). Since that option is evaluated each time a request is sent, such exception can render the editor almost unusable as each key press will print a Python traceback to the user.

A simple way to reproduce the issue is to add the following line in vimrc:
```viml
let g:ycm_extra_conf_vim_data = [ 'undefined_value' ]
```

We fix that by catching and logging the exception.

<!-- 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/2899)
<!-- Reviewable:end -->
2018-02-10 09:55:33 -08:00
Boris Staletic
690a763865 Add documentation for inital experrimental support for Java 2018-02-10 16:29:27 +00:00
Ben Jackson
292de25c72 Add support for Java diagnostics and asynchronous messages
This implements an asynchronous message system using a long-poll request
to the server.

The server provides an endpoint /receive_messages which blocks until
either a timeout occurs or we receive a batch of asynchronous messages.
We send this request asynchronously and poll it 4 times a second to see
if we have received any messages.

The messages may either be simply for display (such as startup progress)
or diagnostics, which override the diagnostics returned by
OnFileReqdyToParse.

In the former case, we simply display the message, accepting that this
might be overwritten by any other message (indeed, requiring this), and
for the latter we fan out diagnostics to any open buffer for the file in
question.

Unfortunately, Vim has bugs related to timers when there is something
displayed (such as a "confirm" prompt or other), so we suspend
background timers when doing subcommands to avoid vim bugs. NOTE: This
requires a new version of Vim (detected by the presence of the
particular functions used).
2018-02-10 16:29:27 +00:00
Ben Jackson
4e95e5d406 Very minor typographical changes (NFC) 2018-02-10 15:47:30 +00:00
micbou
6c326a1b5f
Avoid traceback when computing extra conf data
Evaluating the values of g:ycm_extra_conf_vim_data may raise a Python exception
(e.g. one of the values is not defined). Since that option is parsed each time
a request is sent, such exception makes the editor almost unusable as each key
press is printing a Python traceback to the user. Catch and log the exception.
2018-02-10 15:27:27 +01:00
zzbot
b9aa20821f
Auto merge of #2902 - micbou:update-ycmd, r=puremourning
[READY] Update ycmd

Include the following changes:

 - PR Valloric/ycmd#789: add support for Windows flags when --driver-mode=cl is given;
 - PR Valloric/ycmd#848: hide C++ symbols by default;
 - PR Valloric/ycmd#857: add Java support using jdt.ls;
 - PR Valloric/ycmd#861: translate libclang error codes to exceptions;
 - PR Valloric/ycmd#880: support downloading Clang binaries on ARM systems;
 - PR Valloric/ycmd#883: handle zero column diagnostic from OmniSharp;
 - PR Valloric/ycmd#884: specify Platform property when compiling OmniSharp;
 - PR Valloric/ycmd#886: use current working directory in JavaScript completer;
 - PR Valloric/ycmd#887: update Boost to 1.66.0;
 - PR Valloric/ycmd#888: update JediHTTP;
 - PR Valloric/ycmd#889: update Clang to 5.0.1;
 - PR Valloric/ycmd#891: fix building with system libclang on Gentoo amd64;
 - PR Valloric/ycmd#904: drop Python 2.6 and Python 3.3 support;
 - PR Valloric/ycmd#905: calculate the start column when items are not resolved in the language server completer;
 - PR Valloric/ycmd#912: download Clang binaries from HTTPS;
 - PR Valloric/ycmd#914: do not try to symlink libclang on Windows.

<!-- 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/2902)
<!-- Reviewable:end -->
2018-02-10 04:27:53 -08:00
micbou
be45b40ae6
Update ycmd
Include the following changes:
 - add support for Windows flags when --driver-mode=cl is given;
 - hide C++ symbols by default;
 - add Java support using jdt.ls;
 - translate libclang error codes to exceptions;
 - support downloading Clang binaries on ARM systems;
 - handle zero column diagnostic from OmniSharp;
 - specify Platform property when compiling OmniSharp;
 - use current working directory in JavaScript completer;
 - update Boost to 1.66.0;
 - update JediHTTP;
 - update Clang to 5.0.1;
 - fix building with system libclang on Gentoo amd64;
 - drop Python 2.6 and Python 3.3 support;
 - calculate the start column when items are not resolved in the language
   server completer;
 - download Clang binaries through HTTPS;
 - do not try to symlink libclang on Windows.
2018-02-09 13:57:51 +01:00
zzbot
d0c6b6186e
Auto merge of #2887 - bstaletic:drop_python26_and_33, r=micbou
[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 -->
2018-02-01 09:59:37 -08:00
zzbot
9aa754c8c8
Auto merge of #2889 - bstaletic:PostVimMassage_truncate_fix, r=puremourning
[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 -->
2018-01-31 13:35:10 -08:00
Boris Staletic
bb7bbdb974 Fix truncation
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.
2018-01-30 19:26:22 +01:00
Boris Staletic
605ef42cd6 Drop Python 2.6 and Python 3.3 2018-01-30 18:34:50 +01:00
zzbot
d183f11fa7 Auto merge of #2878 - micbou:circleci, r=micbou
[RFC] Move macOS builds to CircleCI

See PR https://github.com/Valloric/ycmd/pull/901.

<!-- 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/2878)
<!-- Reviewable:end -->
2018-01-21 01:00:14 -08:00
micbou
af5a3ae36e
Move macOS builds to CircleCI 2018-01-20 10:36:18 +01:00
zzbot
28292f0f62 Auto merge of #2871 - micbou:optimize-request-building, r=bstaletic
[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 -->
2018-01-09 16:06:23 -08:00
micbou
43ebd5252d
Optimize request building
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.
2018-01-09 01:40:07 +01:00
zzbot
ad41dfb8af Auto merge of #2866 - puremourning:readme-contacts, r=micbou
[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 -->
2017-12-31 15:46:03 -08:00
Ben Jackson
cd1bd45dec Signpost the contact details earlier in the README 2017-12-31 22:38:04 +00:00
zzbot
e59e3afcde Auto merge of #2848 - micbou:cs-completer-property-platform, r=bstaletic
[READY] Update MSBuild command in documentation

See PR https://github.com/Valloric/ycmd/pull/884. Also, remove the part where we suggest to replace `msbuild` with `xbuild` since [`xbuild` is deprecated](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#xbuild).

<!-- 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/2848)
<!-- Reviewable:end -->
2017-12-26 14:12:16 -08:00
zzbot
1080a31027 Auto merge of #2862 - puremourning:use-fake-filetype, r=micbou
[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 -->
2017-12-23 09:49:11 -08:00
Ben Jackson
c2f26159f6 Use fake filetype for omni completion test
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.
2017-12-23 15:41:14 +00:00
zzbot
8aa617ec03 Auto merge of #2861 - puremourning:always-supply-wd, r=micbou
[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 -->
2017-12-22 17:36:34 -08:00
Ben Jackson
bc6ac461f3 Always supply working directory
This allows completer servers to detect the correct directory to launch
no matter what request initialises the completer server.
2017-12-23 00:51:21 +00:00
zzbot
757c5e5be4 Auto merge of #2860 - micbou:toggle-logs-prompt, r=puremourning
[READY] Prompt the user to select a logfile with the YcmToggleLogs command

Instead of displaying the list of available logfiles, prompt the user to open (or close if already
open) one of them when running the `:YcmToggleLogs` command with no arguments. Keep the current behavior when one or more arguments are given.

![toggle-logs-prompt](https://user-images.githubusercontent.com/10026824/34301520-39affee2-e72d-11e7-9c94-9a37beaabcce.gif)

<!-- 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/2860)
<!-- Reviewable:end -->
2017-12-22 13:47:01 -08:00
micbou
497a803188
Prompt the user to select a logfile with YcmToggleLogs
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.
2017-12-22 19:58:29 +01:00
micbou
0f836e8407
Update MSBuild command in documentation
Specify the Platform property in the MSBuild command. Do not mention xbuild.
2017-12-07 15:40:58 +01:00
zzbot
290dd94721 Auto merge of #2839 - micbou:update-ycmd, r=puremourning
[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 -->
2017-12-03 11:40:20 -08:00
zzbot
2dd27db859 Auto merge of #2838 - micbou:normalize-buffer-filepath, r=micbou
[READY] Normalize buffer filepath

On Windows, Vim returns buffer filepaths with forward slashes instead of backward ones if [the `shellslash` option](http://vimdoc.sourceforge.net/htmldoc/options.html#'shellslash') is set. Since the server always return paths with backslashes on that platform, [the paths comparison in `JumpToLocation`](e8e144d446/python/ycm/vimsupport.py (L409)) will incorrectly return `True` for two equivalent paths. We need to normalize the paths from Vim.

<!-- 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/2838)
<!-- Reviewable:end -->
2017-12-01 22:23:33 -08:00
zzbot
cc4692bd42 Auto merge of #2834 - micbou:fnameescape, r=micbou
[READY] Use fnameescape to escape filepath

Spaces are not the only characters that need to be escaped when passing a filepath to a Vim command: `*`, `?`, `[`, `{`, etc. should be escaped too. Instead of escaping each one of these characters in Python, we use [the Vim function `fnameescape`](http://vimdoc.sourceforge.net/htmldoc/eval.html#fnameescape()).

Closes #2623.

<!-- 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/2834)
<!-- Reviewable:end -->
2017-12-01 17:22:05 -08:00
micbou
103d45fc4c
Update JavaScript documentation 2017-12-01 17:56:12 +01:00
micbou
227ac99c8a
Update ycmd
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.
2017-12-01 17:55:43 +01:00
micbou
b1eda652c3
Normalize buffer filepath
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.
2017-12-01 17:55:15 +01:00
micbou
c3859791ea
Use fnameescape to escape filepath 2017-12-01 17:54:45 +01:00
zzbot
d99eb5d5cb Auto merge of #2840 - micbou:fix-macos-travis, r=puremourning
[READY] Fix macOS builds on Travis

Fix the `shell_session_update: command not found` error in macOS builds on Travis by removing [the `cd`, `popd`, `pushd` functions defined by RVM](ff63fa117b/scripts/cd (L14-L16)). See https://github.com/travis-ci/travis-ci/issues/8703#issuecomment-347881274.

<!-- 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/2840)
<!-- Reviewable:end -->
2017-12-01 07:56:17 -08:00
micbou
fe0ba8c641
Fix macOS builds on Travis
RVM overrides the cd, popd, and pushd shell commands, causing the
"shell_session_update: command not found" error on macOS when executing those
commands.
2017-12-01 15:14:28 +01:00
zzbot
e8e144d446 Auto merge of #2825 - mshindal:master, r=micbou
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 -->
2017-11-28 01:42:16 -08:00
zzbot
401836ea7f Auto merge of #2833 - micbou:fix-number-filetype, r=Valloric
[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 -->
2017-11-26 10:53:24 -08:00
zzbot
daa0175fa6 Auto merge of #2801 - micbou:no-completefunc-call-if-no-candidates, r=bstaletic
[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 -->
2017-11-26 09:45:03 -08:00
micbou
67d2a0fbf8
Fix error when filetype is a number
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.
2017-11-26 16:44:35 +01:00
zzbot
31abb9cee5 Auto merge of #2828 - micbou:get-buffer-number-for-filename, r=bstaletic
[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 -->
2017-11-17 01:27:25 -08:00
micbou
664d2c99d9
Change GetBufferNumberForFilename default behavior
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.
2017-11-17 00:52:40 +01:00
micbou
7e2e1e7d34
Only call completefunc if needed
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.
2017-11-15 18:51:55 +01:00
Matt Shindala
2f093e023b Trim to 80 characters / line, remove from Full Installation Guide 2017-11-13 19:23:23 -05:00
Matt Shindala
b04d703041 Add Python version information in README 2017-11-13 15:28:31 -05:00
zzbot
bade99f5e9 Auto merge of #2816 - micbou:update-7zip-requirement, r=bstaletic
[READY] Update 7-Zip requirement to 16.04 or later

There are some issues with [7-Zip 9.20](http://www.7-zip.org/download.html) when extracting files from the Clang installer. See https://github.com/Valloric/YouCompleteMe/issues/2756 and https://github.com/Valloric/YouCompleteMe/issues/2811.

<!-- 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/2816)
<!-- Reviewable:end -->
2017-10-27 01:16:54 -07:00
micbou
75ecccef90
Update 7-Zip requirement to 16.04 or later 2017-10-26 14:40:38 +02:00