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.
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.
Fixing install script
Fixing issue #1645 where the `subprocess.call` was being incorrectly used, preventing install. Also made `install.py` be executable so that you can run it directly from shell instead of having to execute `python install.py`
Translate the install.sh script in python to make it platform independent.
Keep install.sh as a wrapper of install.py to not break scripts that
depend on it.
Removed the bash dependency that install.sh had
People like me use YCM on machines that don't have bash, and it's nice to not have to add it unnecessarily. This removes the bash dependency for installation.
If errors are returned in addition to completion suggestions, print them
Needed for https://github.com/Valloric/ycmd/pull/198
This maintains the previous client behaviour when the semantic completer throws an exception.
[RFC] YCM Client support for FixIt commands
This change provides the client-side support in YouCompleteMe for vim providing a new :YcmFixIt command which applies changes to the vim buffer to implement trivial fixes to common coding errors where the completer provides instructions on how to fix a diagnostic. A note is added "(FixIt)" to the diagnostic text echo'd in vim when a FixIt is available.
While this may seem out of the scope of ycmd/YouCompleteMe (as a completion engine), I think it is a really useful feature, and provided straight out of libclang. so I'm sending this slightly incomplete PR (along with the associated ycmd change) to see what the appetite is within the user and maintainer community, and to get feedback on the approach.
I know that I need to write some tests, and perhaps tidy up some TODOs, but I would really appreciate any feedback on the approach. Also, I should confess that I haven't yet run the existing tests as I'm having trouble getting them to run on my mac. Hoping that travis will help me out :)
I know I also need to update the readme.
Testing has been performed manually by going through the list of .c, .cpp and .m files in clang's tests/FixIt folder and ensuring that by hitting :YcmFixIt (actually "@:" a lot!) on each diagnostic, the diagnostic went away (assuming a FixIt was available). I also mangled a number of the clang test such that the fix was spread across multiple lines, etc.
I also haven't tested this with completers other than clang completer (due to having trouble one with diagnostics getting them to work) , but of course I will prior to this being ready to merge.
I also understand that adding the vim modelines might be divisive, but the standard in this project doesn't match my usual setting :) Happy to remove them if people react angrily.
Once again thanks for the time and a great (and improving!) product.
I have signed the CLA
Demo:
![ycmfixit](https://cloud.githubusercontent.com/assets/10584846/8396802/8fce516c-1dad-11e5-91e7-a26253e489fd.gif)
Fix the following cases where the completion is not triggered for
the next typed character:
- moving vertically in insert mode,
- removing a character and entering insert mode.
Updating default semantic hooks.
The documentation was updated to be in sync with ycmd @bfcfa21,
regarding default semantic hooks defined in ycmd's completer_utils.py.
Executing the check_core_version.py script with SafePopen and stdin to
PIPE raises an error in Vim on Windows. Since the stdin option is only
useful when starting the ycmd server, it is only set in this case.