Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++ raw string highlighting #13

Closed
davl3232 opened this issue Mar 13, 2018 · 3 comments · Fixed by #45
Closed

C++ raw string highlighting #13

davl3232 opened this issue Mar 13, 2018 · 3 comments · Fixed by #45

Comments

@davl3232
Copy link

Is it possible to highlight shader code inside C++11 raw strings?

For example, highlight this.

R"(
#version 420 core

void main(void)
{
    gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
}
)"
@stef-levesque
Copy link
Owner

Hm, I'm not sure if this is possible. I know we can specify sub-language, like javascript in an HTML file, but it is hard to detect here, just from the context, that it correspond to a specific shader language.

@davl3232
Copy link
Author

davl3232 commented Mar 15, 2018

Raw string literals in C++ follow this syntax:

R "delimiter( raw_characters )delimiter"

Delimiter is user defined and )delimiter"must not be contained inside raw_characters.

It could be detected by using a special delimiter as convention that tells the shader syntax needed, like:

R"glsl(
#version 420 core

void main(void)
{
    gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
}
)glsl"

@stef-levesque
Copy link
Owner

Hm, that's right, I forgot this C++11 feature.

I'll double-check the VSCode documentation, to see if it's possible to add embeddedLanguages to C++ from an extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants