8000 HLSL #define not highlighted right (... or indeed overhighlighted): uniform .token.property applies, washing out the expression · Issue #3881 · PrismJS/prism · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

HLSL #define not highlighted right (... or indeed overhighlighted): uniform .token.property applies, washing out the expression #3881

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

Open
nabijaczleweli opened this issue Mar 30, 2025 · 1 comment

Comments

@nabijaczleweli
Copy link
nabijaczleweli commented Mar 30, 2025

Information

  • Language: HLSL
  • Plugins: none I think

Description

#define KNOWN_RGBS_FREQS
#define FREQ_LOAD
#define FREQ 1
#define TIMES_FREQ
#include "posterise_kernel.hlsl.inc"
#define KNOWN_RGBS_FREQS [[vk::binding(3, 0)]] StructuredBuffer<uint4> known_rgbs_freqs;
#define FREQ_LOAD        uint freq = known_rgbs_freqs[i / 4][i % 4];
#define FREQ             freq
#define TIMES_FREQ       * freq
#include "posterise_kernel.hlsl.inc"


(Twilight theme)

This is fully washed-out: the macro content has lost all high-lighting (by virtue of uint4 being the same colour as everything else), and the macro name is high-lighted as-if it were a keyword but it's a variable (Prism.js variables are unhighlighted in general).

GitHub does a passable job of highlighting this correctly, here's a mock-up of how it makes sense, to high-light it, too me:

Code snippet

Test page

@nabijaczleweli
Copy link
Author

FWIW, since the structure is thus:
Image

I'm patching this by adding a

[class="language-hlsl"] .token.macro.property {
  color: inherit;
}

style override and a

.replace(/<span class="token directive-hash">#<\/span><span class="token directive keyword">/g, '<span class="token directive keyword">#')

if language == "hlsl" post-processing step that yields results equivalent to the mock-up.

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

No branches or pull requests

1 participant
0