feat: use custom Nix highlight queries for richer syntax colors
- queries/nix-highlights.scm: Adapted from Helix editor queries. Properly identifies functions, properties, variable parameters, escape sequences, and string interpolation. Much richer than the bundled tree-sitter-nix query (99 lines vs 113 lines). - src/highlight.rs: Load custom Nix query via include_str! instead of using bundled HIGHLIGHTS_QUERY. - static/style.css: Fix variable (#e36209) and punctuation (#586069) colors to be distinct from text color. Results: hl-function now appears (6 occurrences), hl-property visible (17), hl-variable reduced from 43 to 17. Functions like mkShell now render in purple/blue instead of orange.
This commit is contained in:
@@ -145,7 +145,7 @@ fn get_config(lang: Language) -> HighlightConfiguration {
|
||||
Language::Nix => (
|
||||
tree_sitter_nix::LANGUAGE.into(),
|
||||
"nix",
|
||||
tree_sitter_nix::HIGHLIGHTS_QUERY,
|
||||
include_str!("../queries/nix-highlights.scm"),
|
||||
),
|
||||
Language::Python => (
|
||||
tree_sitter_python::LANGUAGE.into(),
|
||||
|
||||
Reference in New Issue
Block a user