github-linguist / linguist

Language Savant. If your repository's language is being reported incorrectly, send us a pull request!
MIT License
12.27k stars 4.25k forks source link

Swift Highlighting Broken #6643

Closed SimplyDanny closed 10 months ago

SimplyDanny commented 10 months ago

With the v7.28.0 release, the syntax highlighting for Swift code makes some files unreadable. See this file in the SwiftLint repository as an example.

Many parts get a red background color in dark mode, which makes it very hard to work with them, especially when the confusing highlighting takes action in code reviews where only a small (red) part is visible. My current solution is to review the changes locally which is uncomfortable.

If a quick fix cannot be found, I'd vote for a rollback to the previous Swift grammar.

FYI: @jtbandes

jtbandes commented 10 months ago

Looks like with this file you are encountering a combination of https://github.com/jtbandes/swift-tmlanguage/issues/13 & https://github.com/jtbandes/swift-tmlanguage/issues/7

SimplyDanny commented 10 months ago

Looks like with this file you are encountering a combination of https://github.com/jtbandes/swift-tmlanguage/issues/13 & https://github.com/jtbandes/swift-tmlanguage/issues/7

Yes, it seems like. This is especially a serious problem for SwiftLint where almost all files contain string blocks in one or the other way.

jtbandes commented 10 months ago

I'll try to resolve these soon but unfortunately I don't have a way of testing GitHub's highlighting aside from waiting for the next release (https://github.com/github-linguist/linguist/pull/6603#issuecomment-1854708886).

lildude commented 10 months ago

Closing as syntax highlighting issues should be opened on the upstream repos as per the troubleshooting doc.

SimplyDanny commented 10 months ago

Closing as syntax highlighting issues should be opened on the upstream repos as per the troubleshooting doc.

Fair enough. However, I opened the issue here because I propose to revert the change until the problems are fixed. It's really annoying to work on code reviews at the moment.

jtbandes commented 10 months ago

As a temporary suggestion, if you are able to use the VS Code's GitHub integration to do code reviews, you might have a better experience as VS Code is able to use the same grammar without experiencing the errors.

LePips commented 10 months ago

+1 to reverting until problems are fixed, it's been really hard to read code for the past little bit

ZevEisenberg commented 10 months ago

Another +1 to fixing or reverting this soon. It makes diffs like this pretty hard to understand:

image
jtbandes commented 10 months ago

The latest discussion on the potential issue with GitHub's highlighter has been happening on https://github.com/github-linguist/linguist/pull/6603, but @lildude I wonder if we should reopen this issue (or create a new one) to have a more discoverable place for discussion than on a merged PR?

SimplyDanny commented 9 months ago

Guys, really ... it has been over a month now that the highlighting is broken. I appreciate all your work and I very well know that a fix usually is not ready within a few minutes/hours/days. However, a simple revert to the previous state of the highlighter would have been perfectly sufficient to allow people to work with Swift code on GitHub again. Honestly, (re)viewing Swift code at the moment is simply impossible and has been for over a month.

I kindly ask you again to roll back the grammar change! 🙏

lildude commented 9 months ago

I kindly ask you again to roll back the grammar change! 🙏

This is out of my control as is not a problem with the grammar... it's a problem with the highlighting engine which coincided with the last release. Rolling back the release will make no difference. The team responsible for the highlighting engine is aware of the issue and looking into it.

Feel free to open a support ticket referencing https://github.com/github-linguist/linguist/issues/6668 if you want to add more to the known issue for passing on to the relevant team.