Over the current year, I have written more code in VB.NET than C#. Hence, my code samples were obviously Visual Basic.

I have noticed some bad syntax highlight with this language, particularly when inserting comments in code sample, (otherwise the highlight is great), which seems to be parsed as a string of text by the code sample parser or syntax highlighter of SO, call it what you want, I don't actually know the exact technical term for this.

While I understand that SO cannot offer syntax highlight for every single existing programming languages, I am wondering whether this would be doable to provide some sort of syntax highlighter such as ones provided in Notepad++, for example.

What I mean is that one could choose, while editing his/her question/answer, the language highlighting that suits best for the code sample he/she provides. Indeed, C# would be the default.

That said, would syntax highlighting compatible with other languages than C# be worthy?

  • 1
    Lol, other languages than C#, errr...?
    – Arjan
    Dec 6 '10 at 14:54

The syntax highlighting does not parse the code blocks as anything in particular. Instead, it uses a set of heuristics that are reasonable correct in a pretty big set of more-or-less common languages. In fact, most of the heuristics are for c-like languages, which is why c# comes out pretty well.

In any case, c# is not being given special treatment and visual basic is not being ignored---it simple is wonky enough that general purpose heuristics don't work well with it.


It gets wonky on VB.NET comments. Fix that and it will look okay. Like this:

Sub Test()
'' double quotes are okayish
End Sub

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .