News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

ClangComplete plugin

Started by Lalaland, November 10, 2011, 03:51:45 PM

Previous topic - Next topic

ollydbg

I mean how clang can find the gcc's default search paths, different version of gcc has different paths, like:


Caching GCC dir: E:\code\cb\gcc\mingw-static-4.4.5-all\lib\gcc\i686-mingw32\4.4.5\include\c++
Caching GCC dir: E:\code\cb\gcc\mingw-static-4.4.5-all\lib\gcc\i686-mingw32\4.4.5\include\c++\i686-mingw32
Caching GCC dir: E:\code\cb\gcc\mingw-static-4.4.5-all\lib\gcc\i686-mingw32\4.4.5\include\c++\backward
Caching GCC dir: E:\code\cb\gcc\mingw-static-4.4.5-all\include
Caching GCC dir: E:\code\cb\gcc\mingw-static-4.4.5-all\lib\gcc\i686-mingw32\4.4.5\include
Caching GCC dir: E:\code\cb\gcc\mingw-static-4.4.5-all\lib\gcc\i686-mingw32\4.4.5\include-fixed


Does clang has it's own include files so that we do not need mingw's ?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Lalaland

#16
No, you are right, it is using gcc's search directories.

It seems that it can search a limited number of hardcoded paths for the headers(there is a whole complex module for this, tons of switch statements and  "// FIXME: temporary hack: hard-coded paths.") , eg    AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.5.0");
   AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.4.0");
   AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.3.0");

which is why it seems to work, but I actually need to find the real paths to get it working when Mingw is not installed in the usual locations ...

Lalaland

#17
How does codeblocks filter results completions that are not related to a container(Ie, does not '->', '.' or '::')
With no container, you get hundreds of possible completions.

Should I filter and show only variables, only functions, ?
Showing all possible completions causes observable delays, and the resulting list is too large to use.

Also:
How useful is it to users to have the icon also show accesability(private, protected, etc)?
While it is possible with clang(the functions are there) it seems that I would have parse the file twice in order to get this kind of type information.

ollydbg

Quote from: Lalaland on November 14, 2011, 07:57:54 AM
How does codeblocks filter results completions that are not related to a container(Ie, does not '->', '.' or '::')
With no container, you get hundreds of possible completions.
You mean the current implementation in Codeblocks? As far as I know, it dose not filter any thing, but note that the "auto-completion" should be only triggered by:
1, after "->", "::" or "."
2, after user continuously entered four characters, so we do a prefix match of four chars, and only list the tokens which have the same prefix string. note: the value "four" can be configured to "two" or even "one", which means more Tokens will be listed, but we have a limit value (like 10000).
3, when the user continuously enter some more characters, we just use the result in the step 2.

Quote
Should I filter and show only variables, only functions, ?
Showing all possible completions causes observable delays, and the resulting list is too large to use.
The best way is show automatic variable firstly, and then class members, then global variables....So, I think the Tokens from clang should be sorted. :D

Quote
Also:
How useful is it to users to have the icon also show accesability(private, protected, etc)?
While it is possible with clang(the functions are there) it seems that I would have parse the file twice in order to get this kind of type information.
Yeah, this is much better!
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Folco

My personal opinion : I don't use these pictures. The names I choose are explicit, and I never learned the meaning of these symbols.
Kernel Extremist - PedroM power ©

ollydbg

Quote from: Folco on November 15, 2011, 09:15:43 PM
My personal opinion : I don't use these pictures. The names I choose are explicit, and I never learned the meaning of these symbols.
You are answering to this question below?
QuoteHow useful is it to users to have the icon also show accesability(private, protected, etc)?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Lalaland

Regardless, I have added the icons for visibility.



The only issue is that I had to modify libclang slightly to do it.
I have submitted a patch request, but until then, I have attached the patch to this post.

Now the only main issue is to work on handling code completion with no context.

Folco

Quote from: ollydbg on November 16, 2011, 01:06:39 AM
Quote from: Folco on November 15, 2011, 09:15:43 PM
My personal opinion : I don't use these pictures. The names I choose are explicit, and I never learned the meaning of these symbols.
You are answering to this question below?
QuoteHow useful is it to users to have the icon also show accesability(private, protected, etc)?

Yes I do.

Could these pictures be optional ?
Kernel Extremist - PedroM power ©

daniloz

Quote from: Folco on November 16, 2011, 05:55:11 PM
Could these pictures be optional ?

Come on... Even if you don't use the pictures (which I do a lot), they are very unlikely to disturb anyone, right? ;-)

Anyway, even if "the names [you] choose are explicit", you still have do deal with code from others, like your beloved CodeBlocks API/SDK, for example, right? And then, the pictures really help me a lot!!!!

Just my 2 cents, though...

Lalaland

I am just going to keep the pictures in there.
Right now the major goal of this plugin is to mirror the experience but provide better functionality than the current plugin.
And, those pictures are a major part of the "experience".

ollydbg

It looks like the codelite IDE was changing its way to call clang, see its svn chang log:
Quote
Revision: 5276
Author: eranif
Date: 2011-11-17 15:12:47
Message:
added clang sdk for Windows
-------------------------------
A : /trunk/sdk/clang

A : /trunk/sdk/clang/include

A : /trunk/sdk/clang/include/clang-c

A : /trunk/sdk/clang/include/clang-c/Index.h

A : /trunk/sdk/clang/lib

A : /trunk/sdk/clang/lib/clang.dll


Now, it will depend on clang shared library.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Lalaland

Clang allows you to see what is accessible.
Should I hide non-accessible results?

ollydbg

Quote from: Lalaland on November 18, 2011, 06:54:17 AM
Clang allows you to see what is accessible.
Should I hide non-accessible results?
I think "non-accessible results" should be hide in the completion suggest list. :D

The other question is: (dependency question)
If some would like to distribute this clangcompletion plugin, which file should be included.
The clangcompletion dll
and the clang.dll
Or other files needed?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Lalaland

Well I use the images from the real code completion plugin.

MortenMacFly

Remember:
Quote from: MortenMacFly on November 11, 2011, 08:16:21 AM
One note: Please keep in mind that the plugin should derive from cbCodeCompletionPlugin, not cbPlugin to work properly in the end.
I would recommend you better do it before it's too late and requires massive re-factoring. In the end the interface of cbPlugin (wrong for a CC plugin) and cbCodeCompletionPlugin is different.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]