sqlfluff / vscode-sqlfluff

An extension to use the sqlfluff linter in vscode.
https://marketplace.visualstudio.com/items?itemName=dorzey.vscode-sqlfluff
MIT License
156 stars 33 forks source link

VS Code version 1.92 is not highlighting syntax errors anymore #154

Open Julien-Rogers opened 3 months ago

Julien-Rogers commented 3 months ago

First, I want to express my gratitude for the hard work the team has put into the SQLFluff extension. It has been an invaluable tool in maintaining SQL code quality, and I deeply appreciate the ongoing effort to keep it updated and functional.

After updating to VS Code version 1.92, I’ve encountered an issue where the extension no longer highlights errors in my SQL files. This issue persists across three different machines, all running Windows, which suggests it might be a broader compatibility problem with the latest VS Code update. It seems to be related to the fact that, I’m not receiving close events anymore, which was working fine in the previous version of VS Code.

P.S. Rolling back to 1.91 seems to make SQLFluff work again.

Following are more details about config and Sqlfluff outputs:

Old vscode version: Version: 1.91.1 (user setup) Commit: f1e16e1e6214d7c44d078b1f0607b2388f29d729 Date: 2024-07-09T22:06:49.809Z Electron: 29.4.0 ElectronBuildId: 9728852 Chromium: 122.0.6261.156 Node.js: 20.9.0 V8: 12.2.281.27-electron.0 OS: Windows_NT x64 10.0.19045


Reading from file, not stdin

--------------------Executing Command--------------------

C:\Users\...\.pyenv\pyenv-win\shims\sqlfluff.BAT lint --format json myfolder/myfile.sql

------------------------------------------------------------

Received close event, code 1 signal null
Raw stdout output:

------------------------------------------------------------

[{"filepath": "myfolder\\myfile.sql", "violations": [{"start_line_no": 30, "start_line_pos": 25, "code": "LT01", "description": "Unnecessary trailing whitespace.",..., "TQ01": 0.0}}]

New vscode version: Version: 1.92.2 (user setup) Commit: fee1edb8d6d72a0ddff41e5f71a671c23ed924b9 Date: 2024-08-14T17:29:30.058Z Electron: 30.1.2 ElectronBuildId: 9870757 Chromium: 124.0.6367.243 Node.js: 20.14.0 V8: 12.4.254.20-electron.0 OS: Windows_NT x64 10.0.19045

------------------------------------------------------------

Reading from file, not stdin

--------------------Executing Command--------------------

C:\Users\...\.pyenv\pyenv-win\shims\sqlfluff.BAT lint --format json myfolder/myfile.sql

------------------------------------------------------------
RobertOstermann commented 3 months ago

That is odd. I just tried on Windows and it seems to work for me. What version of SQLFluff (extension and command line) are you on?

Julien-Rogers commented 3 months ago

Thanks for your help, Robert. I tried with command line version sqlfluff==3.1.0 and sqlfluff==3.1.1. And Extensions v3.1.5 and just tried with v3.2.0.

I still get the Execute command, but no Received close events. This even appears with the first command that looks for the version of sqlfluff.

--------------------Executing Command--------------------

C:\Users\...\.pyenv\pyenv-win\shims\sqlfluff.BAT --version

------------------------------------------------------------
RobertOstermann commented 3 months ago

Have you tried running that command on the command line? Does it return the version correctly? I haven't done much with running SQLFluff through the pyenv before, so my guess is something funky is going on there. But not sure why updating VSCode would change the behavior of this.

Julien-Rogers commented 3 months ago

I have tried to run SQLFluff in the command line (that is what I do when I am on 1.92, since it is the only way to lint), and it still works well. Updating VSCode doesn't change the output that I get from the command line: sqlfluff, version 3.1.1

I am unsure why it changes the capacity to get highlighting in the IDE, and if it is even related to pyenv. In the end, I simply use a .bat file that I point to in the extension config.

Thanks for your help!