Skip to content

Add basic code mining tracing option to trace rendering #2788

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions bundles/org.eclipse.jface.text/.options
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ org.eclipse.jface.text/debug/AbstractInformationControlManager= false

# Enables assertion check for valid offset and length when creating a TextSelection
org.eclipse.jface.text/assert/TextSelection/validConstructorArguments= false

org.eclipse.jface.text/debug/CodeMining/render= false
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ public class CodeMiningManager implements Runnable {
*/
private IProgressMonitor fMonitor;

/**
* Debug option for rendering code minings.
*/
public static final boolean DEBUG_RENDER= "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.jface.text/debug/CodeMining/render")); //$NON-NLS-1$ //$NON-NLS-2$


/**
* Constructor of codemining manager with the given arguments.
*
Expand Down Expand Up @@ -245,6 +251,11 @@ private void renderCodeMinings(Map<Position, List<ICodeMining>> groups, ISourceV
// done.
return;
}

if (DEBUG_RENDER) {
System.out.println("CodeMiningManager.renderCodeMinings() start"); //$NON-NLS-1$
}

Set<ICodeMiningAnnotation> annotationsToRedraw= new HashSet<>();
Set<AbstractInlinedAnnotation> currentAnnotations= new HashSet<>();
// Loop for grouped code minings
Expand Down Expand Up @@ -287,6 +298,10 @@ private void renderCodeMinings(Map<Position, List<ICodeMining>> groups, ISourceV
fInlinedAnnotationSupport.updateAnnotations(currentAnnotations);
// redraw the existing codemining annotations since their content can change
annotationsToRedraw.stream().forEach(ICodeMiningAnnotation::redraw);

if (DEBUG_RENDER) {
System.out.println("renderCodeMinings end of " + annotationsToRedraw.size() + " mining annotations"); //$NON-NLS-1$ //$NON-NLS-2$
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;

import org.eclipse.jface.internal.text.codemining.CodeMiningManager;

import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.ITextViewerExtension5;
Expand Down Expand Up @@ -159,6 +161,9 @@ public void redraw() {
// adjust offset according folded content
offset= ((ITextViewerExtension5) viewer).modelOffset2WidgetOffset(offset);
}
if (CodeMiningManager.DEBUG_RENDER) {
System.out.println("AbstractInlinedAnnotation.redraw()"); //$NON-NLS-1$
}
InlinedAnnotationDrawingStrategy.draw(this, null, text, offset, pos.getLength(), null);
} catch (RuntimeException e) {
// Ignore UI error
Expand Down
Loading