Skip to content

Add language support for GYB #1515

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

fpseverino
Copy link

Add syntax highlighting and language configuration for Swift GYB (.swift.gyb) files.

Motivation:

Resolves #1455

Language support for GYB can't be implemented via sourcekit-lsp, as GYB can contain arbitrary Python.

The TextMate grammar can't be an injection grammar because GYB files have a different file extension from normal Swift files, and also because sourcekit-lsp would activate and throw a lot of errors.

Additions:

  • New swift-gyb language in package.json
  • Language configuration for Swift GYB with code folding, brackets definition and autoclosing
  • TextMate grammar for Swift GYB
  • Icons for .swift.gyb files

Known issues:

  • GYB code blocks (%{...}%) and control statements (% keyword: ... % end) are not always highlighted when they are inside Swift bodies (structs, extensions and funcs, in other words when not in the top level of the file)
  • Swift keywords are not always correctly highlighted when the preceding structure, function or variable name starts with a GYB block

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Language support for GYB
1 participant