Commit Graph

1680 Commits

Author SHA1 Message Date
Homu
65cc309421 Auto merge of #1762 - puremourning:test-on-osx, r=micbou
Run tests on OS X

There should be no difference between the behaviour on OS X and the behaviour on other platforms as all of the tests are python. However, running them is cheap and proves that there are no differences.

The approach is to import the scripts from `ycmd` with a couple of modifications:
     - don't set `YCM_CORES=1` as we didn't before, and this makes the build a lot faster
     - don't install `gcc-4.8` as we didn't before
     - install `argparse` for the tests as it is not available in python2.6

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1762)
<!-- Reviewable:end -->
2015-11-09 08:29:46 +09:00
Ben Jackson
90dc6fdae5 Correct import of argparse 2015-11-08 23:09:41 +00:00
Ben Jackson
0639200153 Run tests on OS X
We import the scripts from ycmd with a couple of modifications:
 - don't set YCM_CORES=1 as we didn't before, and this makes the build a lot faster
 - don't install gcc-4.8 as we didn't before
 - install argparse as it is not available in python2.6
2015-11-08 22:07:45 +00:00
micbou
26a18643ee Update contribution guidelines 2015-11-08 18:43:52 +01:00
micbou
b3c9f3ffc1 Add :YcmToggleLogs documentation 2015-11-08 18:43:52 +01:00
micbou
cbe3e04745 Add :YcmToggleLogs command 2015-11-08 18:43:52 +01:00
micbou
f23cbae2a8 Add tests for Vim file and buffer operations
Refactor Vim mocking.
2015-11-08 18:43:52 +01:00
Homu
59b91817a0 Auto merge of #1761 - micbou:appveyor, r=puremourning
Fix AppVeyor configuration

AppVeyor certainly made some changes to their infrastructures because the `run_tests.py` script is not properly executed anymore. We now need to specifically call it with python.

This is already done in the `ycmd` repository so no changes needed there.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1761)
<!-- Reviewable:end -->
2015-11-09 02:30:55 +09:00
micbou
ea62d08ecd Fix AppVeyor configuration
We need to explicitly call the run_tests script with python. Otherwise,
the script is not properly executed.
2015-11-08 18:03:01 +01:00
Homu
0352ed9b1f Auto merge of #1753 - micbou:remove-vim-stdout-option, r=Valloric
Remove g:ycm_server_use_vim_stdout option

The `g:ycm_server_use_vim_stdout` option is not working like expected. ycmd logs are not written to the console when using the gui client with this option enabled. This is the case on Windows and I think @puremourning can confirm this on other platforms. Worse, it also makes the ycmd server unresponsive on Windows.

It's a big issue because we recommend to use this option in [CONTRIBUTING.md](https://github.com/Valloric/YouCompleteMe/blob/master/CONTRIBUTING.md).

This PR removes the option and updates the contribution guidelines by asking the user to put the `let g:ycm_server_keep_logfiles = 1` option instead.

To further improve the debugging process, I would like to add a new command `:YcmToggleLogs` (thanks to @puremourning for the idea) that automatically open or close the ycmd stdout and stderr logs as windows in Vim. If you agree, I'll send another PR adding the command.

Note: if you are wondering why the ycmd stdout logs are always empty while you are adding print statements in the ycmd code, this is because the output needs to be flushed: `sys.stdout.flush()`.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1753)
<!-- Reviewable:end -->
2015-11-02 03:45:39 +09:00
micbou
186aa6b671 Remove g:ycm_server_use_vim_stdout option
This option does not work like expected. Logs are not written to the
console. It also makes the ycmd server unresponsive on Windows.
2015-10-27 18:19:22 +01:00
Homu
f20c69321d Auto merge of #1742 - micbou:documentation, r=Valloric
Add an entry for Fedora installation in README.md

Following PR #1740. Update the Vim documentation.

Maybe we should remove the `super-quick` in the titles to make them shorter and be consistent with the others. I'll update the PR if you agree.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1742)
<!-- Reviewable:end -->
2015-10-25 07:38:40 +09:00
micbou
de06e22a02 Update installation titles 2015-10-24 20:34:31 +02:00
micbou
2084ee2909 Add Fedora entry in README.md
Update Vim documentation
2015-10-23 15:08:48 +02:00
Homu
b1f2171f9f Auto merge of #1740 - rjleaf:patch-1, r=Valloric
Fedora documentation with required dependencies. Works on F22.



<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1740)
<!-- Reviewable:end -->
2015-10-23 13:30:14 +09:00
Ryan Leaf
234fd5acb8 Fedora documentation with required dependencies. Works on F22. 2015-10-21 18:19:27 -04:00
Homu
dec2287638 Auto merge of #1738 - micbou:goto-include, r=vheon
Add GoToInclude documentation and update to latest ycmd

This PR closes #334.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1738)
<!-- Reviewable:end -->
2015-10-21 02:46:57 +09:00
micbou
e7c7e4fe84 Update to latest ycmd
This closes #334.
2015-10-20 15:17:13 +02:00
micbou
570444fc5a Add GoToInclude subcommand to documentation 2015-10-20 15:06:49 +02:00
Homu
76ff85bf75 Auto merge of #1727 - micbou:vim-commands, r=Valloric
Define Vim commands only if setup is successful

Vim commands (`YcmDebugInfo`, `YcmCompleter`, etc.) should not be defined if an error is encountered when processing the `s:SetUpPython` function. Why? Because those commands will return errors like `name 'ycm_state' is not defined`.

Note: due to an unexpected behavior, those commands work fine when libraries are found outdated. See issue #1726.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1727)
<!-- Reviewable:end -->
2015-10-19 04:04:48 +09:00
Homu
2bc1ec80be Auto merge of #1724 - mkevac:patch-1, r=Valloric
Add notice to FAQ about ctags and C projects



<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1724)
<!-- Reviewable:end -->
2015-10-19 04:02:26 +09:00
Homu
a0817e6f9c Auto merge of #1732 - davits:master, r=Valloric
Fix rare crash when trying to jump to file which has .swp

One of my coworkers found this crash today. Usually he opens a lot of gvim-s and forgets about them, and eventually one of GoToDefinition commands backfired :)

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1732)
<!-- Reviewable:end -->
2015-10-19 04:00:16 +09:00
Davit Samvelyan
cb3325970e Refactoring 2015-10-14 11:37:33 +04:00
Davit Samvelyan
a0495a994e Fix for rare crash when trying to jump to file which has .swp 2015-10-13 18:46:20 +04:00
Marko Kevac
410282830b Don't say that language tag is wrong 2015-10-12 19:32:41 +03:00
Marko Kevac
72fe806dc3 Add notice to FAQ about ctags and C projects 2015-10-12 19:16:04 +03:00
micbou
290a65219f Define Vim commands only if setup is successful 2015-10-12 15:27:30 +02:00
Homu
d98298ab87 Auto merge of #1720 - micbou:windows-documentation, r=Valloric
Add Windows documentation

This is the first draft of the official Windows documentation.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1720)
<!-- Reviewable:end -->
2015-10-12 01:35:42 +09:00
micbou
2ace4eea88 Add Windows documentation 2015-10-11 15:22:04 +02:00
Homu
7bf39973c1 Auto merge of #1719 - micbou:path-to-python-interpreter, r=puremourning
Move PathToPythonInterpreter function from ycmd to YouCompleteMe

This function contains mostly Vim-specific code and is only used in YouCompleteMe so we move it in vimsupport.py file.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1719)
<!-- Reviewable:end -->
2015-10-10 23:31:35 +09:00
micbou
87854f0245 Move PathToPythonInterpreter function to YCM
Create a module for paths.
2015-10-09 18:53:24 +02:00
Homu
5a186275a5 Auto merge of #1701 - puremourning:getdoc-readme, r=Valloric
Declare support for GetDoc subcommand

Fixes https://github.com/Valloric/YouCompleteMe/issues/1653

This change:
* updates the `README.md` and vim help
* updates the `ycmd` submodule to latest master, which includes `GetDoc` subcommand

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1701)
<!-- Reviewable:end -->
2015-09-25 11:14:24 +09:00
Ben Jackson
e137427a51 Udpdate ycmd to latest to add GetDoc subcommand 2015-09-24 22:25:42 +01:00
Ben Jackson
3ddc2fcbee Update documentation to add GetDoc subcommand 2015-09-24 22:25:27 +01:00
Homu
d4e9d4d1a3 Auto merge of #1698 - micbou:windows-appveyor, r=Valloric
[Windows support] Add AppVeyor configuration

@Valloric you need to add the YouCompleteMe project in your AppVeyor account. I'll update the badge.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1698)
<!-- Reviewable:end -->
2015-09-22 11:15:28 +09:00
micbou
9750835cf0 Add AppVeyor configuration 2015-09-22 04:12:46 +02:00
Homu
2816559ee4 Auto merge of #1694 - puremourning:detailed-info-subcommands, r=Valloric
Allow subcommands to display information in the preview window

References
====

https://github.com/Valloric/YouCompleteMe/issues/1653

There will be some PRs coming to ycmd that will supply documentation in this format

Background
====

This adds support to YCM for displaying "detailed info" (e.g. quick-info, documentation, etc.) from a completer subcommand response. We display the info in the preview window.

