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

Highlighting breaks on "binding_array" declaration #67

Closed
jaakkojakara opened this issue Sep 11, 2023 · 7 comments
Closed

Highlighting breaks on "binding_array" declaration #67

jaakkojakara opened this issue Sep 11, 2023 · 7 comments

Comments

@jaakkojakara
Copy link

jaakkojakara commented Sep 11, 2023

I'm facing some problems with binding_array declarations.

With this code:

@group(0) @binding(0)
var example_binding: binding_array<texture_2d<f32>>;

I get the following error: WGSLTokenType.EQUAL or WGSLTokenType.SEMICOLON expected, got '<' on the first open angled bracket, and highlighting for the rest of the file is broken.

@dparnell
Copy link
Owner

It looks like the plugin does not currently understand binding_array I will take a look at the parser definition and see what else has changed recently.

@dparnell
Copy link
Owner

According to the wgsl spec binding_array is a reserved word and must not appear in wsgl source code.

@jaakkojakara
Copy link
Author

jaakkojakara commented Sep 14, 2023

Thanks for checking this, so binding_array is actually a feature in wgpu flavour of wgsl, where it is used as a frontend for naga and subsequently transpiled to some other shader format depending on the platform.

The reason it is a reserved keyword in webgpu spec is actually because wgpu project asked for that, so that it is clear it's not supported in web flavour of wgsl. See this PR: gpuweb/gpuweb#2794

One question I guess is does this plugin aim to support wgsl files written for wgpu? For context, I did a quick and dirty search on GitHub on projects that contain .wgsl files, and seems that most of them are written for wgpu, so at least currently it seems to be a major use case for wgsl language.

edit: FWIW, seems that wgsl-plugin for vscode does support it: wgsl-analyzer/wgsl-analyzer#24

@dparnell
Copy link
Owner

I use the plugin for wgpu stuff also. I can add it in without too much hassle.

@dparnell
Copy link
Owner

I have just submitted a new release to the Jetbrains store with support for binding_array. It can take a couple of days for them to process the new release.

@dparnell
Copy link
Owner

The updated plugin should be available in the Jetbrains store now. let me know if this fixes your issue.

@jaakkojakara
Copy link
Author

Updated the plugin and everything works now, thank you so much!

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

No branches or pull requests

2 participants