Open b-per opened 3 months ago
That would be an awesome improvement to the tool. Thanks for the suggestion! @Delta456 expressed interest in working on this, so will let him take a stab at solving this :cook:
As @bashbunni said, I will be working on implementing this.
Hey @b-per! Can you share code examples used with freeze
? It would help to understand the issue better.
Here is an example of code that combines SQL and Jinja. In the "dbt" world, it would be saved as .sql
file.
{{
config(
materialized='incremental'
)
}}
select
*
cola,
colb,
colc,
my_slow_function(my_column)
from {{ ref('app_data_events') }}
{% if is_incremental() %}
where event_time >= (select max(event_time) from {{ this }})
{% endif %}
In VSCode, I can get it formatted as:
SQL
Jinja
or Jinja-SQL
Ideally, freeze
would allow Jinja-SQL as well
My current implementation highlights the code like this:
Running: ./freeze --language jinja,sql file.sql
I believe this is the ideal behaviour.
Is your feature request related to a problem? Please describe. In my day to day, I write a lot of dbt code which leverages a lot of jinja-sql (e.g. Jinja syntax in conjunction with SQL).
freeze
can highlight those either as SQL or Jinja, but not as both (the Jinja code as Jinja and the SQL code as SQL, at the same time)Describe the solution you'd like It looks like chroma supports this type of multi-language highlighting already, when we define both a
language
and aroot
.freeze
could be updated to add an argument for a second language, or like the Jinja VSCode extension does, provide new languages, likejinja-sql
Describe alternatives you've considered Not getting both languages highlighting and doing screenshots in VSCode
Additional context N/A