jeff-hykin / better-cpp-syntax

💾 The source of VS Code's C++ syntax highlighting
GNU General Public License v3.0
155 stars 30 forks source link

Raw SQL strings should be specified as an embedded language in package.json #623

Open a-stewart opened 1 year ago

a-stewart commented 1 year ago

We have some nested syntax highlighting, eg SQL which colours as expected, however, bracket matching does not work, and it just shows the outer brackets of the string.

image

I think if we specify that SQL is an embedded language in package.json, we should get bracket matching according to https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide#embedded-languages. It seems to work as expected in Markdown which does specify that.

https://github.com/microsoft/vscode/blob/main/extensions/markdown-basics/package.json#L38

I had a quick play and tried just setting it up but it didn't work - I think potentially this is due to the fact that in markdown, the scope the embedded language points to is just the embedded SQL, whereas with C++, the scope also includes R"sql( and )sql either side.

I didn't get enough time to look into this into much detail though.

jeff-hykin commented 1 year ago

As far as I can tell, SQL (left side) and SQL inside of C++ (right side) are highlighted the same.

Screen Shot 2023-01-20 at 11 46 05 AM

Maybe I'm misunderstanding, or maybe the issue is something with the SQL syntax rather than the C++ syntax?

jeff-hykin commented 1 year ago

I'm going to go ahead and close this, but I'll reopen it if you think its still a problem

a-stewart commented 1 year ago

Sorry, I missed that you had replied.

Syntax highlighting is working fine, what is missing is bracket matching.

I think to get bracket matching to work, you have to specify that sql is an embedded language in package.json