Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add separate swift-gyb grammar #1

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,29 @@
".gyb"
],
"configuration": "./language-configuration.json"
},
{
"id": "swift-gyb",
"aliases": [
"Swift GYB",
"swift-gyb"
],
"extensions": [
".swift.gyb"
],
"configuration": "./language-configuration.json"
}
],
"grammars": [
{
"language": "gyb",
"scopeName": "source.gyb",
"path": "./syntaxes/gyb.tmLanguage.json"
},
{
"language": "swift-gyb",
"scopeName": "source.swift-gyb",
"path": "./syntaxes/swift-gyb.tmLanguage.json"
}
]
},
Expand Down
14 changes: 14 additions & 0 deletions syntaxes/swift-gyb.tmLanguage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "Swift GYB",
"patterns": [
{
"include": "source.gyb"
},
{
"include": "source.swift",
"comment": "TODO: The Swift grammar matches entire bodies (e.g. as delimited by { ... }), causing our gyb syntax to not be considered, e.g. if a gyb construct appears within a Swift code block"
}
],
"scopeName": "source.swift-gyb"
}