hsimpson / vscode-glsllint

VSCode extension to lint GLSL shading language files
MIT License
80 stars 13 forks source link

error-column matching #81

Open FrostKiwi opened 3 weeks ago

FrostKiwi commented 3 weeks ago

Until now, glslangValidator did not output error columns, so vscode-glsllint displayed the error at the start of the line, in column 1. Thanks to @antaalt and his https://github.com/KhronosGroup/glslang/pull/3614, we now have the error column reported by glslangValidator. This Pull Request adds compatibility for this.

Before this PR (or without --error-column) This PR
image image

Functionality

If you have updated glslangValidator to a version that supports this, you can specify --error-column among glsllint.glslangValidatorArgs. Like this: "glsllint.glslangValidatorArgs": ["--error-column"]

Since there is no official release version yet, nightly builds of glslangValidator can be had here: https://github.com/KhronosGroup/glslang/releases/tag/main-tot

If --error-column is among the arguments, a new regex is used to pull the column and display the error squiggly accordingly.

antaalt commented 3 weeks ago

Nice work, I had some code in local to test it, it could be even better to use an optional regex group for the column tag in order for the regex to support both log format without having to care if glslang support the option, such as /(WARNING|ERROR):\s+(\d|.*):(\d+):(?:(\d+):)\s+(.*)/, this way, no need to check for the option support, and it will work for both versions of glslang

FrostKiwi commented 2 weeks ago

it could be even better to use an optional regex group for the column tag in order for the regex to support both log format without having to care if glslang support the option, such as /(WARNING|ERROR):\s+(\d|.*):(\d+):(?:(\d+):)\s+(.*)/

Didn't consider this. A good change, I added it and removed the check for the --error-column argument. I had to modify the regex some more, because it kept matching against stdin in the non---error-column case. Code got definitely simpler 👍

Hope to address that vscode-glsllint only matches the first error and ignores the rest of the errors in a following PR.

hsimpson commented 2 weeks ago

@FrostKiwi thanks for the PR, I will have a look into it.