glsl-language-toolkit
glsl-language-toolkit copied to clipboard
Don't wrap `#define` values in parenthesis unnecessarily
This breaks code e.g.
// #define noise snoise
#define noise cnoise
//...
noise(position)
Formatter would replace the define with #define noise (cnoise), which would break the code (cnoise)(position).
My edit is doing this instead to preserve existing parenthesis but not adding any extra:
// print() -> case "ppDefine"
paren(p("node"), n.tokens.at(0).tokenType.name === 'LEFT_PAREN' && n.tokens.at(-1).tokenType.name === 'RIGHT_PAREN')
Lemme know your thoughts