Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign

Pseudo semantic highlighting

<< < (2/4) > >>

Alpha:
This patch currently only hooks into the editor activated event, so you need to switch editors/close reopen editors (after initial parsing has finished) for colors to show up.

oBFusCATed:
OK, but it doesn't work for C code...

Probably you have to look in this topic: http://forums.codeblocks.org/index.php/topic,16249.0.html

Is it possible to extract this code in a separate plugin or in core?

Alpha:

--- Quote from: oBFusCATed on January 17, 2013, 01:26:21 am ---OK, but it doesn't work for C code...

--- End quote ---
... hence the "pseudo" ;).
The logic used is fairly simplistic:

* List functions in the current file

* Collect the classes they are from
* List the classes in the current file
* Iterate through the member variables of both lists of classes
* Put this list of variables in Scintilla's (previously unused by Code::Blocks) keyword set for "Global classes and typedefs"This makes a lot of assumptions about coding style, but these assumptions generally yield decent results on C++ code.  However, searching for a class in C code will fail for obvious reasons.
In C code, what would your expectations be for choosing the highlighted set?


--- Quote from: oBFusCATed on January 17, 2013, 01:26:21 am ---Probably you have to look in this topic: http://forums.codeblocks.org/index.php/topic,16249.0.html

--- End quote ---
Yes... the plugin there is a lot more ambitious than what I am attempting.

--- Quote from: oBFusCATed on January 17, 2013, 01:26:21 am ---Is it possible to extract this code in a separate plugin or in core?

--- End quote ---
Probably not; this makes use of the token tree that CC builds to decide on the set of keywords to highlight.


--- Quote from: MortenMacFly on January 16, 2013, 04:25:57 pm ---For example, add a new member variable to the class in a header  file, then create an inline method to use this member variable (i.e. a getter-method). This variable will be the only one not highlighted like the others until CC scans this file again... :D

--- End quote ---
Although the code is not necessarily expensive, I would prefer it run the fewest number of times necessary.  Do you have a recommended selection of events I should attach it to?

Alpha:
This should look a little nicer on C code (highlight global vars in C), and also deals with inherited members (for C++).

I added a lock on s_TokenTreeMutex (because that is what the rest of the code seems to do when walking through tokens), however, I do not exactly understand the concept of a mutex very well; is it needed here?

MortenMacFly:

--- Quote from: Alpha on January 17, 2013, 12:02:49 am ---This patch currently only hooks into the editor activated event, so you need to switch editors/close reopen editors (after initial parsing has finished) for colors to show up.

--- End quote ---
There is also the drawback, btw: I noticed really massive slow-downs when opening an editor of a large file with many references to highlight. Do you experience the same?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version