Author Topic: Standard Header Highlighting  (Read 12423 times)

Offline Roman

  • Multiple posting newcomer
  • *
  • Posts: 78
Standard Header Highlighting
« on: August 05, 2007, 03:48:32 pm »
Dear guys!

The C++ standard library is a great place to learn good programming techniques. Because of that I often use "open #include fie 'streambuf'" command in the rightclick menu. But <streambuf> has no extension and C::B doesn't use appropriate syntax highlighting scheme. So my suggestion is to 'hardcode' the names of new style standard C++ library header files so they will be highlighted as C++ by default.

Best Regards,
Roman
CB LSI (C::B as a Little Secret Initiative)

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Standard Header Highlighting
« Reply #1 on: August 05, 2007, 04:52:29 pm »
another way would give users the option to change the lexer of any open editor (a la Scite)

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Standard Header Highlighting
« Reply #2 on: August 05, 2007, 05:48:03 pm »
another way would give users the option to change the lexer of any open editor (a la Scite)

Edit->Highlight mode
Be patient!
This bug will be fixed soon...

Offline Roman

  • Multiple posting newcomer
  • *
  • Posts: 78
Re: Standard Header Highlighting
« Reply #3 on: August 05, 2007, 07:25:39 pm »

Quote
Edit->Highlight mode

<iostream>
  <istream>
    <ios>
  <ostream>
    <ios>

When travelling from top to <ios> content I usually use Edit->Highlight mode but it would be more comfortable not to do so )

Best Regards,
Roman
CB LSI (C::B as a Little Secret Initiative)

Offline rhf

  • Multiple posting newcomer
  • *
  • Posts: 123
Re: Standard Header Highlighting
« Reply #4 on: August 05, 2007, 07:49:40 pm »
Edit->Highlight mode

Hmm, interesting. When I open a standard C++ header with no file extension, there is no syntax highlighting.
Edit->Highlight mode shows the list with C/C++ selected. Reselecting C/C++ or closing the menu has no effect.

However, if I Edit->Highlight mode and select, say, Batch, highlighting appears.
Then I can Edit->Highlight mode and select C/C++ and get the desired syntax highlighting.

This does not seem correct. Am I missing a refresh command or something?

Windows XP,  Nightly SVN 4338.



Offline Roman

  • Multiple posting newcomer
  • *
  • Posts: 78
Re: Standard Header Highlighting
« Reply #5 on: August 05, 2007, 10:04:17 pm »
Same thing
CB LSI (C::B as a Little Secret Initiative)

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Standard Header Highlighting
« Reply #6 on: August 05, 2007, 10:14:32 pm »

Quote
Edit->Highlight mode

<iostream>
  <istream>
    <ios>
  <ostream>
    <ios>

When travelling from top to <ios> content I usually use Edit->Highlight mode but it would be more comfortable not to do so )

Best Regards,
Roman

Does the fact that I quoted dmoore give you a hint that maybe I replied to him? He made a specific suggestion and I replied that it's already there :).
For the rest of the things mentioned in this topic, file a feature request.
Be patient!
This bug will be fixed soon...

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Standard Header Highlighting
« Reply #7 on: August 06, 2007, 06:28:38 pm »
Edit->Highlight mode

:oops: I've even used this before, but use so infrequently I forgot its existence...

So my suggestion is to 'hardcode' the names of new style standard C++ library header files so they will be highlighted as C++ by default.

Roman: instead of hardcoding a list, how about automatically changing to the C/C++ lexer (or the currently active lexer) if you follow a #include? that should be easy to implement

Hmm, interesting. When I open a standard C++ header with no file extension, there is no syntax highlighting.
Edit->Highlight mode shows the list with C/C++ selected. Reselecting C/C++ or closing the menu has no effect.

having troubles replicating this. my version doesn't even show a check next to the current lexer. If I open a file without extension it defaults to plain text. I can change to c/c++ but can't change back to text.

anyway, I can work on these issues in the next week or two if someone else wants to put a bug/feature request on berlios.


Offline rhf

  • Multiple posting newcomer
  • *
  • Posts: 123
Re: Standard Header Highlighting
« Reply #8 on: August 06, 2007, 07:07:46 pm »
...I can work on these issues in the next week or two if someone else wants to put a bug/feature request on berlios.

Thanks. Bug 011720.

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Standard Header Highlighting
« Reply #9 on: August 06, 2007, 07:20:28 pm »
Thanks. Bug 011720.

I was about to commit a fix for this bug. But dmoore reported another one and I stopped. ;)

having troubles replicating this. my version doesn't even show a check next to the current lexer. If I open a file without extension it defaults to plain text. I can change to c/c++ but can't change back to text.

Both the bugs are fixed in rev 4353. :)
Be a part of the solution, not a part of the problem.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Standard Header Highlighting
« Reply #10 on: August 07, 2007, 01:17:39 pm »
Quote
So my suggestion is to 'hardcode' the names of new style standard C++ library header files so they will be highlighted as C++ by default.
No way, sorry.

Quote
Roman: instead of hardcoding a list, how about automatically changing to the C/C++ lexer (or the currently active lexer) if you follow a #include? that should be easy to implement
That would break languages with similar/identical preprocessor syntax. Two such examples are Cg and Objective-C (there are probably more).
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Standard Header Highlighting
« Reply #11 on: August 07, 2007, 01:42:35 pm »
Quote
Roman: instead of hardcoding a list, how about automatically changing to the C/C++ lexer (or the currently active lexer) if you follow a #include? that should be easy to implement
That would break languages with similar/identical preprocessor syntax. Two such examples are Cg and Objective-C (there are probably more).

note the alternative:

Quote
(or the currently active lexer)

surely this won't break unless a language can #include code written in another language, or a language uses a different lexer for its #includes?

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Standard Header Highlighting
« Reply #12 on: August 07, 2007, 01:49:04 pm »
Quote
So my suggestion is to 'hardcode' the names of new style standard C++ library header files so they will be highlighted as C++ by default.
No way, sorry.

I do have the same opinion as of Thomas.

One way to identify is to read the file for some embedded highlighting tags. E.g., iostream begins with the following line-
Quote
// Standard iostream objects -*- C++ -*-
which indicates that it's a C++ file. But this behavior is not uniform and MS supplied headers doesn't have these identifiers. :)
Be a part of the solution, not a part of the problem.

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Standard Header Highlighting
« Reply #13 on: August 07, 2007, 03:54:36 pm »
i still don't see what is wrong with assuming the same lexer as the file they are linking from. what am i missing?

Offline Roman

  • Multiple posting newcomer
  • *
  • Posts: 78
Re: Standard Header Highlighting
« Reply #14 on: August 07, 2007, 10:01:35 pm »
i still don't see what is wrong with assuming the same lexer as the file they are linking from. what am i missing?

I'm missing it too )
CB LSI (C::B as a Little Secret Initiative)