-
I would appreciate some help getting syntax highlighting to work for a custom language definition. So I'm working on ec2hx to provide EditorConfig support for Helix. One of the most difficult features is to customize stuff based on arbitrary globs instead of for individual languages. My idea was to configure a new language for each glob and copy-paste most of the config from the original language. This mostly works, except for syntax highlighting. For example, the Linux kernel has the following editorconfig section:
From that, [[language]]
name = "ec2hx-glob-lang-tools/perf/**.py" # <--- generated name
scope = "source.python"
injection-regex = "py(thon)?"
file-types = [{ glob = "tools/perf/**.py" }] # <--- custom glob
shebangs = ["python", "uv"]
roots = ["pyproject.toml", "setup.py", "poetry.lock", "pyrightconfig.json"]
comment-token = "#"
language-servers = ["ruff", "jedi", "pylsp"]
indent = { unit = "\t", tab-width = 8 } # <--- actual customization
grammar = "python" # <--- my attempt to get syntax highlighting to work ❌ Does anybody have an idea what about this language configuration is preventing the syntax highlighting from working? Thanks for any help! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Ah, I dug through the Helix source a little and I think it's looking for textobject queries for the language with the weird generated name (which doesn't exist). I might have to generate these queries as well, which can just inherit from the actual language. Gonna try that. |
Beta Was this translation helpful? Give feedback.
-
I got the syntax highlighting working by adding queries to the runtime directory. Unfortunately, there is no "workspace runtime directory", so I had to add it to my user config runtime directory. Ideally I want to avoid that fo |
Beta Was this translation helpful? Give feedback.
I got the syntax highlighting working by adding queries to the runtime directory. Unfortunately, there is no "workspace runtime directory", so I had to add it to my user config runtime directory. Ideally I want to avoid that fo
ec2hx
, spamming the user config directory. But that's a separate issue, will mark this as resolved.