Sublime Forum

Brackethighlighter bash matching if fi doesn't work

#1

Hello, it seems that since Sublime 3.1 something changed in the functionality of the brackethighlighter plugin in bash scripts. It used to highlight if … fi constructs, and do … done, case … esac. It seems to be still in the configuration, see below, but it doesn’t work. Any suggestion to get it working again?

  //Bash
        {
            "name": "bash",
            "open": "(?:(?<!\\\\\\n)(?:;|^|&|\\|)\\s*)\\b(if|case|while|select|until|for)\\s",
            "close": "(?:(?<!\\\\\\n)(?:;|^)\\s*)\\b(fi|esac|done)(?=;|\\s|$)",
            "style": "default",
            "scope_exclude": ["string", "comment"],
            "plugin_library": "bh_modules.bashsupport",
            "language_filter": "whitelist",
            "language_list": ["Shell-Unix-Generic"],
            "enabled": true
        },
0 Likes

#2

Works for me, but you really haven’t provide much information for me to guess what the issue is. I assume it most likely related to some local setup on your system.

0 Likes

#3

It’s possible you are using the “Bourne Again Shell (bash)” syntax, while that configuration only applies to the “Shell-Unix-Generic” syntax. The Shell-Unix-Generic syntax is deprecated and currently hidden. I haven’t tested this, but you might get the desired functionality when you change the line

"language_list": ["Shell-Unix-Generic"],

to

"language_list": ["Shell-Unix-Generic", "Bourne Again Shell (bash)"],
1 Like

#4

Looks like the language_list is the problem, I found I had one shell script still open which was having the Shell-Unix_Generic language activated (guess I had it open for a long time), and there the if…fi matching worked fine. Unfortunately, I cannot select that language anymore.
So, I tried the suggested change to the language_list, but that doesn’t seem to work. I am using the latest Sublime version build 3176, just freshly installed, have the problem on all my systems (Windows 10 btw, not Linux).

Peter

0 Likes

#5
"language_list": ["Shell-Unix-Generic", "Bash"],

It’s done by file name, not by display name.

2 Likes

#6

On a side note, I use ApplySyntax which is referencing the outdated Shell-Unix-Generic which is why I haven’t noticed this…So I need to update that too.

1 Like

#7

thanks, that does the trick!

0 Likes