Re: new tool for vim users

2014-08-11 Thread Markus Mohrhard
Hey,

On Mon, Aug 11, 2014 at 12:52 PM, Eike Rathke  wrote:
> Hi Markus,
>
> On Thursday, 2014-08-07 23:10:35 +0200, Markus Mohrhard wrote:
>
>> looking for a task that does not make my head spin while being sick in
>> bed I worked on support for YouCompleteMe [1]. For people who don't
>> know it, it is a VIM plugin -- one more reason for emacs users to
>> switch to the good side ;) -- that provides code-completition based on
>> clang. Therefore it actually understands the code and can give correct
>> suggestions.
>
> Sounds all good, but does the in-the-background-compilation and the
> actual completion search really scale with our code base?

It does for me. The in background compilation takes about a second or
two in my dbgutil build but that hardly matters as it is mostly
helpful to find compile errors and warnings. The completion search is
actually quite fast after looking up the type for the first time. So I
don't get suggestions for the first time but after that all the
suggestions are instant.


> What scares me away is "that no keyboard shortcuts had to be pressed to
> get the list of completion candidates" ;-)  so it is continuously
> popping up suggestions I didn't ask for? That looks a little annoying in
> the demo. Other than that the description reads as if it was a quite
> sophisticated utility.

Yes it is a bit different to the normal omni complete behavior but I
actually like it. I have integrated it with UltiSnips so it shows also
suggestions for my snippets and I like that it provides me with a
quick overview of the methods that are available.

>
> So far I'm using
>
> OmniCppComplete : C/C++ omni-completion with ctags database
> http://www.vim.org/scripts/script.php?script_id=1520
>
> where our ctags tags file already provides the necessary information
> for. It does have some shortcomings but most times works when needed.
>

I think it is similar. I was never really happy with the ctags based
suggestions but if you like them I think they are a good alternative.
My only open item is to check if it is possible to teach clang that
uno::Reference x; x-> should suggest methods based on X and not on
uno::Reference. After that I would be totally happy with the
suggestions based on YCM.

On an unrelated note: the code has just landed in master so you can
try it now if you want. make vim-ide-integration will directly
generate the clang compilation database that YCM uses.

Regards,
Markus
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: new tool for vim users

2014-08-11 Thread Eike Rathke
Hi Markus,

On Thursday, 2014-08-07 23:10:35 +0200, Markus Mohrhard wrote:

> looking for a task that does not make my head spin while being sick in
> bed I worked on support for YouCompleteMe [1]. For people who don't
> know it, it is a VIM plugin -- one more reason for emacs users to
> switch to the good side ;) -- that provides code-completition based on
> clang. Therefore it actually understands the code and can give correct
> suggestions.

Sounds all good, but does the in-the-background-compilation and the
actual completion search really scale with our code base?
What scares me away is "that no keyboard shortcuts had to be pressed to
get the list of completion candidates" ;-)  so it is continuously
popping up suggestions I didn't ask for? That looks a little annoying in
the demo. Other than that the description reads as if it was a quite
sophisticated utility.

So far I'm using

OmniCppComplete : C/C++ omni-completion with ctags database 
http://www.vim.org/scripts/script.php?script_id=1520

where our ctags tags file already provides the necessary information
for. It does have some shortcomings but most times works when needed.

  Eike

-- 
LibreOffice Calc developer. Number formatter stricken i18n transpositionizer.
GPG key ID: 0x65632D3A - 2265 D7F3 A7B0 95CC 3918  630B 6A6C D5B7 6563 2D3A
Support the FSFE, care about Free Software! https://fsfe.org/support/?erack


pgp0z1G0WMBNy.pgp
Description: PGP signature
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: new tool for vim users

2014-08-08 Thread Bjoern Michaelsen
Hi Markus,

On Thu, Aug 07, 2014 at 11:10:35PM +0200, Markus Mohrhard wrote:
> looking for a task that does not make my head spin while being sick in
> bed I worked on support for YouCompleteMe [1].

We need to make you sick more often! ;)

Well, with full semantic code completion for Vim -- the one true IDE -- this is
yet another point to consider gbuild feature complete (although it doesnt read
mail yet). I never used YouCompleteMe, but this is certainly a reason to give
it a try.

Best,

Bjoern
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


new tool for vim users

2014-08-07 Thread Markus Mohrhard
Hey,

looking for a task that does not make my head spin while being sick in
bed I worked on support for YouCompleteMe [1]. For people who don't
know it, it is a VIM plugin -- one more reason for emacs users to
switch to the good side ;) -- that provides code-completition based on
clang. Therefore it actually understands the code and can give correct
suggestions.

As it is compiling the code in the background it needs a way to know
how to compile the code. For that I'm currently using the clang json
database format. The file is being written by the gbuild-to-ide script
which can be invoked now with make vim-ide-integration.

You will additionally need a python script that contains some logic.
Attached is the one that I'm currently using.

It is currently mostly a proof-of-concept and I hope that others are
playing a bit with it. I tested that it provides correct suggestions
but currently the warning support is disabled and I'm not sure if it
would not make some sense to additionally provide a smaller database
for each module.

Feedback is highly appreciated. The patches are still pending in
gerrit as I'm having a slight problem with our build system regarding
include paths coming from external libraries.

Regards,
Markus

[1] http://valloric.github.io/YouCompleteMe/
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# In jurisdictions that recognize copyright laws, the author or authors
# of this software dedicate any and all copyright interest in the
# software to the public domain. We make this dedication for the benefit
# of the public at large and to the detriment of our heirs and
# successors. We intend this dedication to be an overt act of
# relinquishment in perpetuity of all present and future rights to this
# software under copyright law.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# For more information, please refer to 

import os
import ycm_core

# These are the compilation flags that will be used in case there's no
# compilation database set (by default, one is not set).
# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
flags = [
'-Wall',
'-Wextra',
'-Werror',
'-Wc++98-compat',
'-Wno-long-long',
'-Wno-variadic-macros',
'-fexceptions',
'-DNDEBUG',
# You 100% do NOT need -DUSE_CLANG_COMPLETER in your flags; only the YCM
# source code needs it.
'-DUSE_CLANG_COMPLETER',
# THIS IS IMPORTANT! Without a "-std=" flag, clang won't know which
# language to use when compiling headers. So it will guess. Badly. So C++
# headers will be compiled as C headers. You don't want that so ALWAYS specify
# a "-std=".
# For a C project, you would set this to something like 'c99' instead of
# 'c++11'.
'-std=c++11',
# ...and the same thing goes for the magic -x option which specifies the
# language that the files to be compiled are written in. This is mostly
# relevant for c++ headers.
# For a C project, you would set this to 'c' instead of 'c++'.
'-x',
'c++',
'-isystem',
'../BoostParts',
'-isystem',
# This path will only work on OS X, but extra paths that don't exist are not
# harmful
'/System/Library/Frameworks/Python.framework/Headers',
'-isystem',
'../llvm/include',
'-isystem',
'../llvm/tools/clang/include',
'-I',
'.',
'-I',
'./ClangCompleter',
'-isystem',
'./tests/gmock/gtest',
'-isystem',
'./tests/gmock/gtest/include',
'-isystem',
'./tests/gmock',
'-isystem',
'./tests/gmock/include',
'-isystem',
'/usr/include',
'-isystem',
'/usr/local/include',
'-isystem',
'/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1',
'-isystem',
'/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include',
]


# Set this to the absolute path to the folder (NOT the file!) containing the
# compile_commands.json file to use that instead of 'flags'. See here for
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
#
# You can get CMake to generate this file for you by adding:
#   set( CMAKE_EXPORT_COMPILE_COMMANDS 1 )
# to your CMakeLists.txt file.
#
# Most projects will NOT need to set this to anything; you can just change the
# 'flags' list of compilation flags. Notice that YCM itself uses that approach.