Closed revolter closed 7 years ago
Thanks for the report, I'll take a look.
@infininight This is why I wanted to use begin/end patterns :wink:
I am quite fond of regex, could you point me to the exact line that matches it?
or in nicer form:
{ name = 'meta.embedded.line.swift';
match = '(?x)
(\\\() # Opening
(
(?<parens>
(
[^()"] # Anything except parens
| \( # Matched pairs of parens
\g<parens> # …that can be nested
\)
| " # Strings
([^\\]|\\.)* # Contents allowing for escapes
"
)*
)
)
((\))) # Closing
';
captures = {
1 = { name = 'punctuation.section.embedded.begin.swift'; };
2 = {
name = 'source.swift';
patterns = ( { include = '#root'; } );
};
5 = { name = 'punctuation.section.embedded.end.swift'; };
6 = { name = 'source.swift'; };
};
},
But personally, I don't think we should try to fix this regex match
. I think we should replace it with begin
/end
patterns, as you can see in this older version of the grammar:
https://github.com/textmate/swift.tmbundle/blob/662fd22bf8e6d2ed1dfcb5881c23838bad620404/Syntaxes/Swift.tmLanguage#L1436-L1481
{ name = 'meta.embedded.line.swift';
begin = '\\\(';
end = '\)';
beginCaptures = { 0 = { name = 'punctuation.section.embedded.begin.swift'; }; };
endCaptures = {
0 = { name = 'punctuation.section.embedded.end.swift'; };
1 = { name = 'source.swift'; };
};
contentName = 'source.swift';
patterns = (
{ include = '$self'; },
{ comment = 'Nested parens';
begin = '\(';
end = '\)';
},
);
},
Thanks for the info, but sadly, that's too new/much for me and I can't help.
@jtbandes Any idea when will GitHub pull the latest version of this?
You can watch https://github.com/github/linguist to see when they update the grammars. It may be a bit of an unusual time for them since I believe the person who usually pulled the updates is no longer working at GitHub.
Seems like the releases were happening quite often. I'll just wait for the next one, thanks!
@jtbandes, Well, there were quite a bit of releases since then, and the latest one even says it updated grammars
, but the syntax for that file is still problematic.
Yes, I've tried to contact them by commenting on those commits but haven't received any response so far. I don't believe their latest changes have actually taken effect (you can see hex literals are still broken); maybe due to caching or maybe they just haven't actually deployed the changes yet.
The changes are finally out :)
Awesome! Thanks for letting me know. "We can now close this issue" 😆
Finally!
This file has incorrect syntax highlighting after this line:
This might be caused by the quotes inside the quotes.