Commit Graph

211 Commits

Author SHA1 Message Date
micbou
f6ec5557c0
Add g:ycm_filter_diagnostics to list of options 2018-11-26 12:51:26 +01:00
micbou
e651d970ed
Remove user_options_store dependency
Directly define the ycmd options in the plugin.
2018-11-26 12:51:01 +01:00
zzbot
f2d999bbb1
Auto merge of #3229 - micbou:keep-previous-window, r=puremourning
[READY] Preserve previous window when updating matches

Ensure `<c-w>p` still go to the previous window after updating matches for the current buffer.

Fixes #3228.

<!-- 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/3229)
<!-- Reviewable:end -->
2018-11-18 05:48:57 -08:00
zzbot
ff0a62bd15
Auto merge of #3174 - micbou:clang-fixit-completion, r=bstaletic
[READY] Update ycmd

Include the following changes:

 - PR Valloric/ycmd#1080: replace Boost canonical function with our own implementation;
 - PR Valloric/ycmd#1104: improve filename completer;
 - PR Valloric/ycmd#1121: support completion FixIts for C-family languages;
 - PR Valloric/ycmd#1122: update jdt.ls to 0.26.0;
 - PR Valloric/ycmd#1123: install fixed version of TypeScript in third-party folder;
 - PR Valloric/ycmd#1124: only add the necessary directories to Python path.

Fixes #3173.

<!-- 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/3174)
<!-- Reviewable:end -->
2018-11-17 21:41:09 -08:00
micbou
4b4f678bef
Support completion FixIts for C-family languages 2018-11-17 14:29:00 +01:00
zzbot
95efbc8766
Auto merge of #3208 - micbou:null-character-completion, r=micbou
[READY] Handle null characters in completion response

The `detailed_info` field may contain null characters e.g. `\x00` in Python docstrings (though it doesn't make sense to use such characters in a docstring). Since these characters cannot be evaluated through `pyeval` (and `py3eval`), we replace them with the symbol used by Vim to display them (`^@`).

This PR also rewrites the `_ConvertCompletionDataToVimData` function by relying on two things:
 - [the `insertion_text` field is always defined](600f54de20/ycmd/responses.py (L109));
 - [Vim ignores fields with an empty string](833e5dab14/src/edit.c (L2748-L2755)).

I did some measurements and the performance hit is negligible.

Fixes #3207.

<!-- 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/3208)
<!-- Reviewable:end -->
2018-11-17 05:23:42 -08:00
micbou
39c06c42e3
Handle null characters in completion response
The completion info field may contain null characters e.g. \x00 in
Python docstrings. These characters cannot be evaluated so they are
removed.
Rewrite the function that convert ycmd completion to Vim completion.
2018-11-17 01:42:05 +01:00
micbou
d08be52c62
Preserve previous window when updating matches
Ensure <c-w>p still go to the previous window after updating matches for
the current buffer.
2018-11-17 01:41:37 +01:00
micbou
eba717553f
Recompute starting column on auto-wrapping
When auto-wrapping is enabled, Vim wraps the current line after the
completion request is sent but before calling the completefunc. The
starting column returned by the server is invalid in that case and must
be recomputed.
2018-11-17 01:07:02 +01:00
zzbot
e412ee465b
Auto merge of #3204 - micbou:fix-flake8, r=bstaletic
[READY] Fix Flake8 errors

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

<!-- 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/3204)
<!-- Reviewable:end -->
2018-11-16 10:15:37 -08:00
micbou
88bdfc01f9
Fix Flake8 errors
Fix invalid escape sequences in string literals. Ignore E301 and W504.
2018-10-26 23:07:38 +02:00
micbou
926e32d6e5
Simplify AdjustCandidateInsertionText function
Candidates are always dictionaries containing the 'word' key.
2018-10-14 18:07:55 +02:00
micbou
73fea03d78
Convert strings from omnifunc into dictionaries
Vim allows each item of the list returned by an omnifunc to be either a string
or a dictionary but ycmd only supports lists where items are all strings or all
dictionaries. Convert all strings into dictionaries.
2018-10-14 18:07:54 +02:00
micbou
bdc3a66488
Ignore ft= argument from YcmCompleter command
Only the "ycm:ident" value of the ft= argument in the YcmCompleter
command is working. This value forces the use of the identifier
completer which serve no purpose because this completer doesn't define
commands. Ignore completely the ft= argument and move the logic to the
Python layer.
2018-09-28 01:12:23 +02:00
zzbot
487b8ab2b4
Auto merge of #3134 - micbou:fitting-height-wrap, r=micbou
[READY] Set window height according to the wrap option

The height of the quickfix and location list windows is set to fit all entries by assuming that the lines of the entries are always wrapped if they are longer than the window width. This assumption is wrong if `nowrap` is set. In that case, the height should be set to the number of entries.

<!-- 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/3134)
<!-- Reviewable:end -->
2018-09-09 06:39:05 -07:00
zzbot
c3b4884cd3
Auto merge of #3126 - micbou:fix-cursor-position-replace-chunk, r=micbou
[READY] Fix cursor position when replacing chunk

When replacing an area of the buffer with `ReplaceChunk`, we are replacing the whole last line of that area because the Python interface doesn't allow changing only some part of a line. If the cursor is positioned on that line just after the ending column of the replaced area, we expect the cursor to be moved depending on the amount of text replaced. However, since the whole line is replaced, Vim cannot figure where the cursor should be positioned and so the cursor is not moved. This leads to the cursor ending in an unexpected position after a FixIt is applied. Here's an illustration of the issue in TypeScript where an import statement is automatically inserted after selecting a completion:

![fixit-cursor-position-before](https://user-images.githubusercontent.com/10026824/44363871-be1ec400-a4c5-11e8-949b-14ada91bdc5e.gif)

The solution is to manually move the cursor in that case:

![fixit-cursor-position-after](https://user-images.githubusercontent.com/10026824/44364038-3a190c00-a4c6-11e8-8aca-4bc8ccb98edc.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/3126)
<!-- Reviewable:end -->
2018-09-09 05:36:16 -07:00
micbou
d215342f2f
Fix cursor position when replacing chunk
Vim doesn't move the cursor accordingly when its position is on the last line
of the replaced area after its ending column because the whole line is
replaced. The cursor must be manually moved in that case.
2018-09-09 12:38:44 +02:00
micbou
eac2232c22
Improve omnifunc compliance when start column is invalid
Contrarily to what the docs say, Vim only stops completion if the value
returned by the omnifunc is -3 or -2. In other cases, if the value is negative
or greater than the current column, the start column is set to the current
column; otherwise, the value is used as the start column.
2018-09-09 12:34:07 +02:00
micbou
b6583623a0
Set window height according to the wrap option 2018-08-29 22:04:47 +02:00
micbou
24ab8ca941
Restore cursor position after omnifunc calls
An omnifunc may move the cursor position even on the first call.
2018-08-19 21:16:52 +02:00
zzbot
a688da3b96
Auto merge of #3120 - micbou:goto-modifiers-version, r=micbou
[READY] Only use command modifiers if available

Command modifiers (see `:h mods`) were added in [Vim 7.4.1898](63a60ded3f (diff-28587d36c24b61c33d4d01601f5974ee)) while we support 7.4.1578 and later.

Fixes https://github.com/Valloric/YouCompleteMe/issues/3105.

<!-- 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/3120)
<!-- Reviewable:end -->
2018-08-19 11:34:44 -07:00
micbou
dca5682e21
Move cursor to start column before calling again omnifunc
Vim internally moves the cursor to the start column before calling again the
omnifunc. Some omnifuncs like the one defined by the LanguageClient-neovim
plugin depend on this behavior to compute the list of candidates.
2018-08-16 18:33:36 +02:00
micbou
959d0c4c5f
Only use command modifiers if available
Command modifiers were added in Vim 7.4.1898.
2018-08-14 13:52:25 +02:00
zzbot
15362d9cb8
Auto merge of #3089 - micbou:tsserver-javascript, r=Valloric
[READY] Update JavaScript support and documentation

This updates the documentation with the proposed changes in https://github.com/Valloric/ycmd/pull/1036#issuecomment-397234687. The Tern instructions are moved to [this wiki page](https://github.com/Valloric/YouCompleteMe/wiki/JavaScript-Semantic-Completion-through-Tern). JavaScript is added to the list of supported filetypes for diagnostics and completion fixits.

<!-- 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/3089)
<!-- Reviewable:end -->
2018-07-25 14:02:12 -07:00
micbou
4e3ae95e9f
Update JavaScript support and documentation 2018-07-25 22:15:01 +02:00
micbou
87702559f3
Support modifiers for GoTo commands 2018-07-24 18:07:41 +02:00
micbou
115f360092
Update matches for all windows 2018-06-03 18:58:09 +02:00
zzbot
2dcb3e91ad
Auto merge of #3045 - micbou:flake8-ycm, r=puremourning
[READY] Enforce YCM coding style

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

<!-- 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/3045)
<!-- Reviewable:end -->
2018-06-02 07:46:13 -07:00
zzbot
470518075d
Auto merge of #3035 - micbou:show-detailed-diagnostic-none, r=puremourning
[READY] Fix YcmShowDetailedDiagnostic command on line without diagnostic

The `YcmShowDetailedDiagnostic` command raises a `NoneType` exception on a line with no diagnostic;
```
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "YouCompleteMe/autoload\..\python\ycm\youcompleteme.py", line 663, in ShowDetailedDiagnostic
    if 'message' in detailed_diagnostic:
TypeError: argument of type 'NoneType' is not iterable
```

<!-- 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/3035)
<!-- Reviewable:end -->
2018-06-02 07:21:43 -07:00
micbou
29717194fc
Do not ignore E211 rule from Flake8 2018-05-30 09:21:20 +02:00
micbou
6b4d705238
Add flake8-ycm to test requirements
Fix errors reported by flake8-ycm.
2018-05-30 02:53:28 +02:00
micbou
a7ec7a6cd9
Fix YcmShowDetailedDiagnostic command on line without a diagnostic
The YcmShowDetailedDiagnostic command raises a NoneType exception on a line
with no diagnostic.
2018-05-24 11:52:57 +02:00
micbou
638ee2e5f8
Fix debug info test on Python 2 with Clang support 2018-05-18 18:20:41 +02:00
micbou
d16d3cebc4
Allow users to change the options by restarting the server 2018-05-15 23:45:54 +02:00
micbou
5981809681
Support FixIts in TypeScript completions 2018-04-25 05:08:23 +02:00
micbou
1df76bbb39
Fix debug info test when ycmd is compiled with C-family support 2018-04-25 05:08:23 +02:00
micbou
d4cddbcc7f
Update Omnifunc completer Unicode tests 2018-04-25 05:08:23 +02:00
micbou
f44723689c
Fix resending request when buffer is not yet parsed 2018-04-23 11:03:13 +02:00
micbou
a24d97ca6b
Resend request when extra conf is loaded or ignored
When the client sends a request to the server, if an extra conf file is found
that is not already white/blacklisted, the server stops processing the request
and tells the client that an unknown extra conf file has been found. The client
then asks the user if that file should be loaded or not. Depending on the
user's answer, the client sends a request to the server to load or ignore the
extra conf file. Finally, the server loads the file or adds it to the
blacklist. However, the initial request was not processed by the server and
should be sent again.
2018-04-22 22:10:14 +02:00
zzbot
7d72519039
Auto merge of #2978 - micbou:fix-filetype-specific-completion-to-disable, r=puremourning
[READY] Do not disable omnifunc when filetype completion is disabled

