Add TextDocumentDecorationType, use it to merge decorations from several sources
Created by: lguychard
This introduces a breaking change to the extension api: the first argument to setDecorations()
must now be of type TextDocumentDeclarationType
instead of null
This allows us to merge declarations of several types, fixing #1339
This is inspired by vscode's API, with two notable differences:
- In vscode, the DecorationType stores the style information for a set of declarations, but this styling can still be overridden by the second argument to
setDecorations()
. I did not go down this route as it would have amounted to a much bigger change without immediate benefits for #1339 - In vscode, the DecorationType has a
dispose()
method, that can be used to remove all decorations for the given type on all text editors. This is actually something I plan on implementing in a subsequent PR, as it would be really helpful to cleanup decorations when an extension gets deactivated.
TODO:
-
Edit CHANGELOG