-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 TypeSpec #6775
base: main
Are you sure you want to change the base?
Add TypeSpec #6775
Conversation
4e9d596
to
3a35ece
Compare
3a35ece
to
c915f43
Compare
I know this PR is still in draft but I thought I'd give you a heads up… you're going to need to add support for "Travelling Salesman Problem" data files (ideally with a heuristic) in this PR too as they share the same extension and there are waaay more of those files on GitHub than appears to be the case for TypeSpec. This is needed to prevent all those files being identified as TypeSpec as Linguist doesn't currently have any languages using the |
Thanks for the comment , I was actually not sure if that was only needed if another language was already highlighted. ill add the heuristic then mark the pr as ready. |
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.
As TypeSpec will be the only language with the .tsp
extension, the heuristic won't be used. This also means all files with a .tsp
extension will be identified as TypeSpec.
This is why I said you will need to also add support for the Travelling Salemen Problem data files. This will give Linguist two languages with the .tsp
extension and then the heuristic will be used to pick the correct language.
ah sorry misread that, will look into this |
Hi @lildude doing a little bit of research on those Travelling Salemen Problem data files, there doesn't seem to be any existing grammar best I can find is this specification http://comopt.ifi.uni-heidelberg.de/software/TSPLIB95/tsp95.pdf, wondering here what bar you are looking for? Would adding some basic grammar for that file format(key, values, punctuation) be consider good and would allow us to add both language to linguist? |
There's no need for a grammar if you can't find one. One can always be added later. |
Thanks for the clarification, should I then follow the steps to add a new language but skip the script/add-grammar step for this new one?
|
Yes, though don't worry about the colour. We can fallback to the default for now. And two samples of each should be sufficient for the classifier. As an aside, TypeSpec isn't popular enough for inclusion right now, however it might be when I come to merge this PR which will only happen just before I make the next release. I review usage for all pending PRs at the time. I aim to make a new release approximately every 3-4 months inline with our Enterprise Server release cycle. |
Co-authored-by: John Gardner <gardnerjohng@gmail.com>
Co-authored-by: John Gardner <gardnerjohng@gmail.com>
@timotheeguerin I tried pushing some fixes to your branch (to resolve the various error failures, most of which were pedantic in nature), but I don't have write access: λ GitHub-Linguist (typespec-fixes): git push -u fork typespec-fixes
Enumerating objects: 17, done.
Counting objects: 100% (17/17), done.
Delta compression using up to 16 threads
Compressing objects: 100% (9/9), done.
Writing objects: 100% (9/9), 892 bytes | 892.00 KiB/s, done.
Total 9 (delta 7), reused 0 (delta 0), pack-reused 0 (from 0)
remote: Resolving deltas: 100% (7/7), completed with 7 local objects.
To github.com:timotheeguerin/linguist.git
! [remote rejected] typespec-fixes -> typespec-fixes (permission denied)
error: failed to push some refs to 'github.com:timotheeguerin/linguist.git' I've sent you a pull-request to get the changes merged instead. |
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.
Approving the change-set I requested earlier; note that this is exclusive of fixes I submitted to your fork earlier. See timotheeguerin/linguist#1
.
Fix pedantic test failures for github-linguist#6775
@Alhadis thanks for the fixes, I think I merged your PR correctly let me know if I didn't. For the permission issue i do have this option on in the PR, is there something else I should be doing to give access |
Yup, just synced my checkout's branch with yours, and the tests are all passing with flying colours. 👍
No, uh, that should be sufficient. Unless I was removed as a maintainer sometime in the last year (probably due to my break in activity), I should've been able to push changes to this PR directly. 😕🤔 Not sure… 🤷♂️ |
Changes applied. Just pending popularity now.
Description
Add grammar for TypeSpec language https://typespec.io
Repo: https://github.com/microsoft/typespec
Checklist:
Sample source(s):
json-schema.tsp
https://github.com/microsoft/typespec/blob/main/packages/playground-website/samples/json-schema.tsppetstore.tsp
https://github.com/microsoft/typespec/blob/main/packages/samples/specs/petstore/petstore.tspSample license(s): MIT
#4A3665