Comments (6)
Thanks for the quick response. I pulled down the update, and unfortunately it wasn't the fix. I did however come to find a solution. It appears to be a PATH issue. Using pyenv-win, sqlfluff ends up pointing to {userprofile}.pyenv\pyenv-win\shims\sqlfluff.bat. Dropping that into "sqlfluff.executablePath" resolved the issue. Didn't seem like it would be the cause of the problem, as the shims directory is in my system path, but that ended up being the fix.
from vscode-sqlfluff-extended.
I could use a bit more information. I am not seeing this problem on my end, but have seen it before. It would help if I could replicate the problem, so here are the questions I have.
- What version of this extension are you using? If you are not on the latest version I would recommend updating.
- What version of sqlfluff are you using?
- Do you have any extension specific settings setup in your settings.json file?
- Is the formatting doing this for any SQL file, or just in specific cases?
- What happens when you run
sqlfluff fix --force --dialect ansi
from the command line?- This extension basically uses that command to format the document. If the command clears the content of the file then the extension will as well.
If you could provide answers that should help me narrow down the problem.
Edit: Also, it is weird that the linter is working but the formatter is not. Typically they either both work or both fail.
from vscode-sqlfluff-extended.
Hey @RobertOstermann, firstly thank you for the work on the extension thus far. I'm following up on this thread as I am running into the same issue after installing the extension today.
Running the command you gave results in the expected outcome from sqlfluff on either all files or even a specifically targeted file. However, just running the format document command, with the extension as handler for SQL files, results in the file contents being replaced with "spawn sqlfluff ENOENT"
Extension version: 0.1.5
OS: Windows 11
sqlfluff version: 0.13.2
dbt installed via pyenv + pip, though it is currently the only version of python on the machine
Nothing in settings.json of note
All SQL files
from vscode-sqlfluff-extended.
@marshallbroussard I have published version 0.1.6 with a possible fix to this problem. The version adds the configuration option sqlfluff.format.workingDirectory
that allow you to set the directory the sqlfluff --fix
command is run from. I think the problem was the directory was chosen based upon a root path that might not have existed. You should be able to leave the sqlfluff.format.workingDirectory
setting as the default, but if you still see that error then try changing that configuration option to a path that you know the sqlfluff --fix
command works from.
from vscode-sqlfluff-extended.
I'm glad you were able to find a solution! I'm a bit surprised it was a PATH issue, it's weird that you have the directory in your system path and it wasn't working here. I also hadn't made many changes to the FormattingProvider as I didn't have many issue with it using the original code that I forked this extension from, but it must not be using the same process creation as the Linter which would be why there was only a problem with the Formatter.
from vscode-sqlfluff-extended.
I was having the same issue with the original that you forked from, and it had a number of open issues that were pointing towards it being an issue with python virtual environments IIRC. Regardless, thanks again!
from vscode-sqlfluff-extended.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-sqlfluff-extended.