Commit Graph

43 Commits

Author SHA1 Message Date
micbou
4e3ae95e9f
Update JavaScript support and documentation 2018-07-25 22:15:01 +02:00
micbou
29231e839d
Fix issues reported by flake8-comprehensions 2018-05-03 13:11:19 +02:00
micbou
5981809681
Support FixIts in TypeScript completions 2018-04-25 05:08:23 +02: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
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
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
micbou
223ae6ab9f
Rewrite completion system
Bring fully asynchronous completion by polling for completions with a timer
then calling completefunc once the completions are ready. Use the start column
returned by the server in completefunc. Immediately display the last completion
on the TextChangedI event to prevent the popup menu disappearing while waiting
for the completions. Handle the TextChangedI event not being triggered while
the completion menu is open by closing the menu when inserting a character
through the InsertCharPre event, and when deleting a character on the <BS> and
<C-h> keys.
2017-06-21 02:32:57 +02:00
micbou
f3ccafe3ae
Do not install aliases from future
Installing aliases from python-future is unreliable and slow.
2017-03-18 18:24:48 +01:00
Homu
8161d35030 Auto merge of #2465 - micbou:response-future, r=Valloric
[READY] Fix exception when response future is not set

An `AttributeError` exception is raised when `Done` is called before `Start` in the `CompletionRequest` and `EventNotification` classes because the `_response_future` attribute is not yet defined.

Fixes #2461.

