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 Highlighting for Igor #4568

Merged
merged 2 commits into from
Aug 12, 2019
Merged

Add Highlighting for Igor #4568

merged 2 commits into from
Aug 12, 2019

Conversation

ukos-git
Copy link
Contributor

@ukos-git ukos-git commented Jul 1, 2019

Description

The Igor Pro Syntax Highlighting had been added in 2013 / 2014 and was removed when moving linguist to tm based highlighting due to missing *.tmlanguage
file. The language recognition is still present but it currently does not highlight the code on github.

There was a demand from the Igor programmers community pending since 2017 and also stale issues here.

There are quite a few Projects on Github, although the language is very specific to the scientific community. As the program itself is not open source, there are also fewer spread Open Source projects. Nevertheless, it suffices the requirement for adding the language to linguist.

I have added a tm syntax highlighting under BSD-3 on github so I think it is time to get the highlighting for Igor back to github.

Checklist:

The Igor Syntax Highlighting was removed due to a missing *.tmlanguage
file.  The language recognition is still present but it currently does
not highlight the code on github.
@pchaigno
Copy link
Contributor

pchaigno commented Jul 1, 2019

Thanks for the pull request @ukos-git! Could you please add the template back and fill it? That helps for reviews.

@ukos-git
Copy link
Contributor Author

ukos-git commented Jul 1, 2019

I added a few examples using lightshow. Highlighting of variables outside of their definitions does not look good there. I removed that in the tm file. I guess I do not need to update the submodule as this is done automatically.

Another note: Igor has very specific highlighting colors from the vendors. Is there a more specific way to define the colors?

@pchaigno
Copy link
Contributor

pchaigno commented Jul 9, 2019

I guess I do not need to update the submodule as this is done automatically.

Indeed, submodules are updated with each new release of Linguist. Probably best to update it anyway though, just in case we miss it in the next release.

Another note: Igor has very specific highlighting colors from the vendors. Is there a more specific way to define the colors?

No. Grammars let you decide the scope of each token but the style (i.e., colors of scopes) is defined by GitHub.

@Alhadis
Copy link
Collaborator

Alhadis commented Jul 22, 2019

Another note: Igor has very specific highlighting colours from the vendors. Is there a more specific way to define the colours?

No. Grammars let you decide the scope of each token but the style (i.e., colours of scopes) is defined by GitHub:

Click to show table (it's huge)
TextMate scope(s) CSS class Colour
brackethighlighter.angle pl-ba #586069
brackethighlighter.curly pl-ba #586069
brackethighlighter.quote pl-ba #586069
brackethighlighter.round pl-ba #586069
brackethighlighter.square pl-ba #586069
brackethighlighter.tag pl-ba #586069
brackethighlighter.unmatched pl-bu #B31D28
carriage-return pl-c2 #FAFBFC
comment pl-c #6A737D
constant pl-c1 #005CC5
constant.character.escape pl-cce #24292E
constant.other.reference.link pl-corl #032F62
entity pl-e #6F42C1
entity.name pl-en #6F42C1
entity.name.constant pl-c1 #005CC5
entity.name.tag pl-ent #22863A
invalid.broken pl-bu #B31D28
invalid.deprecated pl-bu #B31D28
invalid.illegal pl-ii #FAFBFC
invalid.unimplemented pl-bu #B31D28
keyword pl-k #D73A49
markup.bold pl-mb #24292E
markup.changed pl-mc #E36209
markup.deleted pl-md #B31D28
markup.heading pl-mh #005CC5
markup.ignored pl-mi2 #F6F8FA
markup.inserted pl-mi1 #22863A
markup.italic pl-mi #24292E
markup.list pl-ml #735C0F
markup.quote pl-ent #22863A
markup.raw pl-c1 #005CC5
markup.untracked pl-mi2 #F6F8FA
message.error pl-bu #B31D28
meta.diff.header pl-c1 #005CC5
meta.diff.header.from-file pl-md #B31D28
meta.diff.header.to-file pl-mi1 #22863A
meta.diff.range pl-mdr #6F42C1
meta.module-reference pl-c1 #005CC5
meta.output pl-c1 #005CC5
meta.property-name pl-c1 #005CC5
meta.separator pl-ms #005CC5
punctuation.definition.changed pl-mc #E36209
punctuation.definition.comment pl-c #6A737D
punctuation.definition.deleted pl-md #B31D28
punctuation.definition.inserted pl-mi1 #22863A
punctuation.definition.string pl-pds #032F62
punctuation.section.embedded pl-pse #24292E
source pl-s1 #24292E
source.regexp pl-pds #032F62
source.ruby.embedded pl-sre #24292E
storage pl-k #D73A49
storage.modifier.import pl-smi #24292E
storage.modifier.package pl-smi #24292E
storage.type pl-k #D73A49
storage.type.java pl-smi #24292E
string pl-s #032F62
string.comment pl-c #6A737D
string.other.link pl-corl #032F62
string.regexp pl-sr #032F62
string.regexp.arbitrary-repitition pl-sra #24292E
string.regexp.character-class pl-pds #032F62
sublimelinter.gutter-mark pl-sg #959DA5
sublimelinter.mark.error pl-bu #B31D28
sublimelinter.mark.warning pl-smw #E36209
support pl-c1 #005CC5
support.constant pl-c1 #005CC5
support.variable pl-c1 #005CC5
variable pl-v #E36209
variable.language pl-c1 #005CC5
variable.other pl-smi #24292E
variable.other.constant pl-c1 #005CC5
variable.parameter.function pl-smi #24292E

Just weighing in on this: here's the list of scope-to-CSS-class mappings in-use by GitHub as of this writing.

Important notes

  • Unlike most TextMate-based editors, which allow the scope names to match in any order, GitHub is very specific and will only match the scopes above in the order they appear:

    name: "entity.name.function"    # Matches `entity.name`
    name: "entity.function.name"    # Does NOT match `entity.name`
    name: "foo.entity.name"         # This won't match either

    This violates the logic of a CSS-based selector system, but I guess GitHub don't want stuff like punctuation.definition.variable matching variable when they're not highlighting punctuation in code anyway...

  • Some CSS classes have additional styles applied which I can't show you with plain markdown (without screen-capping). You can see how everything looks using a dummy grammar on Lightshow or by consulting this list.

  • Don't get too attached to the colours you see. GitHub's designers are prone to spontaneous, wanton styling changes, which happen often and in subtle ways. Expect the exact colours to shift over time.

@ukos-git
Copy link
Contributor Author

ukos-git commented Jul 22, 2019

@Alhadis Thanks, that was really helpfull. The highlighting now looks much more alike.

Screenshot from 2019-07-22 19-46-05

I have created a tiny php script to get the closest matching colors.

PR ready.

@lildude lildude requested review from pchaigno and Alhadis August 12, 2019 10:47
@lildude lildude merged commit 5a57209 into github-linguist:master Aug 12, 2019
@ukos-git ukos-git deleted the add_igor branch August 12, 2019 19:29
@lildude lildude mentioned this pull request Jan 28, 2022
4 tasks
@github-linguist github-linguist locked as resolved and limited conversation to collaborators Jun 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants