Add a new vim hook on CompleteDone. This hook is called when a
completions is selected.
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.
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.
Redraw the screen before displaying a message
There has been several complaints about the message "ValueError: File is less than 5 lines long; not compiling". See issues #814, #1364, #1544. In fact, I believe the issue is not the message itself but the infamous "Press ENTER or type command to continue" prompt when editing a new C-family file.
For example, if I create the file `foo.c`, Vim will display the line `"foo.c" [New file]` and then YouCompleteMe will display `ValueError: File is less than 5 lines long; not compiling`. Since there are now two lines, the hit-enter message is prompted. By redrawing the screen just before displaying the message from YouCompleteMe, only one line appears and we avoid this behavior.
Tested on Linux and Windows.
CLA signed.
Fix check condition for setting omnifunction
I had the check for the omnifunc set backwards. I will start to see if we can start testing the vimscript layer as well. I have signed the CLA.