Allow customization of ErrorStrip painting #535
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ErrorStrip
does not expose a way to change how markers are painted (for example, to draw them with a "flat" UI style). To change the painting style you must make a private copy of the class and then keep it in synch with upstream changes. This PR addresses this with the following changes:paintCaretMarker(g, w, h)
paintParserMarkerNotice(g, notice, w, h)
caretMarkerOnTop
, allows control over whether the caret marker is drawn under other markers (as it currently is) or over themThe painting delegates expose a small rectangle (the width of the component and the height of a parser notice marker) for the subclass to paint as desired. In the case of the caret delegate, the rectangle is centered around the y-position for the caret. The base class paints the markers in the same style as the original implementation.
A future change might allow the subclass to choose which notice(s) to paint, but that is not addressed here. It uses the existing method in
Marker
to choose a notice based on priority, slightly modified (and suitably renamed) to return the notice rather than its colour. (As an example of how multiple notices might be used, in VS Code there is a similar strip but different kinds of markers (errors, search matches, diffs) are drawn in different columns.)