Author Topic: SmartHighlight  (Read 11239 times)

Flippeh

  • Guest
SmartHighlight
« on: October 01, 2007, 08:58:29 pm »
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...
Code
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?

Offline XayC

  • Multiple posting newcomer
  • *
  • Posts: 94
Re: SmartHighlight
« Reply #1 on: October 01, 2007, 09:12:41 pm »
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

Offline orel

  • Multiple posting newcomer
  • *
  • Posts: 96
Re: SmartHighlight
« Reply #2 on: November 02, 2007, 10:51:13 am »
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 :http://forums.codeblocks.org/index.php/topic,7063.0.html

Offline AngleWyrm

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: SmartHighlight
« Reply #3 on: December 18, 2007, 08:57:01 am »
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

  • Guest
Re: SmartHighlight
« Reply #4 on: March 18, 2008, 08:31:16 am »
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.

Offline eranif

  • Regular
  • ***
  • Posts: 256
Re: SmartHighlight
« Reply #5 on: April 13, 2008, 02:04:11 pm »
Quote
on 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:
Code
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