Commit Graph

1696 Commits

Author SHA1 Message Date
Homu
be0de73c42 Auto merge of #1917 - puremourning:fixit-multiple-files-upstream, r=Valloric
[READY] Support FixIt and Refactor commands across multiple files

## Apply FixIt chunks across files

Previously, FixIts could only apply to the current buffer. Now we can apply FixIts across files, even if they are not currently open in the user's Vim. We obey existing configuration about how/where to open new files and apply changes in such a way as to not scribble the user's filesystem, and allow full undo history, like existing FixIt commands. Vim's python API actually makes this really quite easy.

To achieve this, we sort the chunks by filename, apply the existing logic unchanged. The only difference is that `ReplaceChunk` no longer implicitly assumes it applies to `vim.current.buffer`.

## Recognise 'FixIt' responses for any subcommand

Previously, we used the subcommand name to determine the type of response to expect. This coupled the client and the server and didn't allow us to apply FixIts for a "Refactor" command, or "GoTo" for a, theoretical "Find" command.

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.

## Other changes

The `vimsupport.OpenFilename` method needed to handle the presence of Vim swap files and the various user responses. This pushed the cyclomatic complexity over the threshold, so the code was partially obfuscated to accommodate the cyclomatic complexity gods.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1917)
<!-- Reviewable:end -->
2016-02-22 07:18:00 +09:00
Val Markovic
6e0e128d4b Merge pull request #2003 from Valloric/templates
[READY] Templates for new issues and PRs
2016-02-21 14:05:34 -08:00
Ben Jackson
e8de632b90 Add docs for RefactorRename
Additionally, we restructure subcommands section to organise by
command type.

There are now a significant number of subcommands offering quite
powerful features. A flat-list of such commands is not easy for users to
discover (citation needed). Restructured into:
 - GoTo commands
 - Documenation/type information commands
 - FixIt/refactor commands

This has the following benefits:
 - features are more discoverable to the user (due to contents page
   update)
 - more obvious where to add new subcommand documentation
 - a place to write notes which apply to multiple commands (such as
   jump lists, multi-file refactor)
2016-02-21 22:02:33 +00: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
Val Markovic
f8512e7007 Templates for new issues and PRs 2016-02-21 13:43:33 -08:00
Homu
7b8b1acb5e Auto merge of #1905 - davits:easy_handler, r=Valloric
[READY] Simplify parse request handling

Moved file parse request handling into python, trying to simplify the overall flow, and allow easier additions of additional post handlers such as semantic token extraction.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1905)
<!-- Reviewable:end -->
2016-02-22 03:56:58 +09:00
Davit Samvelyan
4d97437872 Moved parse request and diagnostics handling to python.
Moved File parse request handling and diagnostic extraction flow into
python to simplify flow and allow easier addition of new parse request
handlers such as semantic highlighter.
Refactored base_test to patch separate vimsupport functions instead of
the whole module, and interfering the test results afterwards.
Added new tests for diagnostic sign place/unplace and error/warning
count extraction API.
2016-02-21 14:47:54 +04:00
Homu
8ad4044203 Auto merge of #1990 - micbou:readme-ycmd-link, r=vheon
[READY] Add links to ycmd repository in README

Found this while reading the documentation. There is no `ycmd` reference so it is displayed as `[ycmd][]`.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1990)
<!-- Reviewable:end -->
2016-02-18 06:57:03 +09:00
micbou
60b101f3ba Add reference to ycmd in README 2016-02-17 20:15:36 +01:00
Homu
d9c7eebe85 Auto merge of #1988 - mispencer:RemoveOldC#Document, r=micbou
Remove C# Diagnostic Support documentation note

This hasn't been true since [ycmd pull request #44](https://github.com/Valloric/ycmd/pull/44).

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1988)
<!-- Reviewable:end -->
2016-02-17 17:57:04 +09:00
Spencer G. Jones
308cf4b653 Remove C# Diagnostic Support documentation note
This hasn't been true since ycmd pull request #44.
2016-02-16 19:27:26 -07:00
Homu
3e748deaec Auto merge of #1965 - micbou:go-documentation, r=puremourning
[READY] Update Go documentation with GoTo subcommands

This also updates to latest ycmd. Changes that affect the client:
 - update racerd;
 - add GoTo support for Go completer;
 - add concurrent requests for Typescript completer;
 - fix issue #1953;
 - add GoToReferences support for Typescript completer.

I changed the filetypes lists to be in alphabetical order, except the C-family languages.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1965)
<!-- Reviewable:end -->
2016-02-08 07:46:04 +09:00
micbou
716d0c974f Update Go documentation 2016-02-07 20:28:41 +01:00
micbou
d534afbe23 Update to latest ycmd
List of changes:
 - update racerd;
 - add GoTo support for Go completer;
 - add concurrent requests for Typescript completer;
 - fix issue #1953;
 - add GoToReferences support for Typescript completer.
2016-02-07 20:27:08 +01:00
Homu
b8ec993c0a Auto merge of #1964 - icholy:master, r=micbou
Update readme with typescript GoToReferences subcommand

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1964)
<!-- Reviewable:end -->
2016-02-08 03:59:00 +09:00
Ilia Choly
ef47aba62a Update vimdoc 2016-02-06 16:24:47 -05:00
Ilia Choly
66155c3de2 Update readme with typescript GoToReferences subcommand 2016-02-06 14:41:03 -05:00
Homu
a2f0ec1624 Auto merge of #1962 - micbou:python-env, r=Valloric
[READY] Remove interpreter line from Python sources

See PR Valloric/ycmd#346.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1962)
<!-- Reviewable:end -->
2016-02-06 02:15:57 +09:00
micbou
4835b49a89 Remove interpreter line from Python sources 2016-02-05 16:24:03 +01:00
Homu
674db42eef Auto merge of #1954 - micbou:documentation-make-confusion, r=vheon
[READY] Avoid confusion with make command

This sentence may be interpreted as executing the `make` command to move the libaries. See issue #1951. We *make* it clear by using `cmake` instead.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1954)
<!-- Reviewable:end -->
2016-02-04 02:48:45 +09:00
micbou
2cd3d1b9d3 Avoid confusion with make command 2016-02-03 17:51:35 +01:00
Homu
8ee365356f Auto merge of #1928 - vheon:custom-python-jedi, r=puremourning
[READY] Update documentation of latest python completer

I've just wrote down the first things that came to mind. So any feedback on which part to expand or fix is appreciated. Specifically I don't know if would be useful to the user to know that JediHTTP exists and what it does. I fear that explaining would do more harm than good 😕

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1928)
<!-- Reviewable:end -->
2016-02-03 08:20:50 +09:00
Andrea Cedraro
581f58add6 Update documentation of latest python completer 2016-02-03 00:12:00 +01:00
Homu
e66d1f1ddd Auto merge of #1922 - Chiel92:patch-1, r=micbou
Add notes to readme according to #1891.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1922)
<!-- Reviewable:end -->
2016-01-31 10:28:11 +09:00
Chiel ten Brinke
833d30eda8 Update vim docs. 2016-01-29 10:40:34 +01:00
Chiel ten Brinke
40db3c0865 Merge https://github.com/Valloric/YouCompleteMe into patch-1 2016-01-29 09:53:01 +01:00
Chiel ten Brinke
d6ebef3c8d Address review comments. 2016-01-29 09:48:24 +01:00
Strahinja Val Markovic
5ee7bd2c80 Updating TOC in README 2016-01-26 15:54:44 -08:00
Strahinja Val Markovic
0efa668931 Adding an explicit Contributor Code of Conduct
Everything in the CoC was true since the beginning of the project, it
was just implicit and not written down. Now we're making it explicit.
2016-01-26 15:49:58 -08:00
Chiel ten Brinke
4afcbee4a1 Adress minor improvement suggestions. 2016-01-25 10:47:59 +01:00
Chiel ten Brinke
8ebcdb491a Improve the solution for error R6034. 2016-01-25 10:37:08 +01:00
Homu
1201115141 Auto merge of #1927 - micbou:event-notification-test, r=Valloric
[READY] Fix issue in EventNotification tests

While I was reviewing PR #1905, I found an issue with the `EventNotification` tests. It's easy to reproduce. You just need to comment [this line in `python/ycm/youcompleteme.py`](https://github.com/Valloric/YouCompleteMe/blob/master/python/ycm/youcompleteme.py#L508) and run the tests. With this change, the `EventNotification` tests should fail since the second call of `ValidateParseRequest` re-raises the warning. However, tests are still passing because `assert_has_calls` does not check if a call was not made. For example, if `functionA` is called twice, both `assert_has_calls( [ functionA ] )` and `assert_has_calls( [ functionA, functionA ] )` are successful.

To fix this, we just need to check the number of calls using `call_count`. This is done by creating a subclass of `MagicMock` implementing the `assert_has_exact_calls` method and using it in tests.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1927)
<!-- Reviewable:end -->
2016-01-25 08:26:15 +09:00
Homu
8d5f164feb Auto merge of #1896 - micbou:path-to-python-interpreter, r=Valloric
[READY] Implement new strategy to find the Python interpreter path

See discussion in issue #1891 for details.

Implement a new strategy to find the Python interpreter path:
  - if specified, use `g:ycm_path_to_python_interpreter` option.
  - on UNIX platforms, use `sys.executable` as the path to Python interpreter;
  - on Windows, deduce it from `os.__file__` path (it should always be in the parent folder).

In all cases, check the version (2.6 or 2.7) of the Python interpreter path by running it.

This PR may break things. It needs thorough testing.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1896)
<!-- Reviewable:end -->
2016-01-25 08:24:34 +09:00
micbou
a0943d5d31 Fall back to Python search in PATH 2016-01-23 16:59:13 +01:00
micbou
c92b4ac0ff Fix issue in EventNotification tests
assert_has_calls is not enough to check if a call didn't raise a
warning. We also need to check the number of calls. This is done by
creating a subclass of MagicMock implementing the
assert_has_exact_calls method.
2016-01-21 03:05:15 +01:00
Homu
d05bf551a6 Auto merge of #1929 - micbou:appveyor, r=puremourning
[READY] Update get-pip.py script URL on AppVeyor

This fixes the following error on AppVeyor:
```
You're using an outdated location for the get-pip.py script, please use the one available from https://bootstrap.pypa.io/get-pip.py
```

I also changed the way `get-pip.py` is downloaded. This is now done like in the `ycmd` repository.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1929)
<!-- Reviewable:end -->
2016-01-20 16:28:18 -08:00
micbou
bdf09a7537 Update get-pip.py script URL on AppVeyor
Update also the way get-pip.py script is downloaded.
2016-01-20 22:03:11 +01:00
Homu
f691a5f513 Auto merge of #1916 - mispencer:AddMissingOmniImplemention, r=micbou
Add missing implementation on OmniCompletionRequest

OmniCompletionRequest is missing the RawResponse method, so any attempt to call
it calls the base class method instead. However, since the data structures of
this class and base class are different, this causes an error.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1916)
<!-- Reviewable:end -->
2016-01-18 18:57:22 -08:00
Chiel ten Brinke
01edabda37 Add notes to readme according to #1891. 2016-01-18 10:21:22 +01:00
Spencer G. Jones
c2d473c4ba Add missing implementation on OmniCompletionRequest
OmniCompletionRequest is missing the RawResponse method, so any attempt to call
it calls the base class method instead. However, since the data structures of
this class and base class are different, this causes an error.
2016-01-16 11:36:58 -07:00
Homu
e5e5a6aa7a Auto merge of #1900 - oblitum:update-ycmd, r=Valloric
Updating to latest ycmd

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1900)
<!-- Reviewable:end -->
2016-01-13 13:35:37 +09:00
Francisco Lopes
6f43e32004 Updating to latest ycmd 2016-01-13 00:51:13 -02:00
Homu
ea3e207643 Auto merge of #1899 - oblitum:empty-insertion-text, r=oblitum
Allows empty insertion text.

This is useful for hints for example, whose purpose is information
display solely.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1899)
<!-- Reviewable:end -->
2016-01-13 11:24:41 +09:00
Homu
aed1d817a4 Auto merge of #1898 - mispencer:DontCacheAvailableCheckErrors, r=micbou
Don't cache invalid completer check results

[Lets try this again](https://github.com/Valloric/YouCompleteMe/pull/1897#issuecomment-170978003)

If the check for available completers isn't run because the server isn't
alive, or the check request erred or times out, don't cache the result. Only
cache valid returns.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1898)
<!-- Reviewable:end -->
2016-01-13 08:55:32 +09: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
Spencer G. Jones
1f868a8b47 fixup! Don't cache invalid completer check results 2016-01-12 15:15:29 -07:00
micbou
9a27c990db Fix typo in test 2016-01-12 22:51:15 +01:00
micbou
1cdbe4a770 Add python3 failing tests 2016-01-12 22:48:48 +01:00
micbou
a80846e35d Check Python interpreter pathname
Rename CheckPythonVersion to IsPythonVersionCorrect.
In embedders, sys.executable may contain a Vim path instead of a Python
one. To avoid starting a Vim instance in this case, we check that given
path ends with a Python 2.6 or 2.7 name using a regex.
Add tests for this regex.
2016-01-12 22:36:31 +01:00