News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Standard Header Highlighting

Started by Roman, August 05, 2007, 03:48:32 PM

Previous topic - Next topic

Roman

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)

dmoore

another way would give users the option to change the lexer of any open editor (a la Scite)
Python plugins: [url="https://github.com/spillz/codeblocks-python"]https://github.com/spillz/codeblocks-python[/url]
Code::Blocks Daily Builds -- Ubuntu PPA: [url="https://launchpad.net/~damien-moore/+archive/codeblocks"]https://launchpad.net/~damien-moore/+archive/codeblocks[/url]

mandrav

Quote from: dmoore 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)

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

Roman


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)

rhf

Quote from: mandrav on August 05, 2007, 05:48:03 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.



Roman

CB LSI (C::B as a Little Secret Initiative)

mandrav

Quote from: Roman 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

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...

dmoore

Quote from: mandrav on August 05, 2007, 05:48:03 PM
Edit->Highlight mode

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

Quote from: Roman on August 05, 2007, 03:48:32 PM
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

Quote from: rhf on August 05, 2007, 07:49:40 PM
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.

Python plugins: [url="https://github.com/spillz/codeblocks-python"]https://github.com/spillz/codeblocks-python[/url]
Code::Blocks Daily Builds -- Ubuntu PPA: [url="https://launchpad.net/~damien-moore/+archive/codeblocks"]https://launchpad.net/~damien-moore/+archive/codeblocks[/url]

rhf

Quote from: dmoore on August 06, 2007, 06:28:38 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.

Biplab

Quote from: rhf on August 06, 2007, 07:07:46 PM
Thanks. Bug 011720.

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

Quote from: dmoore on August 06, 2007, 06:28:38 PM
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.

thomas

QuoteSo 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.

QuoteRoman: 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."

dmoore

Quote from: thomas on August 07, 2007, 01:17:39 PM
QuoteRoman: 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?
Python plugins: [url="https://github.com/spillz/codeblocks-python"]https://github.com/spillz/codeblocks-python[/url]
Code::Blocks Daily Builds -- Ubuntu PPA: [url="https://launchpad.net/~damien-moore/+archive/codeblocks"]https://launchpad.net/~damien-moore/+archive/codeblocks[/url]

Biplab

Quote from: thomas on August 07, 2007, 01:17:39 PM
QuoteSo 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.

dmoore

i still don't see what is wrong with assuming the same lexer as the file they are linking from. what am i missing?
Python plugins: [url="https://github.com/spillz/codeblocks-python"]https://github.com/spillz/codeblocks-python[/url]
Code::Blocks Daily Builds -- Ubuntu PPA: [url="https://launchpad.net/~damien-moore/+archive/codeblocks"]https://launchpad.net/~damien-moore/+archive/codeblocks[/url]

Roman

Quote from: dmoore 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?

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