Commit Graph

2342 Commits

Author SHA1 Message Date
Homu
285c452831 Auto merge of #2029 - micbou:timeout-exception, r=Valloric
[READY] Catch ReadTimeout exception on requests

In PR #2016, we have changed the way we are catching exceptions on requests by only catching the `ServerError` instead of all exceptions, which is great for debugging purposes. However, due to this change, we don't catch the exception from a timed out request, leading to a ugly traceback in Vim. This PR fixes that.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2029)
<!-- Reviewable:end -->
2016-03-06 07:05:36 +09:00
Homu
190adeade6 Auto merge of #2027 - puremourning:readme-all-install, r=micbou
[READY] Add --all option to README

# PR Prelude

Thank you for working on YCM! :)

**Please complete these steps and check these boxes (by putting an `x` inside
the brackets) _before_ filing your PR:**

- [X] I have read and understood YCM's [CONTRIBUTING][cont] document.
- [X] I have read and understood YCM's [CODE_OF_CONDUCT][code] document.
- [X] I have included tests for the changes in my PR. If not, I have included a
  rationale for why I haven't.
- [X] **I understand my PR may be closed if it becomes obvious I didn't
  actually perform all of these steps.**

# Why this change is necessary and useful

I use the `--all` flag for every build. I know this is probably a flag that's more useful for YCM contributors than most users, but it makes sense to document it.

# No tests

It's only an update to the README, so I just tested it by eyeballing the output.

[cont]: https://github.com/Valloric/YouCompleteMe/blob/master/CONTRIBUTING.md
[code]: https://github.com/Valloric/YouCompleteMe/blob/master/CODE_OF_CONDUCT.md

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2027)
<!-- Reviewable:end -->
2016-03-06 06:37:46 +09:00
micbou
f6d5f68d6b Catch ReadTimeout exception on requests 2016-03-05 22:34:45 +01:00
Ben Jackson
3b6b949bb3 Update README to include --all flag 2016-03-05 21:31:32 +00:00
Homu
d4f8c1d404 Auto merge of #2016 - Valloric:py3, r=micbou
[READY] Making YCM run in Vim with only python3

Since https://github.com/Valloric/ycmd/pull/358, ycmd has supported Python 3. Now's the time to make the YCM client work in Python 3 too. As with the ycmd PR, **until we merge this, no other code-changing PR should be merged.** We need to get to a state where we have green Travis for Python 3 before any other PRs start landing.

This was substantially easier than porting ycmd, but it was still a massive pain. It's likely to fail in certain corner cases, so please give this a spin!

The best way to test it out is to build a Vim that has only Python 3 support. Our wiki page on [building Vim from source](https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source) is a great start; you'll probably need to change `--enable-pythoninterp` to `--enable-python3interp` and similar for `--with-python-config-dir`. Or just get yourself a beta image of Ubuntu 16.04 LTS and run it in a VM (16.04 doesn't even ship Python 2 in the base image!). You can verify that you're running the right Vim by looking at the output of `vim --version`. It should have `-python` and `+python3`.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2016)
<!-- Reviewable:end -->
2016-03-06 03:25:31 +09:00
Val Markovic
0bcecb14d8 Fixing conversion bug in VimExpressionToPythonType
Bug was that objects other than strings/bytes were being converted to
strings. Also added tests.
2016-03-05 10:16:08 -08:00
Val Markovic
7b9b5ac688 Updating readme with more python3 info
New entry in the FAQ for ImportError exceptions and the installation
sections now also recommend python3 dev headers.
2016-03-04 19:48:49 -08:00
Val Markovic
74f5e5ef34 Using non-emacs version of python coding line 2016-03-02 18:12:38 -08:00
Val Markovic
07b9e6a68d Update to latest ycmd 2016-03-02 18:09:59 -08:00
Val Markovic
80631b1aaf Enforcing unicode in more vimsupport functions 2016-03-01 19:30:02 -08:00
Val Markovic
0187c6df5b Fixing minor typos 2016-03-01 19:30:02 -08: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
0ed1096040 Support multiline exception message
Also stopped adding the "ycmd exception:" prefix to error messages
because it lies; some exceptions hitting this may not come from ycmd.
2016-03-01 19:29:21 -08:00
Val Markovic
94ec3ed902 Merge pull request #2020 from micbou/readme
[READY] Fix installation entries and links in README
2016-02-29 11:44:14 -08:00
micbou
ecdb97b71c Fix installation entries and links in README 2016-02-29 20:36:58 +01:00
micbou
f981370965 Fix CheckFilename test on Windows and Py2
On Windows and Python 2, the full exception message from IOError
in CheckFilename will contain the filepath formatted as a unicode
string. Since the filepath is already added in the RuntimeError
message, use the strerror attribute to only display the error.
2016-02-29 20:06:01 +01:00
micbou
1b0a8ea6e8 Update AppVeyor configuration
Create AppVeyor batch script and move CI scripts to a separate folder.
2016-02-29 20:06:01 +01:00
micbou
fae95812dc Simplify YouCompleteMe test
Add missing python-future boilerplate.
2016-02-29 20:06:01 +01:00
micbou
b78c403cfe Clean up YCM object in PostComplete tests
Move PostComplete tests inside a class that defines setUp and tearDown
methods. Clean YCM object in tearDown method. This fixes the error
"OSError: [WinError 6] The handle is invalid" on Windows with
Python 3.5.
2016-02-29 20:06:01 +01:00
Val Markovic
eb8a24f23d Addressing review comments 2016-02-29 10:26:50 -08:00
Val Markovic
5b61b34703 Updating to latest ycmd 2016-02-28 20:24:53 -08:00
Val Markovic
1c65c96e65 Fixing bad comparison causing ToggleLogs to fail
`is` in Python checks for identity, not equality.
2016-02-28 20:24:53 -08:00
Val Markovic
ba97a28b62 Our Travis config now supports py3 2016-02-28 20:24:53 -08:00
Val Markovic
be1bb3617d Minor tweaks 2016-02-28 19:23:40 -08:00
Val Markovic
3dbbfc3c25 Updating docs to state python3 support! 2016-02-28 19:23:40 -08:00
Val Markovic
8c0192ecf7 Can now select python3 for running ycmd 2016-02-28 19:23:40 -08:00
Val Markovic
d340ed5dc8 Fixing retries.py so that it works in py3 2016-02-28 19:23:40 -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
43b2dd44f2 Ensuring vimsupport only returns unicode text
Python 3 is much stricter around mixing bytes with unicode (and by
"stricter," I mean it doesn't allow it at all) so we're making
vimsupport only return `unicode` objects (`str` on py3). The idea is
that YCM (and ycmd) internals only ever deal with unicode.
2016-02-28 19:23:40 -08:00
Val Markovic
123c5c4acb Fixing ycmd startup under py3
Some syntax rules are different for py3 plus the standard bytes vs
unicode nonsense.
2016-02-28 14:41:09 -08:00
Val Markovic
92346d2bcc Import order fixes for py3
The import machinery works differently in py3, so some massaging is in
order.
2016-02-28 14:39:55 -08:00
Val Markovic
1e72f4d421 Making it clearer an exception came from ycmd
Makes debugging easier when you know where the error lies.
2016-02-28 14:38:23 -08:00
Val Markovic
b04870c824 VimL support for py3 2016-02-28 13:54:49 -08:00
Val Markovic
1941d8bfb2 Fixing issues with bytes vs unicode for hmac 2016-02-27 17:38:38 -08:00
Val Markovic
4e82409cc1 Futurize pass + manual fixes 2016-02-27 16:12:44 -08:00
Homu
72b08862d3 Auto merge of #2011 - micbou:readme, r=micbou
[READY] Fix entries in table of contents

Rename entries of `YcmCompleter subcommands` section in table of contents so that they correspond to their sections title. Add `Miscellaneous commands` missing entry.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2011)
<!-- Reviewable:end -->
2016-02-28 05:28:47 +09:00
micbou
df8a52671d Fix table of contents
Make headings and TOC entries have the same text.
Use Title Case for TOC entries.
Add "Miscellaneous commands" and "Functions" entries.
Set "And That's not all..." heading in bold instead.
Move "Diagnostic highlighting groups" to a third-level entry.
2016-02-27 18:43:59 +01:00
Homu
cb8607796e Auto merge of #2004 - Valloric:new-omni, r=micbou
[READY] Updating to latest ycmd

This includes the using the new API for OmniCompleter.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2004)
<!-- Reviewable:end -->
2016-02-27 08:28:18 +09:00
Val Markovic
71c7a81e42 Updating to latest ycmd 2016-02-26 15:23:20 -08:00
Homu
27f391089c Auto merge of #2005 - micbou:new-omni-ycm-core-test, r=micbou
[READY] Add test to check if ycm_core is not imported

See PR #2004.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2005)
<!-- Reviewable:end -->
2016-02-26 05:18:01 +09:00
micbou
298c318bc7 Add test to check if ycm_core is not imported 2016-02-25 02:17:57 +01:00
Val Markovic
fd0c2cc1d8 Updating to latest ycmd
This includes the using the new API for OmniCompleter.
2016-02-24 17:10:13 -08:00
Homu
35f6090b76 Auto merge of #1994 - micbou:set-up-python, r=vheon
[READY] Rewrite SetUpPython function

This PR fixes issue #1726 by moving most of SetUpPython logic to its own module and using a try-catch-else block at the end of the function. It also prevents Python backtraces in Vim (which are really annoying) for common exceptions (`RuntimeError` and `ImportError`).

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1994)
<!-- Reviewable:end -->
2016-02-25 06:12:17 +09:00
micbou
3cf6fa86f5 Rewrite SetUpPython function
Do not create YouCompleteMe object if setup failed. Use a try/except
block to prevent backtraces in Vim.
2016-02-24 17:56:31 +01:00
Homu
e2452b6594 Auto merge of #1995 - Valloric:ycmd-update, r=vheon
[READY] Updating to latest ycmd

Still using ycmd only in py2, but at least we can use YCM with ycmd master again.

@micbou @puremourning @vheon Try to give this one a whirl on your machines since ycmd had a ton of recent changes.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1995)
<!-- Reviewable:end -->
2016-02-24 07:47:16 +09:00
Val Markovic
f986bf19db Updating to latest ycmd 2016-02-22 09:50:15 -08:00
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