-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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 the Solidity language without an associated extension (updated) #3755
Conversation
samples/Solidity/RefundVault.sol
Outdated
@@ -0,0 +1,56 @@ | |||
pragma solidity ^0.4.11; |
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.
The Travis CI build fails because of these samples. Files in samples/
are used by the Bayesian classifer and are expected to be registered in languages.yml
(through their file extension or filename). Since it's not the case here, could you move these example files to tests/fixtures/
?
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.
Sure! Maybe there should be a note about that in the contributing guide.
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.
It's a pretty rare case. It's only the second language we'd be adding that doesn't have an extension or a filename defined.
lib/linguist/languages.yml
Outdated
type: programming | ||
ace_mode: text | ||
tm_scope: source.solidity | ||
language_id: 237469032 |
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.
Could you add a color for Solidity? We usually try to use colors from official logos if any.
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.
The logo only has dark shades of gray. I'm not sure it'll look very nice but I've set it to one of those.
they're not used by the bayesian classifier
I'm not sure I understand what I'm supposed to do with the sample files. The Travis CI build is still failing. |
Regarding the color, it seems to be too close to an existing one. I've tried all the colors of the logo and they're too close too. Would it be ok to submit without color, or should I make one up? |
EDITed (a lot): For the color failure, perhaps any gray will work? I've tried a bunch, |
From #3755 (comment):
From #3755 (comment):
@pchaigno Would the first one be If so, does that mean that the test cases that are failing now (with "No language") would require special handling, like
Add to appropriate lines: if language == 'Data' || language == 'Solidity' (That doesn't look very nice to me.) |
@pchaigno Any thoughts? |
@veox @frangio The other language that doesn't have an extension or a filename defined is "Python Console" I think. There's no fixtures or sample files for that language, so I suppose the only way to make this pass is to remove the fixtures (which feels scary). The files in |
Is there any update on this issue? I think linguist does not check for solidity currently. |
Thanks for this pull request, any update? |
Closing in favour of #3973 which will add Solidity support with the |
After the discussion in #3560 and following @pchaigno's suggestion in #3559, this PR adds the Solidity language, together with two sample files, but without associating an extension to it.
To sum things up, the associated
.sol
extension is shared by files on GitHub that don't correspond to a language, and it's impossible for a linguist heuristic to return that as a result. This is referred to as thenot-a-language
feature, which is apparently non-trivial to implement. In the meantine, we've agreed on adding the language without an extension, so that repositories can at least use.gitattributes
overrides to get syntax highlighting.Here's a Github search for the language with more than 25000 results.
One of the sample files is taken from OpenZeppelin, which is MIT licensed. The other one was written by @veox specifically to demonstrate the language syntax, and is BSD licensed.