sitr.us

Embedded SQL highlighting in Neovim, a look into Treesitter, and some NixOS patching (opens in new tab)

Discussed on r/NixOS and r/neovim

This is the story of the rabbit hole I went down because I wanted pretty syntax highlighting for embedded SQL queries in my Rust code. I’m a fan of sqlx, which provides macros for writing inline SQL with real-time type checking. Because the queries are in Rust strings the whole query is highlighted uniform green by default. That’s not acceptable! By the end of my journey I had highlighting looking like this: In most cases this kind of embedded syntax highlighting is easy in Neovim, and it’s o...

Read the original article
Sign in to keep reading the full article.

Keyboard Shortcuts

Navigation

Next / previous post
j/k
Open post
oorEnter
Preview post
v

Post Actions

Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Save / unsave
s

Recommendations

Add interest / feed
Enter
Not interested
x

Go to

Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Discover
gb
Search
/

General

Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help