Technical notes
====

Use of the preview window
----

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 (although, Vim fixes the preview window height to 3 in that case).

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. 


 `wincmd P` etc.
---

The approach in `vimsupport.py` of jumping around with `wincmd P` and `wincmd p` was taken pretty much directly from vim's `:help preview-window` (specifically `:help CursorHold-example`), so while ugly it is apparently the 'recommended' way.

`vim` module mocking
----

I had to change the way we were mocking the `vim` module in the tests. From the commit message:

    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, imported by any
    tests which require fiddling with it. This should hopefully help testing going
    forwards.

I committed this separately to help review (hopefully).
2015-09-21 12:50:20 +09: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
Homu
04850041b9 Auto merge of #1680 - puremourning:quick-feature-summary, r=Valloric
Add super-quick feature summary by completer

I never got time to do the larger revamp of the README.md, but I thought a super-quick summary would be useful, as I'm about to add yet-another subcommand to a bunch of completers.
2015-09-20 02:48:07 +09:00
Ben Jackson
449b6fbb9f Add super-quick feature summary by completer 2015-09-19 12:41:09 +01:00
Strahinja Val Markovic
a7bb97f100 Updating to latest ycmd 2015-09-16 18:49:33 -07:00
Homu
61a5a9b84b Auto merge of #1689 - bronzehedwick:patch-1, r=micbou
Add VimL syntax highlighting to Readme
2015-09-16 06:08:33 +09:00
Chris DeLuca
1eafd4981d Add VimL syntax highlighting to Readme 2015-09-15 14:57:34 -04:00
Homu
e60fa3f138 Auto merge of #1679 - puremourning:typescript-subcommands, r=Valloric
Update subcommmands supported for typescript

Noticed that the subcommands supported by typescript are not listed. Updated the docs and ran

```
vim-tools/html2vimdoc.py -f youcompleteme README.md > doc/youcompleteme.txt
```
2015-09-15 13:03:30 +09:00
Homu
0d426e4922 Auto merge of #1636 - mispencer:CsAddImport, r=puremourning
Add required namespace in C# after completing

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.

Demo:
![c namespaceinsertdemo](https://cloud.githubusercontent.com/assets/1434266/9337289/b7994542-459b-11e5-8f52-e48af76a3aab.gif)

By default, the using statement is inserted after the last using statement. If there aren't any, it's inserted before the first line. This behavior is customization by setting a function to the vim global ``g:ycm_cs_insert_namespace_function``. I implemented this in pure vimscript largely so I could provide such customization...

Caveats: vim does not provide a way to get which completion was inserted. To get this, we store the completions, hook the CompleteDone event, and check than if the preceding text matches any of the completions. This is imperfect, and sometimes matches when it shouldn't. Also, the CompleteDone event requires 7.3.598 or newer.
2015-09-14 00:48:30 +09:00
Spencer G. Jones
bb21150798 Fix merge test failure 2015-09-13 08:57:09 -06:00
Spencer G. Jones
2a41101955 Merge remote-tracking branch 'origin/master' into CsAddImport 2015-09-13 08:49:28 -06:00
Ben Jackson
7c2b7b7ef3 Update subcommmands supported for typescript 2015-09-13 13:01:11 +01:00
Homu
a4f7d02a3b Auto merge of #1676 - micbou:fix-it-chunks-sorting, r=Valloric
Correct FixIt chunks sorting

While playing with FixIts in C++, I found the following issue. When fixing the third line in the code:
```cpp
template<int Value> struct CT { template<typename> struct Inner; };

CT<10 >> 2> ct; // expected-warning{{require parentheses}}
```
the following result is obtained:
```cpp
CT<1(0 >> 2)> ct; // expected-warning{{require parentheses}}
```
which is obviously wrong.

The issue is YouCompleteMe does not replace the chunks in the right order. It starts by adding the closing parenthesis, add one to the delta and inserts the opening parenthesis in the wrong place cause of the delta.

We actually use the expression `str(line) + ',' + str(column)` to sort the chunks by line then column whereas it should simply be `(line, column)`.

This PR fixes this issue, adds two tests which are failing in the current version, refactors the `_HandleFixitResponse` function and cleans up code.
2015-09-13 13:48:54 +09:00
Homu
9d8e85d363 Auto merge of #1677 - puremourning:add-clang-brief-to-preview, r=Valloric
Show docs from clang completer in preview window

Fixes https://github.com/Valloric/YouCompleteMe/issues/106

We add the detailed_info (which is the function definiton) followed by the brief comment if supplied.

I added a test for the method, which is now reasonably complex.
2015-09-13 13:28:09 +09:00