Handle speech-mark at end of raw string
peterfry opened this issue · 2 comments
I noticed that syntax highlighting breaks if you have a speech-mark at the end of your raw string. e.g.
test = """"foo""""
Any subsequent lines will be highlighted as string content.
If there's a space between the speech-mark and the closing triple-speech-marks, it works fine. e.g.
test = """"foo" """
It also works if there are two speech marks. e.g.
test = """"foo"""""
I suspect as soon as it sees the first three speech-marks at the end, it ends the string literal. The fourth speech-mark then incorrectly begins a new string literal.
Seeing the same issue in a build file from TeamCity. IntelliJ IDEA parses it ok, but in VS Code the lower half of the .kts file is considered a comment. Or rather, the code is considered comments and the comments are considered code.
Happens on this bit of code:
features {
feature {
type = "JetBrains.AssemblyInfo"
param("file-format", "%system.build.number%")
}
swabra {
filesCleanup = Swabra.FilesCleanup.DISABLED
lockingProcesses = Swabra.LockingProcessPolicy.KILL
}
replaceContent {
fileRules = "**/*.edmx"
pattern = """ProviderManifestToken=\".{4,6}\""""
replacement = """ProviderManifestToken="2008""""
}
}
requirements {
exists("DotNetFramework4.7_x64")
}
In the line pattern = """ProviderManifestToken=\".{4,6}\""""
the backslashes are treated as escape characters, which they are not since this is a raw string. This however stops the plugin form treating everything after this as a comment. On the next line however, there is no backslashes and the last four quotation marks makes the plugin treat everything afterwards as a comment.
Oh that shouldn't be happening 🤔. I'll look into this