When I try to generate code using expandToNode the function hides whitespace (but not always), which makes the generated code a bit ugly. I can not see a pattern, my current assumption was that it has to do something with the kind of bracket operators >, <, >=, ...
Or the method is trimming whitespace once too much.
Reproduction
Langium version: 1.0.0
import { toString, expandToNode } from 'langium';
test('Reproduction', () => {
//sub expressions are part of a recursive call
const left = expandToNode`left`;
const right = expandToNode`right`;
//handle binary operator >
const operator = '>';
const binaryOperation = expandToNode`${left} ${operator} ${right}`;
//check expectations
const actual = toString(binaryOperation)
expect(actual).toBe('left > right');
//but actual is "left >right" (whitespace after '>' is missing)
});
When I try to generate code using
expandToNode
the function hides whitespace (but not always), which makes the generated code a bit ugly. I can not see a pattern, my current assumption was that it has to do something with the kind of bracket operators >, <, >=, ... Or the method is trimming whitespace once too much.Reproduction
Langium version: 1.0.0