User forums > Using Code::Blocks
Help on code completion
ollydbg:
Hello, ouille, thanks for the contribution!
Here are some of my comments about the patch:
1, It looks like you forgot to add the file changes of "plugins\codecompletion\resources\settings.xrc" in the patch?
2, About how the add the files to the batch parser(the thread pool), which will parse the files in FIFO(first in first out) mode as they added.
Let's say, some headers files are not included in any translation unit files. Such as a file named "c.h" in my previous post. (Re: Help on code completion)
How, what I think the way is: first add the translation unit files(the .c or .cpp files) first, and then the header files.
So, we have such sequence:
--- Code: ---a.c
b.c
a.h
b.h
c.h
--- End code ---
When parsing a.c, the a.h and b.h will be parsed.
When parsing b.c, no need to parse its included file a.h and b.h, since they are already in symbol tree.
Next, a.h and b.h are just skipped since they are already in the symbol tree.
Last, when we look at c.h, we can't find this header files in the symbol tree, so we parse it.
3, Please note there is an option named "Enable headers code-completion", which means when user hit the "<" after he typed the "#include", the header file names will be prompted for auto suggestion. This is not the same thing was we discussed in this thread. ;)
ouille:
Hello,
Thank you for your feedback.
--- Quote ---3, Please note there is an option named "Enable headers code-completion", which means when user hit the "<" after he typed the "#include", the header file names will be prompted for auto suggestion. This is not the same thing was we discussed in this thread. ;)
--- End quote ---
OK I was totally wrong ! I use this option to implement header parsing ... sorry, i have to revert now !
--- Quote ---1, It looks like you forgot to add the file changes of "plugins\codecompletion\resources\settings.xrc" in the patch?
--- End quote ---
It is not modified, reason above.
--- Quote ---2, About how the add the files to the batch parser(the thread pool), which will parse the files in FIFO(first in first out) mode as they added.
--- End quote ---
OK, it's the right way. I'll try find where and then I'll propose another patch.
Thank you for reviewing.
Have a nice day.
Ouille.
ouille:
Hello,
So, here's a new version of the patch.
An option has been added to "settings -> editor -> code completion -> C/C+++ Parser"
This time, "settings.xrc" is well handled in the patch.
If "Parse headers" is selected, the project header files are added at the end of the list of files to be parsed.
Otherwise, we find the old behavior.
Is the option useful? Is it really annoying to parse the header files that have been added to the project?
Returns are welcome.
Have a good day.
Translated with www.DeepL.com/Translator
Ouille.
oBFusCATed:
--- Quote from: ouille on November 11, 2018, 07:24:57 pm ---Is the option useful? Is it really annoying to parse the header files that have been added to the project?
--- End quote ---
I still think that you're solving the wrong problem.
Your problem is that a header is not parsed because it is included behind some complex macro logic which our parser doesn't understand or something similar.
If you have to spend time and find out why the file is not included and not add just a workaround which in most cases would waste time and memory and probably would provide wrong information in headers which depend on some marcos being defined.
ouille:
Hello,
--- Quote ---Your problem is that a header is not parsed because it is included behind some complex macro logic which our parser doesn't understand or something similar.
--- End quote ---
The remark is interesting. I will test to see if the parser is actually lost in the headers tree.
The idea was however, to add the includes of the Linux kernel to have the completion of the functions without having to add #include in first intention. A kind of help in writing the code.
It is then easier to use a function and add the header afterwards. It would seem logical to me to have this functionality as long as we can voluntarily add independent headers to the project.
Perhaps this is not a good way of working. In this case I would keep the patch for this type of development. It's not embarrassing, as it's really easy to build codeblocks from source.
However, there is still a slight inconsistency, since these headers files are parsed when they are added to the project.
Have a nice day.
Ouille.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version