PedramNavid / dbtpal

Neovim plugin for dbt
93 stars 8 forks source link

Syntax highlighting incorrectly formatting as a string #24

Open deanmorin opened 7 months ago

deanmorin commented 7 months ago

A single apostrophes in a comment will make all of the subsequent sql be highlighted as a string:

select
  1,
  -- apostrophe in comment '
  2

image

select
  1,
  /* apostrophe in comment ' */
  2

image

Quoted macro calls will do the same thing:

{{
  config(
    post_hook = "{{ my_post_hook() }}",
  )
}}

select 1

image

It still happens with just "{{ }}", it seems to be the double braces. If you remove one of the pairs it stops happening. It also stops happening if you remove the surrounding quotes.

cmpadden commented 4 months ago

There is a treesitter syntax from dbt-labs, however, they currently state that it is incomplete. We may want to keep our eyes on it for updates.

https://github.com/dbt-labs/tree-sitter-jinja2

This Jinja2 grammar for tree-sitter is currently incomplete.

PedramNavid commented 4 months ago

Oddly, I don't get this behavior with the first two examples:

image image

However, #0950ceb88ae898a23f78a4d12fbeeee4cb5dad5e fixes the issue with nested jinja templates:

image

Let me know if you still have issues with the first two.