Open samkessaram opened 4 years ago
hi @samkessaram
I can't do this right now. Is a bit out of scope for the project. But you can file a PR if you want, I'll would be glad if you could. Do you have any experience with javascript?
hi @samkessaram
I can't do this right now. Is a bit out of scope for the project. But you can file a PR if you want, I'll would be glad if you could. Do you have any experience with javascript?
Hey @mtxr! Turns out I have some time to attempt this. I'll submit a PR fairly soon. Thanks for the project by the way!
As I'm struggling with the same issue I was wondering if this feature has been implemented? According to #531 it was not merged because of code formatting issues?
Closing as there's more work to be done here re: indentation.
Is it planned to implement this feature or what exactly is missing in #531. Maybe I can help out, although my javascript experience is not vast.
Hey @tepene, I got sidetracked and this became less of a priority, though I'm game for opening it back up. I can't remember fully what indentation issues I was referring to in #531 but when I get a chance to look into it I'll let you know. Feel pull that branch and play around.
I could also really use this!
Any update here? Have folks found a workaround? I use DBT so this functionality is absolutely needed in an SQL formatter.
Yes, I want to add that this breaks DBT code on save by adding a space between curly brackets. Took me a bit of debugging to figure out it was this extension causing it.
is this shipped? or any workarounds? or any other package recommendations?
@ishpreet no developments here, but as a workaround you could try this to disable the SQLTools formatter:
"sqltools.formatLanguages": [],
to your settings.jsonPlease let us know if this works.
The problem: Short version: the formatter breaks Jinja templating syntax.
I'm developing models using dbt which uses Jinja templating for interpolating variables, introducing control flow structures, and reusing macros.
e.g.
dbt is pretty widely used (1.2k stars on GitHub), and there's at least one medium sized project that also uses Jinja with SQL.
Currently the formatter changes the above code from something like this:
{{ var('events_table') }}
into this:
{ { var('events_table') } }
which breaks the templating engine.
It would be awesome if there was a configuration option to preserve the Jinja formatting.
There are three cases:
(source: https://docs.getdbt.com/docs/getting-started-with-jinja)
The solution: A configuration option where we can declare that we'd like to preserve Jinja formatting. When enabled, it should not mess up the spacing described above.
Something like: