Skip to content

Bug in sqlx query highlighting for Rust #8608

Closed
@rmehri01

Description

@rmehri01

Summary

Based on a bisect from the 23.05 release, it seems like #7621 caused the highlighting of the sqlx query macros to stop working:

Before:

image

After:

image

I think this is because the injection query for normal macros overwrites the whole thing, when really we just want the nested query to be SQL and the rest should be Rust:

((macro_invocation
(token_tree) @injection.content)
(#set! injection.language "rust")
(#set! injection.include-children))

There's also a smaller regression that #6793 removed the highlighting for query_unchecked that #6256 introduced but that is fairly easy to fix :)

Reproduction Steps

I tried this:

  1. hx on a Rust file with any sqlx query, such as sqlx::query!("SELECT id FROM posts")

I expected this to happen:

The SQL string should be highlighted properly.

Instead, this happened:

It is just highlighted as a normal Rust string.

Helix log

N/A

Platform

Linux

Terminal Emulator

Kitty

Helix Version

23.05-498-g68c7537d

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-tree-sitterArea: Tree-sitterC-bugCategory: This is a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions