-
Notifications
You must be signed in to change notification settings - Fork 71
Language support for GYB #1455
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
Comments
We could add the extension to known extensions in package.json, but sourcekit-lsp would need to support the highlighting ideally |
Do you think it's worth adding it as a TextMate grammar in the meantime? |
That would work for the syntax highlighting in the meantime, yeah. Not sure how difficult it would be to extend the existing Swift textmate grammar.
@ahoppen is this something you'd consider adding to SourceKit-LSP? |
I recently wrote an extension that extends the HTML grammar to support Vapor's templating language Leaf, it's just a matter of writing good regular expressions, and given the structure of GYB I don't think it would be too difficult. |
We are not planning to add gyb support to SourceKit-LSP. GYB can contain arbitrary Python, which can be nearly impossible to process for semantic information. Not sure if it’s possible, but maybe a middle ground cold be to allow VS Code to use it’s grammar-based syntax highlighting for gyb files but not open them in SourceKit-LSP? That way you get at least some syntax coloring and we don’t try to provide semantic functionality that would only fail. |
I opened a draft PR that adds syntax highlighting for GYB. There are still known issues (which I mention in the PR). If you want to know the reason behind the choices I made please ask me here or in the PR comments! P.S. I would love to give GYB files a customised icon, I was thinking of Swift's icon but greyed out, what do you think? |
Is your feature request related to a problem? Please describe.
When working with
.swift.gyb
files you need to choose whether to view them as basic text files with no syntax highlighting, or as Swift files, with reasonable syntax highlighting but with many SourceKit-LSP errors.Describe the solution you'd like
Even just basic TextMate syntax highlighting that extends Swift's and clearly highlights GYB blocks, without any LSP functionality, would be helpful. Also, it would be really nice to add a file icon for GYB that is slightly different than the normal Swift one.
Describe alternatives you've considered
Viewing GYB as basic text files with no syntax highlighting, or as Swift files, with reasonable syntax highlighting but with many SourceKit-LSP errors.
The text was updated successfully, but these errors were encountered: