3

I noticed that code formatting / colorization does not seem to be working right for questions which have VB code including comments. Here's an example from https://stackoverflow.com/a/56662842/3195477:

enter image description here

A VB comment is a line starting with just a single-quote. There is no ending quote. But the colorizer seems to be assuming everything between single quotes must be the comment. See the second example above.

I don't recall seeing this in the past, even relatively recently (last few days...)

2
  • 2
    It looks like the process that guesses the language is broken. If you wrap it in a explicit ```lang-vb, it does the right thing. Oct 12, 2022 at 20:17
  • 1
    @AnonCoward the process that guesses the language is tagging and there's no vb like tag in the question. I imagine the language is guessed as SQL given the tagging. Oct 12, 2022 at 20:26

1 Answer 1

5

Default language formatting is picked based on the main language tags in the question. This would be why it's important to always use the language tag of any present source code, even if the choice of language is unimportant to the question.

In this case the question asks about how to do something in MS Access and doesn't ask for VBA specifically, so it is correctly tagged. It does use SQL as one of the tags though. So unless language-specific formatting is used in the answers, the site picks formatting as SQL in this case.

I have corrected the post you linked now and as you can see the VB formatting works just fine as soon as the site is told that it should format code as VB.

Examples:

-- this is a SQL comment
SELECT * FROM DB
'this is some literal therefore green'
' this is a VB comment
Option Base 42  
"this is some literal therefore green"
1
  • I learned something new! Oct 12, 2022 at 20:38

You must log in to answer this question.

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