-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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 Q# language support #4901
Add Q# language support #4901
Conversation
Yep, that's likely the cause. Any idea why they're not using the standard file extensions? |
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 the contribution!
The extension they use is "tmLanguage.json.v.template". The file itself is part of the VSCode extension for the language, so I guess they are generating the actual syntax file locally, after it's installed. After closer inspection, it seems that there was at least one change to the file after the other repository was archived - the "internal" keyword is now legal. This confirms my doubts – the repository is, after all, outdated. I will I reach out to the maintainers of the official repository and see what can be done. |
Please note a grammar isn't required for initial support in Linguist. We can add it as a follow up. The language will still show up in search queries and statistics in the meantime. |
@JakuJ I'm so excited to see this PR! I am part of the Microsoft Quantum team, and we've been thinking that we need to look into adding Q# to Linguist for a while - now we don't! :-) If I may offer a suggestion for the color, our latest official color palette includes ivory ( The "most frequently used with" languages are probably C#, Python and Jupyter notebooks, with some *shell, so it makes sense to pick the color from our palette that would work nicely with all of these. (Here is a languages bar of the Quantum Katas repo which is fairly representative of the languages typically used with Q#.) Looking at this, I would lean towards the lighter colors, ivory ( |
@tcNickolas Always a pleasure to help out 😄 Speaking of colours, unfortunately the ones you've proposed are not available, according to the Free Colour Picker. Some of the closest free colours include: If you ask me, anything yellow/goldish wold be nice, reminds me of the gold-plated vertical rods in a quantum computer – the first image everyone sees after googling the phrase 😀 However, I think it'd be best for the people behind the project to choose the colour. Use the Picker and if you find a colour that's good enough, I'll update the PR. Edit: The Picker doesn't really show you which colours are available unless you mouse over them, so I've painted over those to make it a bit easier for you. You should still use the Picker for the exact hex codes. |
@lildude Any idea what's happening here? Are we not using the same versions of dependencies? |
Alright, microsoft/qsharp-compiler#504 got resolved and we've now got access to the official syntax for Q#, so I've just added it here. This makes support for the language complete from day one. |
Awesome! Could you update the original post's template with a highlighting example? |
@pchaigno Sure thing, done. |
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.
LGTM. Thanks.
This won't go live on GitHub.com until I make a release, which I'm aiming to do before 3 Aug, though can't promise anything.
@tcNickolas Just a random tip when writing hexadecimal colour-codes on GitHub: enclosing the code in backticks will display the colour when rendered. E.g., instead of writing #000000, write `#000000` (which produces |
* Add Q# language support * Add a color for Q# * Make Q# colour closer to the VSCode extension logo * Add support for Qt Script * Remove Q# syntax repo * Properly remove the submodule * Add heuristics for Q# and Qt Script * Fine-tune the '.qs' heuristics * Change Q# colour to "fridge gold" * Add the official grammar for Q#
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.
.
Description
This PR intends to add support for Microsoft's Q# quantum programming language. The source files associated with this language come with the ".qs" extension.
Adding the language to Linguist by itself, however, would mean misclassifying a lot of Qt Script files as Q#, as it uses the same extension and is also not yet supported by Linguist. Therefore, this PR also attempts to add support for Qt Script.
Colors
I am in no way associated with Microsoft, and the
#2a59ff
color I've chosen for the language (lacking an official logo that I know of) is pretty much arbitrary, albeit close to the color of the logo of the official VSCode extension. It's also different enough from green and purple associated with C# and F# – languages commonly used alongside Q# in the same repository.Update: The colour associated with Q# is now "fridge gold"
#fed659
.The color for Qt Script is
#00b841
– the closest one I've found to the color of Qt's logo that's still available.Q# syntax
The official grammar (template) resides deep inside the qsharp-compiler repository. The
script/add-grammar
utility is not able to find the grammar file in this repo, probably because of the extension. The grammar itself works when pasted into Lightshow.The grammar I found for the language might seem a bit old (the repository is 2 years old and archived), however, the Lightshow website shows the same highlighting for both grammars (tested on the sample sources), so I think it's okay.Update: the owner of the repository containing syntax for Q# took it down, which means no syntax highlighting for the language, at least until microsoft/qsharp-compiler#504 gets resolved.
Update 2: The issue got resolved, official syntax for Q# has been added.
Checklist for Q#:
Checklist for Qt Script:
I have included a syntax highlighting grammarQt Script uses JavaScript's syntax highlighting