Git Product home page Git Product logo

Comments (13)

PaulGuillotte avatar PaulGuillotte commented on August 23, 2024 1

For your information, it's now working perfectly for me (on my 2 computers) with v0.1.0

from vscode-sqlfluff.

RobertOstermann avatar RobertOstermann commented on August 23, 2024

Please update to v0.0.6 and let me know if the problem is still occurring.

from vscode-sqlfluff.

jice-lavocat avatar jice-lavocat commented on August 23, 2024

Hi @RobertOstermann ,

I'm posting here since my latest comment was probably made under an irrelevant issue.

--

My colleagues using Windows have troubles to make our sqlfluff setup working even-though they are using v0.0.6.
I see that they are not alone by looking at the current issue, and to some other tickets (here or here).

As @reubster we think the issue relates to setting of the executable path. We have tried several paths and here is our latest settings.json.

{
    "workbench.colorTheme": "Default Dark+",
    "files.associations": {
        "*.sql": "jinja-sql"
    },
    "editor.bracketPairColorization.enabled": true,
    "diffEditor.ignoreTrimWhitespace": false,
    "sql.linter.executablePath": "C:/Anaconda/Scripts/sqlfluff",
    "sqlfluff.executablePath": "C:/Anaconda/Scripts/sqlfluff",
    "sqlfluff.linter.run": "onSave",
    "githubPullRequests.pullBranch": "never",
    "sqlfluff.config": ".sqlfulff",
    "sqlfluff.dialect": "bigquery",
    "sqlfluff.ignoreLocalConfig": true,
    "editor.rulers": [80],
    "sqlfluff.excludeRules": [
    
    ]
}

For the path, we tried several variations and got errors in the Dev Console, or as a warning popup in VScode.

  • C:\\Anaconda\\Scripts\\sqlfluff
  • C:/Anaconda/Scripts/sqlfluff

Resulted in an error in the dev console

workbench.desktop.main.js:86 [Extension Host] SyntaxError: Unexpected token E in JSON at position 0
	at JSON.parse (<anonymous>)
	at c:\Users\pguillotte\.vscode\extensions\dorzey.vscode-sqlfluff-0.0.6\out\src\extension.js:3:4751
	at Array.forEach (<anonymous>)
	at L.process (c:\Users\pguillotte\.vscode\extensions\dorzey.vscode-sqlfluff-0.0.6\out\src\extension.js:3:4722)
	at Socket.a (c:\Users\pguillotte\.vscode\extensions\dorzey.vscode-sqlfluff-0.0.6\out\src\extension.js:3:3611)
	at Socket.emit (node:events:402:35)
	at endReadableNT (node:internal/streams/readable:1343:12)
	at processTicksAndRejections (node:internal/process/task_queues:83:21)

Capture d’écran 2022-08-24 à 17 05 01

  • /c/Anaconda/Scripts/sqlfluff

Resulted in a warning message in VSCode saying the executable was not found.

Cannot lint path/to/file . The executable was not found. Use the 'Executable Path' setting to configure the location of the executable.

Capture d’écran 2022-08-24 à 17 18 38

--

I know it's probably an issue unrelated to SQLfluff per se, but would you have any advice to fix the path to the executable issue?

from vscode-sqlfluff.

noel avatar noel commented on August 23, 2024

Are you sure that the right Python environment is selected in vs Code?

from vscode-sqlfluff.

jice-lavocat avatar jice-lavocat commented on August 23, 2024

I'm not sure which environment is the good one, but for the previously mentioned case, the only available interpreter is C:\Anaconda\python.exe

Capture

from vscode-sqlfluff.

RobertOstermann avatar RobertOstermann commented on August 23, 2024

I think this is a problem with the extension reading the JSON response from the sqlfluff linter. Can you check the output for the command sqlfluff lint --format json {other arguments and filename} when run on the file/files you are having issues with? That should give you a JSON response and you could check if the response is a valid JSON string or not.

from vscode-sqlfluff.

PaulGuillotte avatar PaulGuillotte commented on August 23, 2024

Hello @RobertOstermann ! I'm @tanzaho 's colleague having the issue with the SQL Fluff extension on VS Code (Windows).
The JSON I get using your method is the following :

