Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development
Code completion
Wolf:
Hello,
I have been working all night on the code completion plugin, and I have noted a few design flaws, but there is an easy workaround for all those I found.
Anyways, I was able to get code completion to work for unions (yay! everyone has been waiting for that), and I'm not stopping there. I've got it working for variables declared using the struct/class/union keyword ("zz" in the example) and for variables declared with a class/structure/union declaration ("aa", "bb", and "cc" in the example). It knows when it is a typedef or not. I'm making it work for structures inside structures. However, I am faced with one small (big) problem. The difference between languages, C and C++.
Example:
--- Code: ---typedef struct {
struct s {
int value;
} aa;
} MyStruct;
struct MyOtherStruct {
int val;
} bb, cc;
struct MyOtherStruct zz;
--- End code ---
In C, you can declare a variable of type s. But in C++, it has to be of type MyStruct::s. So I am wondering whether I should set s as global, as a child of MyStruct, or both?
Here's my patch: http://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=2566&group_id=5358
EDIT: Okay, this is my latest version. Spent the whole night on this, time to get a few minutes of sleep.
-- Wolf --
PS: If you need someone to work on the code completion module, I would be glad to help.
Wolf:
Okay, looks like today my patch causes CB to crash. I'll check that out later. It has no security checks, so it is very possible...
EDIT: Found the code responsible for the crash. It is what I was thinking I forgot to handle.
--- Code: ---struct MyOtherStruct {
int val;
} bb, cc;
struct MyOtherStruct zz;
--- End code ---
It doesn't handle yet declaring multiple variables after a structure declaration. Something very simple to handle... I'll do that soon.
Wolf:
I have fixed the problem, but not uploaded the patch yet patch uploaded, as I'm facing a new problem.
--- Code: ---struct HiddenStruct {
int myval;
struct {
int value;
} bb;
};
struct HiddenStruct yy;
struct MyOtherStruct {
int val;
} bb, cc;
--- End code ---
It adds 'bb' as a variable of type 'Unnamed-Struct-xxx' with 'HiddenStruct' as a parent.
Then, it adds 'bb' as a variable of type 'MyOtherStruct' with no parent.
And in the symbols browser, 'bb' doesn't show up in the variables. And in 'HiddenStruct', it shows 'bb' as 'MyOtherStruct' instead of 'Unnamed-Struct-xxx'.
If anyone could check this out, it would be appreciated.
Also, I don't really know why, but even if 'cc' is added (so it says in the log), it doesn't appear in the symbols browser.
When I initially load the file (or call a re-parse), it does appear, but when I save the file and the tree is updated, it disappears.
-- Wolf --
--- Code: ---yy.bb. // shows val instead of value
--- End code ---
JGM:
Hey great job! You are really good to work with the currento cc code! Keep it going :D
Wolf:
--- Quote from: JGM on September 28, 2008, 07:21:17 pm ---Hey great job! You are really good to work with the currento cc code! Keep it going :D
--- End quote ---
Thanks. I wish I could keep it going, but I don't want to mess with the token tree. I don't think I'll be able to provide more patches in a while, so have fun with it.
Navigation
[0] Message Index
[#] Next page
Go to full version