Skip to content

Commit

Permalink
Enable toggling breakpoints in LSP CEditor
Browse files Browse the repository at this point in the history
This is an example of where we have somewhat an inversion of dependencies.
The existing CDT code assumes it knows about all types of editors
at compile time. In this case the LSP C Editor is a new type. However,
rather than creating a new extension mechanism here we are simply
adding the LSP C Editor to the known list as the LSP C Editor
is (or will soon be) part of CDT itself anyway (see #354)

By itself this change doesn't do anything, it needs the
change in eclipse-cdt/cdt-lsp#46

Also-by: Gesa HENTSCHKE <Gesa.HENTSCHKE@bachmann.info>
  • Loading branch information
jonahgraham committed Apr 25, 2023
1 parent 2eaaa1e commit 8648952
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.eclipse.cdt.internal.ui.editor.asm.AsmTextEditor;
import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.core.resources.IResource;
import org.eclipse.ui.editors.text.TextEditor;

/**
* Toggle breakpoint factor enablement tester for editors and IDeclaration.
Expand Down Expand Up @@ -117,6 +118,14 @@ public boolean test(Object receiver, String property, Object[] args, Object expe
}
}
}

// Test for LSP based C/C++ Editor
} else if ("isCEditorSupportsCBreakpoint".equals(property) && (receiver instanceof TextEditor)) { //$NON-NLS-1$
var editor = (TextEditor) receiver;
if (editor.getEditorSite() == null || !editor.getEditorSite().getId().equals("org.eclipse.cdt.lsp.CEditor")) //$NON-NLS-1$
return false;
if (!CDebugUtils.isCustomToggleBreakpointFactory())
return true;
}

return false;
Expand Down

0 comments on commit 8648952

Please sign in to comment.