Im trying to create a lightweight C++ Editor with the help of libclang.
I use a new problemmarker type to mark the compiler warnings and errors given by clang and the token ranges to do syntax coloring.

As you can see in the picture above, the squiggly lines of the error markers overwrite the syntax coloring. Is there a PresentationReconciler that takes into account that some marked lines could still have other style information?
I added some code snippets that might be relevant to solve the problem:
my plugin.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.editors">
<editor
name="CXX Editor"
extensions="cpp"
icon="icons/sample.gif"
contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
class="cppeditor.editors.CppEditor"
id="cppeditor.editors.CppEditor">
</editor>
</extension>
<extension
id="cppeditor.problemmarker"
name="clang Error"
point="org.eclipse.core.resources.markers">
<super
type="org.eclipse.core.resources.problemmarker">
</super>
<super
type="org.eclipse.core.resources.textmarker">
</super>
<persistent
value="true">
</persistent>
</extension>
</plugin>
The method to add markers to the IFile resource:
public void addMarkerToFile(IFile file, IDocument fileDocument) throws CoreException, BadLocationException{
IMarker marker = file.createMarker("cppeditor.problemmarker");
marker.setAttribute(IMarker.SEVERITY, this.severity);
marker.setAttribute(IMarker.MESSAGE, this.message);
marker.setAttribute(IMarker.LINE_NUMBER, this.line);
int startOffset = fileDocument.getLineOffset(this.line-1);
int endOffset = fileDocument.getNumberOfLines() > this.line ?
fileDocument.getLineOffset(this.line) : fileDocument.getLength()-1;
marker.setAttribute(IMarker.CHAR_START, startOffset);
marker.setAttribute(IMarker.CHAR_END, endOffset);
}
The "createPresenation" method of the PresenationRepairer
@Override
public void createPresentation(TextPresentation presentation, ITypedRegion region) {
CppDocument doc = (CppDocument) this.fDocument;
Token[] newTokens = doc.getTokens();
if(newTokens != oldTokens){
for(Token t : newTokens){
addRange(
presentation,
t.getStart(),
t.getEnd() - t.getStart(),
attributeMap.get(t.getKind()));
}
oldTokens = newTokens;
}
}
And finally my SourceViewerConfiguration:
public class CppConfiguration extends SourceViewerConfiguration {
public CppConfiguration(ColorManager colorManager) {}
@Override
public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
return new String[] { IDocument.DEFAULT_CONTENT_TYPE };
}
@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
PresentationReconciler reconciler = new PresentationReconciler();
NonRuleBasedDamagerRepairer ndr = new NonRuleBasedDamagerRepairer();
reconciler.setDamager(ndr, IDocument.DEFAULT_CONTENT_TYPE);
reconciler.setRepairer(ndr, IDocument.DEFAULT_CONTENT_TYPE);
return reconciler;
}
@Override
public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
return new DefaultAnnotationHover();
}
}