[Question] Where to place the .tmlanguage file?
Closed this issue · 2 comments
I'm trying to add a new language using the syntax below - I have the .tmLanguage file.
But I cannot for the life of me figure out how to add the file to the project for the plugin to be able to find it.
Should the path be a complete path, relative to the project or something completely different?
extension Grammar {
static let kotlin = try! Grammar(textMateFile: URL(fileURLWithPath: "/path/to/Kotlin.tmLanguage"))
}
Thanks for this plugin anyways! Seems to great!
Hey there! So you have multiple options:
Grammar(textMateFile: URL(fileURLWithPath: "/path/to/Kotlin.tmLanguage"))
with the absolute pathGrammar(relativeTextMateFile: "Kotlin.tmLanguage")
where the language file is in the exact same folder as the current Swift file (I usually prefer this one)- Or if you want additional control you can also just pass the data or the string representation of the xml
Check out https://github.com/nerdsupremacist/syntax-highlight-publish-plugin/blob/main/Sources/SyntaxHighlightPublishPlugin/Grammar/Grammar%2BtextMate.swift for all the initializers you can use ;)
"relativeTextMateFile" was the missing piece!
Thanks a lot! 🚀