-
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 Sway language #6275
Add Sway language #6275
Conversation
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 hard to tell exactly how many repositories are using sway because of the current limitations of github search. Using sourcegraph, I can see that there are at least 910 sway projects on github (each sway project must have a
Forc.toml
in it's root directory).
You're in luck. The new beta search can take your exact heuristic and tell us 😁.
This search results in 2.7k files and from it we can see there are a few heavy influencers, so if we exclude the 4 most prominent users from a quick look, we're down to 2.3k which appear to be well spread across repos so I think we're good to include this language.
Buuuuuttttt, as you've pointed out:
There are 9,312 files with the .sw extension, but some of these are not sway files. .sw is also used for Signed Word Audio Files. Those are already correctly highlighted by github as XML (example) or not highlighted (example). Added heuristics for sway files to disambiguate.
As this will be the only language Linguist knows about with this extension, your heuristic won't be used. In order to get the heuristic to correctly identify the Sway files, you'll need to add .sw
to at least another language. As you have clearly identified XML files, we can add .sw
to XML's list of extensions and add a sample.
So with that in mind...
- Please add
.sw
and a sample to XML - Update the heuristic test to be sure it doesn't misclassify the XML file as Sway
- Replace your samples with more real world looking uses of the language from the examples you got these from. These samples look like contrived demonstrations of the syntax rather than illustrations of real world usage.
Looking good. One final thing, could you please state in the OP the motivation/influence/inspiration for the colour you've chosen. I plan to add this to the template to help give some clarity in future if/when peeps submit a PR to change a language's colour. |
Done ✅ |
Description
Sway is a Rust-like programming language for smart contracts.
The examples are from the official sway examples (Apache license).
Color
I chose the same color used by Rust, since Sway is based on Rust syntax.
Popularity
It's hard to tell exactly how many repositories are using sway because of the current limitations of github search. Using sourcegraph, I can see that there are at least 910 sway projects on github (each sway project must have a
Forc.toml
in it's root directory).Based on the temporary requirements outlined in #5756, I believe there are over 2000 sway files, as sway projects usually have multiple
.sw
files, (example).There are 9,312 files with the
.sw
extension, but some of these are not sway files..sw
is also used for Signed Word Audio Files. Those are already correctly highlighted by github as XML (example) or not highlighted (example). Added heuristics for sway files to disambiguate.Checklist:
Search results for each extension:
https://github.com/search?q=extension%3Asw&type=Code