mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Bug 537357 - [lsp4e-cpp] Set the document partitioner in a document setup participant
Change-Id: I2d672cac5bb924a91457bf2e4cc552d596ae5d0d
This commit is contained in:
parent
17c79ab310
commit
09d4a1121c
3 changed files with 13 additions and 12 deletions
|
@ -6,4 +6,7 @@ server.label = C/C++ Language Server
|
||||||
|
|
||||||
reindex.command.name = Reindex
|
reindex.command.name = Reindex
|
||||||
reindex.command.label = Reindex
|
reindex.command.label = Reindex
|
||||||
|
|
||||||
|
cDocumentSetupParticipant =C Document Setup Participant
|
||||||
|
|
||||||
PreferencePageTitle=C/C++ Language Server
|
PreferencePageTitle=C/C++ Language Server
|
|
@ -24,6 +24,15 @@
|
||||||
id="org.eclipse.lsp4e.languages.cpp">
|
id="org.eclipse.lsp4e.languages.cpp">
|
||||||
</contentTypeMapping>
|
</contentTypeMapping>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension
|
||||||
|
id="org.eclipse.lsp4e.cpp.language.CDocumentSetupParticipant"
|
||||||
|
name="%cDocumentSetupParticipant"
|
||||||
|
point="org.eclipse.core.filebuffers.documentSetup">
|
||||||
|
<participant
|
||||||
|
class="org.eclipse.cdt.internal.ui.editor.CDocumentSetupParticipant"
|
||||||
|
contentTypeId="org.eclipse.lsp4e.languages.cpp">
|
||||||
|
</participant>
|
||||||
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.ui.editors">
|
point="org.eclipse.ui.editors">
|
||||||
<editorContentTypeBinding
|
<editorContentTypeBinding
|
||||||
|
|
|
@ -58,7 +58,6 @@ public class PresentationReconcilerCPP extends CPresentationReconciler {
|
||||||
private CCommentScanner fMultilineCommentScanner;
|
private CCommentScanner fMultilineCommentScanner;
|
||||||
private SingleTokenCScanner fStringScanner;
|
private SingleTokenCScanner fStringScanner;
|
||||||
private AbstractCScanner fCodeScanner;
|
private AbstractCScanner fCodeScanner;
|
||||||
private boolean fSettingPartitioner = false;
|
|
||||||
private CqueryLineBackgroundListener fLineBackgroundListener = new CqueryLineBackgroundListener();
|
private CqueryLineBackgroundListener fLineBackgroundListener = new CqueryLineBackgroundListener();
|
||||||
private ITextViewer textViewer;
|
private ITextViewer textViewer;
|
||||||
private TextInputListenerCPP textInputListener;
|
private TextInputListenerCPP textInputListener;
|
||||||
|
@ -155,16 +154,6 @@ public class PresentationReconcilerCPP extends CPresentationReconciler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected TextPresentation createPresentation(IRegion damage, IDocument document) {
|
protected TextPresentation createPresentation(IRegion damage, IDocument document) {
|
||||||
if (fSettingPartitioner) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
//FIXME: Need a better place to set the partitioner
|
|
||||||
if (!(document.getDocumentPartitioner() instanceof FastCPartitioner)) {
|
|
||||||
// Prevent infinite recursion
|
|
||||||
fSettingPartitioner = true;
|
|
||||||
CUIPlugin.getDefault().getTextTools().setupCDocument(document);
|
|
||||||
fSettingPartitioner = false;
|
|
||||||
}
|
|
||||||
TextPresentation createPresentation = super.createPresentation(damage, document);
|
TextPresentation createPresentation = super.createPresentation(damage, document);
|
||||||
return createPresentation;
|
return createPresentation;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue