Commit Graph

898 Commits

Author SHA1 Message Date
micbou
4524d4bfd1
Include extra data when getting the logs
Include the extra conf data to the debug info request when getting the
logfiles.
2018-09-19 21:30:04 +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
zzbot
bdfcb660eb
Auto merge of #3027 - micbou:fix-debug-info-test, r=puremourning
[READY] Fix debug info test on Python 2 with Clang support

Since PR https://github.com/Valloric/ycmd/pull/925, the list of flags returned by ycmd are prefixed with `u` on Python 2.

<!-- 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/3027)
<!-- Reviewable:end -->
2018-06-02 06:06:35 -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
midchildan
23771b379a
Add CUDA support 2018-05-24 14:34:15 +09: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
29231e839d
Fix issues reported by flake8-comprehensions 2018-05-03 13:11:19 +02:00
zzbot
2d04c411e9
Auto merge of #2997 - micbou:fix-shutdown-request-init, r=puremourning
[READY] Fix shutdown request init

Error found by [LGTM](https://lgtm.com/projects/g/Valloric/YouCompleteMe/alerts/?mode=list).

<!-- 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/2997)
<!-- Reviewable:end -->
2018-04-26 12:14:03 -07: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
40d0303405
Fix shutdown request initialization 2018-04-24 15:49:50 +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
micbou
caa0fb4285
Do not return omnifunc suggestions if server crashed 2018-04-17 17:39:25 +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
micbou
5d2258bdd4
Convert Vim command output to Unicode 2018-02-20 10:43:29 +01: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
micbou
b182556804
Add function to capture Vim command output 2018-02-18 14:06:09 +01:00
micbou
5e98da5b09
Improve diagnostic sign placement 2018-02-18 10:46:19 +01:00
zzbot
02f117035e
Auto merge of #2910 - micbou:fix-typo-tests, r=puremourning
[READY] Fix typo in tests name

`:%s/YouCompelteMe/YouCompleteMe`.

<!-- 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/2910)
<!-- Reviewable:end -->
2018-02-12 13:06:31 -08:00
micbou
8ab3f73b4d
Fix typo in tests name 2018-02-12 02:03:05 +01:00
micbou
a13329fe94
Add range support to completer command 2018-02-12 01:50:08 +01:00
Ben Jackson
7989b7b0fd Support for additional FixIts on java completions
Java completer can include FixIts which are applied when a completion
entry is selected. We use the existing mechanism implemented for c-sharp
to perform these edits using the CompleteDone autocommand.

However, the existing mechanism relies on pattern matching the source to
work out which item was completed. Vim patch 8.0.1493 introduces support
for user_data on completion items, so when available we populate it with
the completion array index of the item and use that to get the exact
element that was selected. This is both a lot faster and a lot more
accirate.

Of course when applying these 'FixIts' we don't interrupt the user with
confirmation or the quickfix list as this would just be annoying. If the
server reports that an edit must be made, we just make the edit. This is
achieved by adding a silent flag to ReplaceChunks.
2018-02-11 18:11:34 +00:00