language-mcfunction icon indicating copy to clipboard operation
language-mcfunction copied to clipboard

Windows-style line endings are sometimes highlighted as errors

Open Arcensoth opened this issue 4 years ago • 0 comments

This issue became apparent in #16 but was deferred until more information was available.

Here are the relevant details from the discussion in that report:

At some point - probably as a side-effect of an earlier fix - I must have fixed the trailing arguments being highlighted as errors, but the ^M is a slightly different red and I don't think it's a problem with the syntax highlighter. Here's some research:

  • atom/atom#3105 (comment)
  • https://stackoverflow.com/questions/1822849/what-are-these-ms-that-keep-showing-up-in-my-files-in-emacs
  • https://superuser.com/questions/1217622/how-can-i-remove-the-m-from-my-file-in-sublime-text-3

It looks like people might be committing files with CRLF and then GitHub decides to force-highlight the carriage returns.

We'll see how the next Linguist update handles the affected files and re-open if it's clear there's more to be done here.

An update, for posterity:

GitHub Linguist has been updated, and is now running v0.13.0 of language-mcfunction.

As expected, the trailing arguments are being highlighted properly but the ^M characters remain:

https://github.com/Gamemode4Dev/GM4_Datapacks/blob/master/gm4_phantom_scarecrows/data/phantom_scarecrows/functions/main.mcfunction#L2

Like I mentioned in my last comment, I'm not confident that this is a problem with the grammar itself but instead that people are committing carriage returns to mcfunction files. It may be the grammar's fault that these characters are being highlighted, but after some testing (via github-lightshow) I was unable to remove these characters by any means.

Until I have more definitive information about the problem and/or people reporting it, I'm going to work under the assumption that this is out of the grammar's control.

I'm still unsure exactly what's causing this problem, but it any case it can probably be fixed with some effort.

Arcensoth avatar Dec 20 '19 15:12 Arcensoth