sqlfluff/vscode-sqlfluff

VSCode not highlighting linter errors

petertheguy opened this issue · 3 comments

When using the sqlfluff extension in vscode (v2.2.4), I don't see any linting violations highlighted in my code even though I expect violations based on the .sqlfluff configuration. When using sqlfluff in the CLI (sqlfluff lint), I see all expected violations being flagged.

I'm using templater = dbt and dialect = tsql. I have the extension set to run the linter on save (as mentioned in the extension config). I have the following settings also configured in an attempt to force resolve this issue, but to no avail:

Screenshot 2023-03-02 at 16 46 59

Screenshot 2023-03-02 at 16 47 07

Am I missing something obvious here?

@petertheguy Were you using this extension before v2.2.4 and if so was it working for you? I don't see anything obvious wrong with your setup, but perhaps the config file is not for the correct path? Even so, I would have expected it to work with the ignore local config unchecked.

You could check the output tab for the SQLFluff channel and see if it is executing the command you would expect it to and is showing the correct violations. That would help determine if it is a setup issue or if the extension is not correctly adding the problems to VSCode.

@RobertOstermann thanks for the suggestion. I'm not entirely certain if the extension worked before v2.2.4 as I had a conflicting linter, dbt-formatter, that I just uninstalled a couple of days ago. This is the output I originally received:

Screenshot 2023-03-03 at 09 06 55

So clearly the extension didn't know where to find the config file, so I provided it with the absolute path to where the config is saved. THis is the output this time:

Screenshot 2023-03-03 at 09 07 24

This feels like a step in the right direction, but the extension is still not flagging things as expected. Here is the output from the CLI for the same file as the screenshots above:

Screenshot 2023-03-03 at 09 12 20

I have all SQLFluff rules set as warnings currently while we onboard the tool, could this be a reason why? Does the extension only highlight linting issues that would result in a failure?

@RobertOstermann I just tested making all rules failures instead of warnings in the .sqlfluff config and that seems to have been the last piece of the puzzle:

Screenshot 2023-03-03 at 09 42 03

Screenshot 2023-03-03 at 09 42 39

Thank for the suggestions, I'll go ahead and close this.