News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

SmartHighlight

Started by Flippeh, October 01, 2007, 08:58:29 PM

Previous topic - Next topic

Flippeh

First on, sorry if this is the wrong section - i couldn't find any better. Feel free to move if its wrong  :)

So on to my suggestion.

Imagine the following...

class MyClass
{
   // ...
}

int main()
{
   MyClass something;
   // ...
}


Wouldn't it be great, if the "MyClass" in front of the "something" gets highlighted like "int", "char" or "double" or any other default data type would? Its really 'boring', to see it in the default black color..

IDEs like Visual Studio do this already.

Would it be possible to add this any time?

XayC

While, of course, possible, I don't think you can expect it being implemented soon. First because Code Completion still has more important things to fix/implement (including a complete redesign), and second because, from what I know, color highlights are done by the text editor (Scintilla) automatically on a predefined set of language keywords, so it would require changes both in the editor code and in the code completion.

Regards, XayC

orel

Quote from: Flippeh on October 01, 2007, 08:58:29 PM
IDEs like Visual Studio do this already.

I develop every day at work with VS 2005, and haven't seen such feature (maybe are you speaking about 2008 ?), the only way to have some new keywords highlighted in the editor is to define them 'by hand'.

And i find the way to define new keywords much user-friendly in CB than VS. In CB you just have to go to Settings/Editor/Syntax Highlighting/.
I VS you have to create a file named 'UserType.dat', populate it with your keywords set and place this file in one of VS installation dirs.
windows XP SP2
mingw gcc 3.4.5
svn Code::Blocks and M$ Visual Studio 2005 and .NET to eat!! SVNInside plugin :[url="http://forums.next.codeblocks.org/index.php/topic,7063.0.html"]http://forums.next.codeblocks.org/index.php/topic,7063.0.html[/url]

AngleWyrm

You can get this effect by defining "user keywords".

Settings->Editor->Syntax Hilighting.
Click the "Keywords..." button, and then scroll the "set" to #2.

Here, there will be a blank area in which to define any user keywords. If these words are then encountered in the code (not in comments), then they will be highlighted using whatever color choices were made for "user keywords".

fchen

Quote from: Flippeh on October 01, 2007, 08:58:29 PM
IDEs like Visual Studio do this already.

I think he mean a plug-in for Visual Studio called "Visual Assistant". It has many cool features. I think Code::Blocks should learn from it.

eranif

Quoteon a predefined set of language keywords, so it would require changes both in the editor code

This is not entirely correct...
Scintilla also defines other key word set, that can be used for this purpose for example, you can
handle this in the OnSave(), and update the key words, followed by a call to Colourise().

So doing something like this:

OnFileSave()
{
  wxString keyword = GetKeyWords();
  wxScintilla::SetKeyWords(1, keywords);
  wxSCintilla::Colourise();
}


this will give u the required results.

However, you still need to implement the 'GetKeyWords()' method, which is another story ;)

Eran