Commit Graph

28 Commits

Author SHA1 Message Date
micbou
805911b56b Use SetQuickFixList for GoTo* subcommands
Open the quickfix window to full width at the bottom of the screen with
its height set to fit all entries. This behavior can be overridden by
using the YcmQuickFixOpened autocommand.
Add a new section for autocommands in the documentation.
Update GoTo and ReplaceChunks tests.
2016-06-13 00:25:12 +02:00
micbou
f6d5f68d6b Catch ReadTimeout exception on requests 2016-03-05 22:34:45 +01:00
Val Markovic
c91130f280 Not depending on exception internals
We used to read the `message` attribute; that breaks on py3. The
standard idiom is to just use `str( exception )` to get the message.
2016-03-01 19:30:02 -08: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
Ben Jackson
24f1f9c900 Support FixIt commands across buffers
We simply apply the changes to each file in turn. The existing replacement
logic is unchanged, except that it now no longer implicitly assumes we are
talking about the current buffer.

If a buffer is not visible for the requested file name, we open it in
a horizontal split, make the edits, then hide the window. Because this
can cause UI flickering, and leave hidden, modified buffers around, we
issue a warning to the user stating the number of files for which we are
going to do this. We pop up the quickfix list at the end of applying
the edits to allow the user to see what we changed.

If the user opts to abort due to, say, the file being open in another
window, we simply raise an error and give up, as undoing the changes
is too complex to do programatically, but trivial to do manually in such
a rare case.
2016-02-21 22:02:33 +00:00
Ben Jackson
d9fef6be14 Remove knowlegde from YCM about subcommand names
Now 'GoTo' and 'FixIt' commands don't need to start with those
prefixes. For 'FixIt' we can detect the response type by looking for
the 'fixits' entry in the response.

For 'GoTo' this is a touch harder, as there is no completely obvious
way to tell. However it is unique in this respect, so we can simply
fall back to it.

Completers returning other types of response are not supported by
this client.
2016-02-21 22:02:33 +00:00
micbou
4835b49a89 Remove interpreter line from Python sources 2016-02-05 16:24:03 +01:00
Ben Jackson
134b06b65e Fix GoTo lists arriving at the wrong column.
Vim's QuickFix lists require 1-based columns, which is what is returned
from ycmd's commands.

 As noted in the comments, the Vim documentation for setqflist is
somewhat vague about this "byte offset", but it is confirmed to mean
"1-based column number" both in testing and in :help getqflist.
2016-01-04 23:04:13 +00:00
micbou
37f3f1530e Handle scalar response from subcommands
When the ycmd server returns a scalar (boolean, number, string, etc.)
from a subcommand, print it to the user.
2015-11-29 20:03:02 +01:00
micbou
13aeaa37a8 Handle boolean responses from ycmd
Fix ServerReady, ServerRunning, and ServerTerminated subcommands from
C♯ completer.
2015-11-28 16:48:24 +01: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
micbou
33316d8bf8 Refactor _HandleFixitResponse function 2015-09-12 18:13:54 +02:00
Ben Jackson
98c4d712b4 YouCompleteMe client support for FixIt subcommands 2015-08-05 22:09:07 +01:00
Strahinja Val Markovic
9de61988ac Fix bad formatting for YcmCompleter message
Fixes #1522
2015-06-30 14:24:05 -07:00
Strahinja Val Markovic
ecb4252322 Minor formatting fixes 2015-06-30 13:52:47 -07:00
Ben Jackon
2215bcdeb5 Support completer commands that return text …
This is required to allow the ycmd GetType and GetParent subcommands to echo
their reults in vim. The apporach is to display any text returned from a
subcommand in the 'message' property assuming that the command is not a known
'GoTo' command.
2015-03-19 13:31:24 +00:00
Strahinja Val Markovic
a69bbb3009 Updating code to work with new ycmd location 2014-05-13 13:09:19 -07:00
Strahinja Val Markovic
d56ec1ea7a ycmd's JSON interface now uses 1-based indices
This makes far more sense because editors manipulate user-level errors/warnings
on a 1-based system, not a 0-based one.
2014-05-09 15:57:04 -07:00
Strahinja Val Markovic
9cf566bd8f Renamed GoToDefinitionElseDeclaration to GoTo
The old name still works for the sake of backwards compatibility.
2014-03-21 11:34:00 -07: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
b9bb788a2a Diagnostics work again... somewhat.
There appear to be timing issues for the diag requests. Somehow, we're sending
out-of-date diagnostics and then not updating the UI when things change.

That needs to be fixed.
2013-10-07 11:03:29 -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
4a95c2fc7c GoTo commands for clang completer work again 2013-10-07 11:03:27 -07:00
Strahinja Val Markovic
fe0c0a1607 GoTo commands work again 2013-10-07 11:03:27 -07:00
Strahinja Val Markovic
387621d957 Moving SendCommandRequest into appropriate module 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