diff --git a/package.json b/package.json index 865b385..0e8ab44 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,17 @@ ".gyb" ], "configuration": "./language-configuration.json" + }, + { + "id": "swift-gyb", + "aliases": [ + "Swift GYB", + "swift-gyb" + ], + "extensions": [ + ".swift.gyb" + ], + "configuration": "./language-configuration.json" } ], "grammars": [ @@ -37,6 +48,11 @@ "language": "gyb", "scopeName": "source.gyb", "path": "./syntaxes/gyb.tmLanguage.json" + }, + { + "language": "swift-gyb", + "scopeName": "source.swift-gyb", + "path": "./syntaxes/swift-gyb.tmLanguage.json" } ] }, diff --git a/syntaxes/swift-gyb.tmLanguage.json b/syntaxes/swift-gyb.tmLanguage.json new file mode 100644 index 0000000..696b013 --- /dev/null +++ b/syntaxes/swift-gyb.tmLanguage.json @@ -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" +}