Syntax highlighting sometimes incorrect with multiline constructs
Author: dandavisonCreated Mar 23, 2020Updated Aug 21, 2026
If delta receives a hunk that looks something like the example below, then it will syntax highlight the code as a string. (This is a python example, but the problem exists in any language with multiline string literals I think):
...and this is the end of my docstring.
"""
x = some_function("some_string") # This line should be syntax-highlighted as code.
|
That seems like an inevitable ambiguity. However, are there perhaps some heuristics that could be introduced to allow delta to guess which side of the """ is code and which side string literal?
Source: dandavison/delta