-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 syntax highlighting to Yarn lockfiles #4761
Conversation
FYI: you can use Lightshow to show how files would be rendered with syntax highlighting. 😉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking the time to contribute to Linguist!
Could you please add one of the two sample files you pointed to to samples/YAML/
?
From the few examples I've looked at on GitHub, these files appear to be generated (?). Maybe we should add them to generated.rb
?
Ah, thanks @Alhadis! |
This pull request has been automatically marked as stale because it has not had recent activity, and will be closed if no further activity occurs. If this pull request was overlooked, forgotten, or should remain open for any other reason, please reply here to call attention to it and remove the stale status. Thank you for your contributions. |
This pull request has been automatically closed because it has not had activity in a long time. Please feel free to reopen it or create a new issue. |
Samples are here, sorry for the wait 🙂 |
Hm keeping both versions seems to make the tests unhappy - how should I fix it? Add a single version? Also, should I add |
Move the contents of
That shouldn't be necessary as YAML is a data-type language, so it won't skew or show up in a repository's language stats. |
The problem is that the detection for both yarn formats has the same filename, so I can't have both in the same directory. |
Then omit whichever one has the conflicting filename; only one is needed. Which reminds me; this should be going in |
Ouch. I just saw the size of the file you're adding... a 26,114-line sample is probably a bit overkill. 😉 Could you add a much more minimal sample, please? Something around the ~1-5 KBs range will do. Otherwise, it's going to nuke our classifier. (I should have checked this first, knowing the size of Yarn lockfiles…) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please update the OP to link to the source of the sample file and the license it is covered by as the file in the PR isn't the one you linked to in the OP.
@lildude the sample is in the OP, it's the lockfile from the Yarn project, licensed BSD 2-clause. |
That's not the same file. https://github.com/yarnpkg/berry/blob/master/yarn.lock is 14757 lines long. The sample you've included is only 30 lines long. |
Yes, because
I trimmed the file to a more reasonable size. Check the start of the file, it's the same content. |
Ah, that explains it and isn't clear. I've updated the OP to reflect this and the license. Thanks. |
Description
Yarn 1 uses a Yaml-like format which is good enough with the YAML highlighting, and Yarn 2 will switch to the good old regular YAML. Adding syntax highlighting to this file will help JS developers to review the changes, potentially preventing security issues.
Checklist: