-
-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update "format document" and "format selection to use dbt-core-interface #120
Update "format document" and "format selection to use dbt-core-interface #120
Conversation
Hi @RobertOstermann, is |
I think it is, the readme is just not updated. Not sure on that though |
I don’t think that works. We want to remove that option On Jan 5, 2024, at 11:21 AM, Robert Ostermann ***@***.***> wrote:
I think it is, the readme is just not updated. Not sure on that though
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
@noel I just tested this and formatting selection works when not using dbt interface (I didn't test with dbt) so the option should not be removed. |
@barrywhart I thought sqlfluff didnt support this. If it is just something not implemented in core interface then we keep it. @BAntonellini Were you not able to hide the option when dbt interface is enabled? |
@noel sqlfluff might not support this directly, but just passing in the selection text directly allows me to format the selection. I think it would be possible to hide the format selection option, but I'm not sure |
@noel: Re: "Format selection", SQLFluff does not support it. It always formats or fixes an entire file (or a passed-in string). From what @RobertOstermann says, perhaps VSCode is passing the entire file as a string to SQLFluff, then determining which portion of the formatted result corresponds to the current selection, then updating only that portion in the editor. This is just guesswork; I don't know. At the moment, it seems like we still don't understand the current behavior of vscode-sqlfluff and @noel, would you or @BAntonellini like to do some research and experimentation with NOTE: As currently written, this PR removes |
@barrywhart The format selection logic is handled within the |
@RobertOstermann: Ok, so it should be possible to do the same with dbt-core-interface if we add support for passing in a string. @noel: Do we want to do this? |
@RobertOstermann: Can you take a look at this PR? Noel at Datacoves says it is working for them. The build is apparently failing for reasons unrelated to these changes. |
@barrywhart It looks like this is some typescript types error and I would probably agree this is not related to this PR. I am not sure what would be causing the error. I am currently busy with other projects and do not have time to look into this closely, but I would imagine the fix is not too difficult. |
@BAntonellini would you be able to see if you can find the error? |
@barrywhart I've merged Master into your branch and compilation issues seem to be gone. ➜ vscode-sqlfluff git:(bhart-add_sqlfluff_format) npm run compile
> [email protected] compile
> rimraf out && tsc -p ./ && npm run postbuild
> [email protected] postbuild
> copyfiles "./test/suite/test_sql/**/*.sql" "./out" && copyfiles "./test/.sqlfluff" "./out" |
@BAntonellini: It looks like the build is still failing. The MacOS build has this error:
Not sure if this is the same error as before, but I remember it was a type-related error in code that I hadn't touched. |
Hey @RobertOstermann, CI is passing. This can now be merged. |
Summary of changes:
/format
endpoint/format
endpointNOTE: I suggest reviewing the PR with "Hide whitespace" enabled, as some of the changes simply add
if
blocks around existing code.The build is currently failing in the "Run tests" step for what appears to be an issue unrelated to my changes. Any insights? Log excerpt follows: