When I manually specify the language of a code block as VB.NET like this:
<!-- language: vbnet -->
theNodeList.Cast(Of XmlNode)()
theNodeList.Cast(Of XmlNode)()
the code is not highlighted. But this variation works:
<!-- language: lang-vbnet -->
theNodeList.Cast(Of XmlNode)()
theNodeList.Cast(Of XmlNode)()
I get the same results for both versions when I replace vbnet
with vb.net
:
<!-- language: vb.net -->
theNodeList.Cast(Of XmlNode)()
theNodeList.Cast(Of XmlNode)()
<!-- language: lang-vb.net -->
theNodeList.Cast(Of XmlNode)()
theNodeList.Cast(Of XmlNode)()
In the first version, the language is specified through the tag. In the second version, it's specified through the syntax highlighting parser name. The problem is that the vb.net tag isn't automatically setting the correct parser for (unlike most other language tags). This old comment indicates that a diamond moderator has the power to fix this. Or perhaps the parser is correctly set for the tag, but there's a bug in Stack Overflow with tags with periods in their names.
The tags on a question shouldn't affect whether this problem appears, since the comment should override all tags. That makes this question different from VB.NET code highlighting problem resurging, where there were multiple tags on a question, and a code block with no comment was being assigned the wrong default language.
vb
andvbs
, novbnet
vbnet
because that's Vim's name for its VB.NET syntax highlighter, and then I saw it seem to work. But it looks like evenlang-vbfoo
highlights as Visual Basic - the suffix is ignored. Still, using thevb
highlighter for vb.net is better than no highlighting at all.Call MyFun
into it, the code is not highlighted at all. The code should be highlighted using thevb
highlighter, which is the closest approximation for vb.net we have, and better than nothing. You can see that the code looks better when you manually add<!-- language: lang-vb -->
– but you shouldn’t have to manually add that; the vb.net tag should do that for you.lang-vb
highlighting. In the question above, with the (nonexistent)lang-vb.net
parser,Cast
andOf XmlNode
are colored blue; I assumed that was how they were supposed to be highlighted. But now I see that with thelang-vb
parser, they are not highlighted; instead, keywords likeCall
are highlighted in dark blue. So vb.net does have highlighting, it just doesn’t highlight things I thought it would.