[{"filepath": "models\\marts\\core\\fct_ads.sql", "violations": [{"line_no": 6, "line_pos": 82, "code": "L001", "description": "Unnecessary trailing whitespace."}, {"line_no": 6, "line_pos": 83, "code": "L016", "description": "Line is too long."}, {"line_no": 13, "line_pos": 7, "code": "L010", "description": "Keywords must be lower case."}]}]

which looks like a valid JSON when checked using a validator. Maybe the problem is elsewhere ? The \\ in the path seems a bit suspicious

from vscode-sqlfluff.

RobertOstermann avatar RobertOstermann commented on August 23, 2024

@PaulGuillotte I have recently released v0.0.7 which replaces the \\ with / and hopefully helps fix your issue. Give that version a try and let me know if it works.

from vscode-sqlfluff.

PaulGuillotte avatar PaulGuillotte commented on August 23, 2024

Thanks for your answer !
Unfortunately, I've got the same JSON with the 0.0.7, with the \\ in the path.

from vscode-sqlfluff.

RobertOstermann avatar RobertOstermann commented on August 23, 2024

So you are still getting this error in the dev console after the update? You should be using one of these two paths.

  • C:\\Anaconda\\Scripts\\sqlfluff
  • C:/Anaconda/Scripts/sqlfluff
workbench.desktop.main.js:86 [Extension Host] SyntaxError: Unexpected token E in JSON at position 0
	at JSON.parse (<anonymous>)
	at c:\Users\pguillotte\.vscode\extensions\dorzey.vscode-sqlfluff-0.0.6\out\src\extension.js:3:4751
	at Array.forEach (<anonymous>)
	at L.process (c:\Users\pguillotte\.vscode\extensions\dorzey.vscode-sqlfluff-0.0.6\out\src\extension.js:3:4722)
	at Socket.a (c:\Users\pguillotte\.vscode\extensions\dorzey.vscode-sqlfluff-0.0.6\out\src\extension.js:3:3611)
	at Socket.emit (node:events:402:35)
	at endReadableNT (node:internal/streams/readable:1343:12)
	at processTicksAndRejections (node:internal/process/task_queues:83:21)

from vscode-sqlfluff.

PaulGuillotte avatar PaulGuillotte commented on August 23, 2024

Yes, I tried with both paths you mentionned and in both cases I've got he same error in the dev console, which is the one you pasted above.

For your information, i'm also trying on another computer with a different error.

Computer 1 : Not working with the parameter templater = dbt or templater = jinja, getting the Unexpected token E in JSON at position 0 in the console

Computer 2 : Working with templater = jinja, but getting an error with templater = dbt which is :

Error: Illegal argument: line must be non-negative
	at k (c:\Users\paulg\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:7:1279)
	at new g (c:\Users\paulg\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:78:87257)
	at new g (c:\Users\paulg\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:78:86652)
	at new c (c:\Users\paulg\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:78:89354)
	at new c (c:\Users\paulg\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:78:86652)
	at c:\Users\paulg\.vscode\extensions\dorzey.vscode-sqlfluff-0.0.7\out\src\extension.js:3:4876
	at Array.forEach (<anonymous>)
	at c:\Users\paulg\.vscode\extensions\dorzey.vscode-sqlfluff-0.0.7\out\src\extension.js:3:4841
	at Array.forEach (<anonymous>)
	at c:\Users\paulg\.vscode\extensions\dorzey.vscode-sqlfluff-0.0.7\out\src\extension.js:3:4816
	at Array.forEach (<anonymous>)
	at L.process (c:\Users\paulg\.vscode\extensions\dorzey.vscode-sqlfluff-0.0.7\out\src\extension.js:3:4724)
	at Socket.l (c:\Users\paulg\.vscode\extensions\dorzey.vscode-sqlfluff-0.0.7\out\src\extension.js:3:3613)
	at Socket.emit (node:events:402:35)
	at endReadableNT (node:internal/streams/readable:1343:12)
	at processTicksAndRejections (node:internal/process/task_queues:83:21)```

from vscode-sqlfluff.

RobertOstermann avatar RobertOstermann commented on August 23, 2024

Ok, I am out of ideas. If you wanted to pull down this repo and debug the problem yourself you might have some luck. I'll throw on the help wanted tag and maybe someone else will have more knowledge of how to solve this problem.

from vscode-sqlfluff.

RobertOstermann avatar RobertOstermann commented on August 23, 2024

Closing this issue. For any other problems, please create a new issue.

from vscode-sqlfluff.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.