<!-- 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/2465)
<!-- Reviewable:end -->
2016-12-23 09:41:21 +09:00
micbou
fd41d52dfe
Catch and log all server exceptions 2016-12-12 02:36:15 +01:00
micbou
bd890428a4
Fix exception when response future is not set 2016-12-11 20:51:45 +01:00
micbou
391757eec2 Avoid hit-enter prompts during completions
When an error occurs during completions, a message is displayed on
the status line. If this message is longer than the width of the
current window, Vim will prompt the user to press enter or type a
command to hide the message, interrupting user workflow. We prevent
that by truncating the message to window width.
Merge PostMultiLineNotice, EchoText, and EchoTextVimWidth functions
into PostVimMessage.
2016-08-28 09:19:07 +02:00
micbou
f6d5f68d6b Catch ReadTimeout exception on requests 2016-03-05 22:34:45 +01:00
Val Markovic
ba6c6182ed Consistent handling of ServerError exceptions
Previously we used the super-evil 'except Exception' clauses that would
catch everything and turn debugging into a sanity-questioning exercise.
2016-02-28 19:23:40 -08:00
Val Markovic
4e82409cc1 Futurize pass + manual fixes 2016-02-27 16:12:44 -08:00
Val Markovic
f986bf19db Updating to latest ycmd 2016-02-22 09:50:15 -08:00
micbou
4835b49a89 Remove interpreter line from Python sources 2016-02-05 16:24:03 +01:00
Francisco Lopes
9fdd465c26 Allows empty insertion text.
This is useful for hints for example, whose purpose is information
display solely.
2016-01-12 21:48:06 -02:00
Ben Jackson
958d8f1eb5 Support subcommands which return detailed info
We display the detailed info text in the preview window. Vim's preview window is
designed to display actual files, not scratch data. Our approach is to open a
temporary file, even though that file is never written. This way, all of Vim's
existing settings for the preview window (and people's configured mappings) just
work. This is also consistent with showing the documentation in the preview
window during completion.

Other plugins have more complicated functions for this (such as eclim), or
Scratch.vim, but this approach is simple and doesn't require external
dependencies or additional settings.

Tests:

This required fixing a sort-of-bug in which the mock'd Vim module was always
only set once, and could not be changed outside of the module which created it.
This meant that it wasn't easy to have arbitrary tests, because it was dependent
on the order in which the tests execute as to whether the return from
MockVimModule() was actually the one in use.

The solution was to make the mock'd vim module a singleton, and use mock's
patch decorator to assign new MagicMock() instances to those methods in the vim
module which a particular test is interested in.
2015-09-20 21:30:23 +01:00
Spencer G. Jones
2a41101955 Merge remote-tracking branch 'origin/master' into CsAddImport 2015-09-13 08:49:28 -06:00
Ben Jackson
5cfd6376c6 Show docs from clang completer in preview window
We add the detailed_info (which is the function definiton)
followed by the brief comment
2015-09-12 20:51:04 +01:00
Spencer G. Jones
9f134c4dd0 To determine which completion prompted CompleteDone, look at the new variable if vim is recent enough. 2015-09-09 08:27:15 -06:00
Spencer G. Jones
dd27184970 Add CompleteDone hook, with namespace insertion for C#
Add a new vim hook on CompleteDone. This hook is called when a
completions is selected.

When forcing semantic completion with the keybind, C# completions can
return a list of importable types. These types are from namespaces which
havn't been imported, and thus are not valid to use without also adding
their namespace's import statement. This change makes YCM automatically
insert the necessary using statement to import that namespace on
completion completion. In the case there are multiple possible
namespaces, it prompts you to choose one.
2015-08-28 10:05:46 -06:00
Ben Jackson
258951ece4 If errors are returned in addition to completion suggestions, print them 2015-08-17 01:13:20 +01:00
Strahinja Val Markovic
2fafab88c4 Ignoring the new "already being parsed" message
This exception comes from ycmd and is not something the user can do
anything about, so let's rather not show it.
2014-12-10 13:46:10 -08:00
Strahinja Val Markovic
0cdb588207 Updating to latest ycmd
Diagnostic & completion 'kind' changed in the REST API.
2014-06-03 14:49:53 -07:00
Strahinja Val Markovic
e9a318fc7c Update to latest ycmd
Upstream completions API changed.
2014-06-02 15:15:45 -07:00
Strahinja Val Markovic
9100044afc Refactored completion request creation
- OmniCompleter is now more similar to other Completers.
- CompletionRequest doesn't store start_column anymore.
- Calling BuildRequestData only once per request.
2014-05-27 17:38:34 -07:00
Strahinja Val Markovic
4cf9cfcdff Updating to latest ycmd
Since ycmd doesn't need 'query', 'start_column' and 'line_value' params, we
don't send them anymore.
2014-05-27 14:30:22 -07:00
Strahinja Val Markovic
a69bbb3009 Updating code to work with new ycmd location 2014-05-13 13:09:19 -07:00
Strahinja Val Markovic
433b3b64f0 Decoding completion strings to utf8 for Vim
Fixes #761
Fixes #775
2014-01-15 11:25:57 -08:00
Strahinja Val Markovic
b1bba2e201 Changing copyright headers from me to Google
When I initially released this project, I released it under my own copyright. I
have since then worked on it in my 20% time at Google (and want to continue
doing this) and my life becomes much simpler if the copyright is Google's.

From the perspective of how this project is run and managed, **NOTHING**
changes. YCM is not a Google product, merely a project run by someone who just
happens to work for Google.

Please note that the license of the project is **NOT** changing.

People sending in future pull requests will have to sign the Google
[CLA](https://developers.google.com/open-source/cla/individual) (you can sign
online at the bottom of that page) before those pull requests could be merged
in. People who sent in pull requests that were merged in the past will get an
email from me asking them to sign the CLA as well.
2014-01-13 11:08:43 -08:00
Strahinja Val Markovic
6e782508b3 Now possible to sent Vim data to FlagsForFile func
Fixes #612.
2013-10-26 16:22:43 -07:00
Strahinja Val Markovic
c3fcaf2b29 Strict 0.5s time budget for completion requests
Vim still loves to block the main GUI thread on occasion when asking for
completions... to counteract this stupidity, we enforce a hard budget of 0.5s
for all completion requests. If the server doesn't respond by then (it should,
unless something really bad happened), we give up.
2013-10-14 11:08:15 -07:00
Strahinja Val Markovic
3d55748400 Correctly handling ycm_extra_conf files now
The user is asked about loading unknown extra conf files, as they were before.
2013-10-08 16:21:43 -07:00
Strahinja Val Markovic
c7be1f1b47 Omni completion works again 2013-10-07 15:47:48 -07:00
Strahinja Val Markovic
ff7fa74fc9 <c-space> works again (forces semantic completion) 2013-10-07 13:09:34 -07:00
Strahinja Val Markovic
9742302cbd 'get_completions' handler is now 'completions' 2013-10-07 11:03:28 -07:00
Strahinja Val Markovic
9d0a6c96d7 Event and completion request are now async
This results in a much snappier Vim.
2013-10-07 11:03:28 -07:00
Strahinja Val Markovic
fe0c0a1607 GoTo commands work again 2013-10-07 11:03:27 -07:00
Strahinja Val Markovic
1730660555 A (barely) working version of ycmd + client
Still a lot of work to do.
2013-10-07 11:03:26 -07:00