Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust Leptos view! macro html highligting. #9622

Closed
SofusA opened this issue Feb 13, 2024 · 2 comments
Closed

Rust Leptos view! macro html highligting. #9622

SofusA opened this issue Feb 13, 2024 · 2 comments
Labels
A-language-support Area: Support for programming/text languages C-enhancement Category: Improvements

Comments

@SofusA
Copy link

SofusA commented Feb 13, 2024

Leptos uses view! macro for html instead of html!.
Syntax highlighting is therefore not switched to html.

It could be solved like #8603.

Issue for html! macro: #4466

@SofusA SofusA added the C-enhancement Category: Improvements label Feb 13, 2024
@pascalkuthe
Copy link
Member

While the name html is unambigous view! macros are absolutely used for other purposes aswell so I don't think just injection html into every macro named view is a good idea. You can modify the query locally but I don't think we should be doing this by default

@SofusA
Copy link
Author

SofusA commented Feb 13, 2024

Yeah i agree. The problem is with Leptos' macro naming and not with Helix.

I have added the following block in ~/.config/helix/runtime/queries/rust/injections.scm so solve this locally:

((macro_invocation
   macro:
     [
       (scoped_identifier
         name: (_) @_macro_name)
       (identifier) @_macro_name
     ]
   (token_tree) @injection.content)
 (#eq? @_macro_name "view")
 (#set! injection.language "html")
 (#set! injection.include-children))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-language-support Area: Support for programming/text languages C-enhancement Category: Improvements
Projects
None yet
Development

No branches or pull requests

3 participants