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

Add .editorconfig highlighting as INI #8308

Merged

Conversation

yoav-lavi
Copy link
Contributor

@yoav-lavi yoav-lavi commented Sep 16, 2023

As discussed in #8076 (#8076 (comment)), this PR adds syntax highlighting for .editorconfig files as INI temporarily until Helix supports them directly.

While there is a difference between .editorconfig and INI syntax, it is very minor (see below) and most files are likely to highlight correctly, which should be a better compromise that not highlighting at all.

EditorConfig files use an INI format that is compatible with the format used by Python ConfigParser Library, but [ and ] are allowed in the section names. The section names are filepath globs, similar to the format accepted by gitignore. Forward slashes (/) are used as path separators and semicolons (;) or octothorpes (#) are used for comments. Comments should go individual lines. EditorConfig files should be UTF-8 encoded, with either CRLF or LF line separators.

cc @the-mikedavis

@the-mikedavis the-mikedavis added S-waiting-on-review Status: Awaiting review from a maintainer. A-language-support Area: Support for programming/text languages labels Sep 16, 2023
@yoav-lavi
Copy link
Contributor Author

yoav-lavi commented Sep 16, 2023

As far as I can tell these are the two cases in which [] will be used:

[name] | Matches any single character in name
[!name] | Matches any single character not in name

It appears that in these cases string highlighting will break (only for the specific section that used this, they'll be the same color as keys) but otherwise the result is still coherent and much better IMO than no highlighting (see images below)

Screenshot 2023-09-16 at 23 16 48 Screenshot 2023-09-16 at 23 16 42

@the-mikedavis the-mikedavis merged commit 8b076e3 into helix-editor:master Sep 16, 2023
6 checks passed
dgkf pushed a commit to dgkf/helix that referenced this pull request Jan 30, 2024
mtoohey31 pushed a commit to mtoohey31/helix that referenced this pull request Jun 2, 2024
smortime pushed a commit to smortime/helix that referenced this pull request Jul 10, 2024
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 S-waiting-on-review Status: Awaiting review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants