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

Bash syntax highlighting not selected for *.ebuild and *.eclass files #1292

Closed
vincentdephily opened this issue Oct 8, 2020 · 4 comments · Fixed by #1356
Closed

Bash syntax highlighting not selected for *.ebuild and *.eclass files #1292

vincentdephily opened this issue Oct 8, 2020 · 4 comments · Fixed by #1356

Comments

@vincentdephily
Copy link

What version of bat are you using?
bat 0.15.4

Describe the bug you encountered:
Bat didn't syntax-highlight an ebuild file despite .ebuild aledgedly being one of the recognized filename patterns. Using bat -lbash or bat -l.ebuild works around the bug.

Playing with file names reveals the issue: the .ebuild and .eclass patterns are mistakenly categorized as whole filename patterns instead file extensions patterns.

Describe what you expected to happen?

  • All filename patterns mentioned in bat -L|rg bash should trigger bash syntax highliting.
  • The docs should make it clear which patterns are whole-filename and which are extension

How did you install bat?
emerge bat and cargo install bat (two binaries, same behaviour).


system

$ uname -srm
Linux 5.8.13-gentoo x86_64

$ lsb_release -a
LSB Version: n/a
Distributor ID: Gentoo
Description: Gentoo Base System release 2.7
Release: 2.7
Codename: n/a

bat

$ bat --version
bat 0.15.4

$ env
PAGER=/usr/bin/less

bat_config

bat_wrapper

No wrapper script for 'bat'.

bat_wrapper_function

No wrapper function for 'bat'.

No wrapper function for 'cat'.

tool

$ less --version
less 551 (PCRE2 regular expressions)

@vincentdephily vincentdephily added the bug Something isn't working label Oct 8, 2020
@vincentdephily
Copy link
Author

Updated bat to version 0.16.0, same issue.

@sharkdp
Copy link
Owner

sharkdp commented Oct 8, 2020

Thank you for the detailed bug report. I can reproduce this.

The issue seems to be that these two patterns are wrongly added with a leading dot in sublimehq/Packages:
https://github.com/sublimehq/Packages/blob/a275e61fe18cac70f0450bf3cef30dd83bcf895e/ShellScript/Bash.sublime-syntax#L27-L28

This could easily be fixed. However, the larger problem is that sublimehq/Packages is apparently moving to a new sublime-syntax format that is not supported by syntect, I believe 😦. I'm sure @keith-hall would know more about this.

Short term, we could fix this by adding a syntax-mapping to bat in src/syntax_mapping.rs.

If you want to have a local fix, you can add

--map-syntax '*.{ebuild,eclass}:Bourne Again Shell (bash)'

to bats config file (see README)

Edit: I have opened a PR here: sublimehq/Packages#2541

@keith-hall
Copy link
Collaborator

Yeah, syntect will need some major changes to cater for the latest .sublime-syntax features... One such one is trishume/syntect#271

In the meantime, I guess we will have to stay on the current sublimehq/Packages submodule version and include/maintain a load of patches in this repository (or wherever we will keep them in future re #1266 (comment))

@sharkdp
Copy link
Owner

sharkdp commented Nov 23, 2020

Fixed in bat v0.17.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants