WebIDE doesn't highlight syntax of Perl modules correctly
Summary
We do use locally latest release of GitLab CE.
We have some projects written in Perl which consists of hundreds of Perl modules(with .pm extension).
While we do have more or less correct syntax highlight in single-page file preview,
on WebIDE we see just plain text.
API reports that mime_type of file is application/x-pagemaker.
I did a little discovery and find out that you use two different editors:
- ACE
- Monaco
The first one highlights the syntax correctly on basis of a file extension as it seems.
While the second one orients on mime-type.
mime-types utilized in detection and first result is taken which gives us this result:
root@aac38ed14ab5:/tmp# ruby t.rb
application/x-python
application/x-pagemaker
application/x-perl
root@aac38ed14ab5:/tmp# cat t.rb
require 'mime/types'
puts MIME::Types.type_for('py')
puts MIME::Types.type_for('pm')
Since GitLab CE uses only first value returned, which is application/x-pagemaker.
Obviously, unlikely we do use this ancient Adobe software.
It actually surprised me why this library thinks that python and perl scripts are binary files.
Steps to reproduce
- Open any Perl module in
WebIDE - See no syntax highlight whatsoever
What is the current bug behavior?
No syntax highlights for Perl modules in WebIDE.
What is the expected correct behavior?
Perl modules obtain syntax highlighting in WebIDE
Possible fixes
Either extend parent module behavior or re-think the text-only predicate for filtering mime-types.