Re: [Builder] Autocompletion c++



On 02/03/2017 06:22 AM, p_solntsev meta ua wrote:
I played a little bit. And have some questions to ask. What it the purpose
of <project>.tags file in ~/.cache/gnome-builder/tags?

That is where we place the tags file for the project if we generate them
with our own `ctags ...` command.

If we use automake to generate the tags with `make ctags`, it will
generate them in the build directory. One thing we probably still need
to improve now that we do builds out-of-tree by default is to ensure we
check the build directory for tags files (as opposed to $srcdir).

I've filed https://bugzilla.gnome.org/show_bug.cgi?id=778217 to track this.

From debug output the program complains "Error open file ...". It is clear
since the file is not there. clang completion gives so many C
functions such so it becomes hard to use completion. Ideally, I
would like to have at least something similar to OmniCppCompletion
(in Vim) in gtkmm project.

We use the same backend (provided clang_codeCompleteAt() API) so is
there something more specific that you would like to see changed? One
place where we differ today is that we use our own fuzzy sorting for
completion items because we were getting fairly poor sorting from clang
directly.

This could still use more performance optimization in case anyone is
interested.

Can we summarize all possible completion options here? I may help with
documentation. Thus, two options:

1) clang (Some brief explanation how this completion works. What files
parsed? etc)

We use the clang_codeCompleteAt() API with the CXTranslationUnit that
was parsed from the loaded file. We parse things like -I, -D, -std, and
-x from the build system to prime Clang with the appropriate compile
time options.

Paths such as those passed to -I are translated into full paths before
passing to clang such that relative paths do not bite us.

2) ctags
    |-- Automatically generated ctags file (Describe general process for
end users)
    |-- Custom ctags file. (How to make file, Where to place file,
Configuration etc)

See ide_ctags_service_miner() in plugins/ctags/ide-ctags-service.c for
the definitive answer. But in general, we will look at the generated
project.tags file, ~/.tags, or any file named "tags" in the source tree.
Once bug #778217 is fixed, that will also include $builddir.

Common questions:
    Difference between C and C++ completion, if any.

Both use the same plumbing, so while we have spent virtually zero time
on C++ enablement, it *should* work.

    Autotools configuration for completion purpose, if any.

We have a bunch of fancy makefile extraction that looks at autotools
patterns. See plugins/autotools/ide-makecache.c for the gritty details.

I can't get the desired completion for gtkmm project and what to
understand is this lack of information or program limitation.

Personally, I would choose either ctags *or* clang, but not both. Ctags
can be incredibly fast. But clang will give you expansion templates and
some other nice features.

-- Christian


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]