How to configure the new (3.5+) syntax highlighter of Stash?

In pre-3.5 Stash if I wanted to add new extensions to the syntax highlighter, I had to redefine the entire list of extensions (instead of just listing the additional types), like this:

#Add syntax highlighting for misc. XML files (from wsdl onwards), REMOVE ONCE STASH VERSION IS >= 3.5.0
syntax.highlighter.xml.extensions=xml,html,htm,shtml,shtm,jsp,jspf,tag,jspx,dtd,xsd,xsl,xslt,wsdl,msbuild,props,csproj,vcxproj,config,ism,settings,vcproj,proj,shfbproj,targets,fsproj,filters

The part from xml to xslt was the default value, which I found somewhere then but cannot find now.

On this page, or any of the pages linked from here, I cannot find information about whether the new syntax highlighter engine needs to be configured the same way (redefining the whole list) or by only defining the additional extensions. Which one is it?

In case I need to redefine the whole list, where can I find the current default values?

PS.: On the page I mentioned above, the link in the sentence "Configuration for Stash 3.4 and below can be found here." is probably not the one it should be.

1 answer

1 accepted

Accepted Answer
0 votes

Hey @Balazs Szakmary

In Stash 3.5 you now only need to add the extra extensions you want you no longer need to include all the defaults.

Please also be aware that we are changing how we reference highlighters, we are now using mime types rather than names like "xml" it would now be "application/xml"

In your case the full line will be:

syntax.highlighter.application/xml.extensions=shtml,shtm,jsp,jspf,tag,jspx,dtd,xslt,wsdl,msbuild,props,csproj,vcxproj,config,ism,settings,vcproj,proj,shfbproj,targets,fsproj,filters

Also thanks for the info about the broken doc links, I'll try and get that fixed up.

[Link works now.] One more question: can I have multiple lines in the config for one mime type or does it have to be one long line?

Adam Ahmed Atlassian Team Jan 13, 2015

Haven't tested, but you might try http://stackoverflow.com/questions/8975908/how-to-write-multiple-line-property-value-using-propertiesconfiguration That is, backslash as the last character to "escape" the newline and keep it out of the resulting value.

That is good to know too, but I meant multiple entries in the config file starting with "syntax.highlighter.application/xml.extensions="

Adam Ahmed Atlassian Team Jan 14, 2015

I don't believe that would work (but feel free to try it and see). I don't think we have any code for joining multiple of the same property name and I don't think Java properties support that in the first place.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 21, 2018 in Bitbucket

Branch Management with Bitbucket

As a project manager, I have discovered that different developers want to bring their previous branching method with them when they join the team. Some developers are used to performing individual wo...

2,304 views 9 12
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you