dannymcgee / vscode-wgsl

Rich language support for WebGPU Shading Language
Apache License 2.0
14 stars 1 forks source link

Ignore superfluous top-level semicolons #14

Closed dannymcgee closed 4 months ago

dannymcgee commented 4 months ago

Currently, top-level statements like these will throw a parse error, due to the unexpected semicolons at the end of the statements:

#import foo::bar::baz;
                     ^
struct Foo {
    bar: f32,
    baz: f32,
};
 ^

This PR adds a check to discard semicolon tokens at the top level, which fixes the issue. In the future, this could be refactored to emit some kind of "hint" diagnostic.