I have a problem that I imagine is quite simple to solve, but I am having a hard time trying to find a solution.
The hyperlink.cson file of the language-hyperlink package (https://github.com/atom/language-hyperlink/blob/master/grammars/hyperlink.cson) defines some patterns to highlight hyperlinks. I would like to modify those patterns, adding one new pattern to recognize the prefix “thunderlink”. So, basically I need to replace:
‘patterns’: [
{
‘match’: ‘(?x)\b(https?|s?ftp|ftps|file|smb|afp|nfs|(?:x-)?man(?:-page)?|gopher|txmt|issue)://((?!(\#[[:word:]]\#))(?:[-:@[:word:].,~%+_/?=&#;|!]))+(?<![-.,?:#;])’
‘name’: ‘markup.underline.link.$1.hyperlink’
}
{
‘match’: '(?x)\b(mailto):((?!(\#[[:word:]]\#))(?:[-:@[:word:].,~%+_/?=&#;|!]))+(?<![-.,?:#;])’
‘name’: ‘markup.underline.link.$1.hyperlink’
}
{
‘match’: ‘(?i)\bRFC(?: |(?<= RFC))(\d+)\b’
‘name’: ‘markup.underline.link.rfc.$1.hyperlink’
}
]
by (just a “thunderlink” option is added in the first match):
patterns: [
{
match: "(?x)\b(https?|thunderlink|s?ftp|ftps|file|smb|afp|nfs|(?:x-)?man(?:-page)?|gopher|txmt|issue)://((?!(\#[[:word:]]\#))(?:[-:@[:word:].,~%+_/?=&#;|!]))+(?<![-.,?:#;])"
name: “markup.underline.link.$1.hyperlink”
}
{
match: "(?x)\b(mailto):((?!(\#[[:word:]]\#))(?:[-:@[:word:].,~%+_/?=&#;|!]))+(?<![-.,?:#;])"
name: “markup.underline.link.$1.hyperlink”
}
{
match: "(?i)\bRFC(?: |(?<= RFC))(\d+)\b"
name: “markup.underline.link.rfc.$1.hyperlink”
}
]
But I do not know how to do that. Inspired by https://flight-manual.atom.io/using-atom/sections/basic-customization/, I tried by modifying the global Atom’s config.cson file and adding at the end the following code:
text:
hyperlink:
patterns: [
{
match: "(?x)\b(https?|thunderlink|s?ftp|ftps|file|smb|afp|nfs|(?:x-)?man(?:-page)?|gopher|txmt|issue)://((?!(\#[[:word:]]\#))(?:[-:@[:word:].,~%+_/?=&#;|!]))+(?<![-.,?:#;])"
name: “markup.underline.link.$1.hyperlink”
}
{
match: "(?x)\b(mailto):((?!(\#[[:word:]]\#))(?:[-:@[:word:].,~%+_/?=&#;|!]))+(?<![-.,?:#;])"
name: “markup.underline.link.$1.hyperlink”
}
{
match: "(?i)\bRFC(?: |(?<= RFC))(\d+)\b"
name: “markup.underline.link.rfc.$1.hyperlink”
}
]
(as the scope for language-hyperlink is text.hyperlink)
However, this does not work. Any ideas about what is wrong? It seems that I am injecting the code in the wrong place. I tried other alternatives but with no success. Any help would be really useful.
Thank you in advance.