dparnell / intellij-wgsl

WGSL plugin for IntelliJ and CLion
BSD 3-Clause "New" or "Revised" License
22 stars 10 forks source link

Nested array issue #55

Closed sagacity closed 1 year ago

sagacity commented 1 year ago

First of all, awesome plugin!

I'm noticing some odd behaviour with nested arrays: image

Adding a space between the brackets solves the issue.

rosingrind commented 1 year ago

I've tried to look into the issue, it seems that besides of a trivial problem with lexing/parsing rules, something may be wrong with generated lexer/parser classes. I'm on IU-2023.1 using plugin GK-2022.3.2 (jflex-1.9.1) but tested this with jflex-1.7.0-2 also and I've encountered something weird: if you erase gen directory and generate lexer + parser, you'll get a lot of diffs:

image

Most of these diffs are generated boilerplate getters/setters for internals. Are you using some kind of automation to perform generation? I'm questioning because of a known issue with gradle-based support for grammar-kit https://github.com/JetBrains/gradle-grammar-kit-plugin/issues/3

Some of generated files contained a bit of trivial to fix problems:

It seems to me that lexer and parser files may be not in sync to produce fully-correct output, or there are some hand-crafted parsing procedures (or it's just about updated jflex and grammar-kit). I'm writing this to ask if grammar files may be left hanging mid-refactoring, because if so - it's not possible for volunteers to fix any such issue. @dparnell please update the situation with any status, and thanks for the plugin!

rosingrind commented 1 year ago

Adding a space between the brackets solves the issue.

Produced from this, there is a brace-matching behavior bug. Assuming you have this code:

fn test() {
    let a = a[a[a]];
}

Place cursor after first opening { and press return - you'll get a matching pair inserted

fn test() {

}
    let a = a[a[a]];
}
dparnell commented 1 year ago

Hi @rosingrind I'm using the stuff in IntelliJ to generate the files. I'll take a look at what it is doing.

dparnell commented 1 year ago

I have just made release 0.0.25 which should fix the issue with nested arrays. It should become available on the marketplace in a couple of days

sagacity commented 1 year ago

Thanks for the fix!