Prior to PR https://github.com/Valloric/YouCompleteMe/pull/2657, it was possible to trigger Vim's omnifunc with `<C-Space>` even if semantic completion was disabled for the current filetype through the `g:ycm_filetype_specific_completion_to_disable` option. It worked because `<C-Space>` was mapped to `<C-X><C-O><C-P>`, which are the keys to trigger the omnifunc. PR https://github.com/Valloric/YouCompleteMe/pull/2657 changed that by making `<C-Space>` directly call the `SendCompletionRequest` function with `force_semantic` sets to `True`. This change was necessary to get fuzzy matching with the omnifunc (see issue https://github.com/Valloric/YouCompleteMe/issues/961) but broke the `<C-Space>` behavior when filetype completion is disabled. This PR restores that behavior.

Fixes https://github.com/Valloric/YouCompleteMe/issues/2950.

<!-- 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/2978)
<!-- Reviewable:end -->
2018-04-14 12:32:46 -07:00
zzbot
3256ae3ffa
Auto merge of #2976 - micbou:refactor-server-exception-handling, r=puremourning
[READY] Refactor server exception handling

Having to wrap all request calls with the `HandleServerException` function is inconvenient. Handle server exceptions directly in `BaseRequest`.

<!-- 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/2976)
<!-- Reviewable:end -->
2018-04-14 11:13:15 -07:00
micbou
e96ef7ce38
Do not disable omnifunc when filetype completion is disabled
Allow users to still trigger Vim's omnifunc through C-Space when the
g:ycm_filetype_specific_completion_to_disable option is set for the current
filetype.
2018-04-13 02:40:50 +02:00
micbou
6ec1b0b4a1
Refactor server exception handling 2018-04-13 01:35:17 +02:00
micbou
3b115831a0
Fix applying fixit twice after completion 2018-04-06 17:56:25 +02:00
micbou
866693ef80
Refactor CompleteDone logic
Move CompleteDone logic to the CompletionRequest class.
2018-03-28 22:00:43 +02:00
micbou
ca8211a64b
Fix column clamping when highlighting diagnostics on Python 3 2018-03-25 16:02:48 +02:00
micbou
3086626448
Fix index error when applying a chunk at the end of file
When sending a request to the server, we add a newline to the buffer contents
to match what gets saved to disk. If the server generates a chunk containing
that newline, this chunk goes past the Vim buffer contents since there is
actually no new line, which raises an IndexError exception when applying the
chunk. We fix the issue by recomputing the end position of where the chunk is
applied and by removing all trailing characters in the chunk.
2018-03-19 14:28:28 +01:00
Ben Jackson
dc52b73048 Don't open the quickfix window after fixit 2018-02-22 23:02:10 +00:00
zzbot
54a4ecf2d9
Auto merge of #2922 - micbou:improve-diagnostic-match, r=bstaletic
[READY] Improve diagnostic matches display

There are two issues with how we display diagnostic matches. The first issue is that if the current buffer contains diagnostic matches and is split in a new window, all the matches are cleared and only matches in the new window are shown. The second issue is that if a new buffer with no diagnostic support is open in the current window and that window already contained matches then the matches are still displayed. Here's an illustration of both issues (signs are disabled):

![diagnostic-matches-issue](https://user-images.githubusercontent.com/10026824/36352338-bfeb2092-14b7-11e8-88f4-ae8cf6903304.gif)

The solution is to add an autocommand that updates matches on the `BufEnter` and `WinEnter` events. Here's the result:

![diagnostic-matches-fix](https://user-images.githubusercontent.com/10026824/36352340-c2a64a8c-14b7-11e8-8db2-4f1f54448c65.gif)

Note that it's not perfect as multiple windows of the same buffer won't be updated simultaneously. Supporting that scenario is rather tricky because we would need to go through all the windows to update the matches and switching windows can lead to a lot of issues (like interrupting visual mode) so we don't.

This PR also improves how we update matches by only displaying matches that are not already present and then clearing the remaining ones (similarly to what we do with signs; see PR https://github.com/Valloric/YouCompleteMe/pull/2915) instead of always clearing all the matches then displaying the new ones.

<!-- 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/2922)
<!-- Reviewable:end -->
2018-02-18 17:15:46 -08:00
micbou
c84e70737c
Improve diagnostic matches display 2018-02-18 21:32:00 +01:00