Skip to content

Commit

Permalink
Merge pull request #166 from LucasBullen/bracket-matching
Browse files Browse the repository at this point in the history
Issue #141 Matching bracket support with language configuration
  • Loading branch information
angelozerr authored Aug 15, 2018
2 parents 84f9ab9 + 6e1a007 commit 143f2a7
Show file tree
Hide file tree
Showing 8 changed files with 470 additions and 3 deletions.
4 changes: 3 additions & 1 deletion org.eclipse.tm4e.languageconfiguration/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Require-Bundle: org.eclipse.jface.text,
org.eclipse.ui.ide,
org.eclipse.core.filebuffers,
org.eclipse.core.filesystem,
org.eclipse.tm4e.registry
org.eclipse.tm4e.registry,
org.eclipse.ui.editors,
org.eclipse.e4.ui.css.swt.theme
Bundle-Activator: org.eclipse.tm4e.languageconfiguration.internal.LanguageConfigurationPlugin
Export-Package: org.eclipse.tm4e.languageconfiguration
3 changes: 2 additions & 1 deletion org.eclipse.tm4e.languageconfiguration/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ bin.includes = META-INF/,\
.,\
schema/,\
plugin.xml,\
plugin.properties
plugin.properties,\
resources/
42 changes: 41 additions & 1 deletion org.eclipse.tm4e.languageconfiguration/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,45 @@
contentType="org.eclipse.core.runtime.text">
</autoEditStrategy>
</extension>

<extension
point="org.eclipse.ui.genericeditor.highlightReconcilers">
<highlightReconciler
class="org.eclipse.tm4e.languageconfiguration.LanguageConfigurationBracketMatchingReconciler"
contentType="org.eclipse.core.runtime.text">
</highlightReconciler>
</extension>
<extension
point="org.eclipse.ui.editors.annotationTypes">
<type
name="org.eclipse.tm4e.languageconfiguration.bracketmatching">
</type>
</extension>
<extension
point="org.eclipse.ui.editors.markerAnnotationSpecification">
<specification
annotationType="org.eclipse.tm4e.languageconfiguration.bracketmatching"
label="Matching Pair"
textPreferenceKey="TM4EMatchingPair" textPreferenceValue="false"
highlightPreferenceKey="TM4EMatchingPairHighlighting"
highlightPreferenceValue="true" contributesToHeader="false"
overviewRulerPreferenceKey="TM4EMatchingPairInOverviewRuler"
overviewRulerPreferenceValue="true"
verticalRulerPreferenceKey="TM4EMatchingPairInVerticalRuler"
verticalRulerPreferenceValue="false" colorPreferenceKey="TM4EMatchingPairColor"
colorPreferenceValue="212,212,212" presentationLayer="4"
showInNextPrevDropdownToolbarAction="true"
textStylePreferenceKey="TM4EMatchingPairTextStyle"
textStylePreferenceValue="NONE"
includeOnPreferencePage="true">
</specification>
</extension>
<extension
point="org.eclipse.e4.ui.css.swt.theme">
<stylesheet
uri="resources/css/dark.css">
<themeid
refid="org.eclipse.e4.ui.css.theme.e4_dark">
</themeid>
</stylesheet>
</extension>
</plugin>
15 changes: 15 additions & 0 deletions org.eclipse.tm4e.languageconfiguration/resources/css/dark.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*******************************************************************************
* Copyright (c) 2018 Red Hat Inc. and others.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Lucas Bullen (Red Hat Inc.) - initial implementation
*******************************************************************************/
IEclipsePreferences#org-eclipse-ui-editors:org-eclipse-tm4e-languageconfiguration {
preferences:
'TM4EMatchingPairColor=27,98,145'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* Copyright (c) 2018 Red Hat Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Lucas Bullen (Red Hat Inc.) - initial API and implementation
*/
package org.eclipse.tm4e.languageconfiguration;

import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.reconciler.MonoReconciler;

public class LanguageConfigurationBracketMatchingReconciler extends MonoReconciler {
public LanguageConfigurationBracketMatchingReconciler() {
super(new LanguageConfigurationBracketMatchingReconcilingStrategy(), false);
}

@Override
public void install(ITextViewer textViewer) {
super.install(textViewer);
((LanguageConfigurationBracketMatchingReconcilingStrategy) getReconcilingStrategy(
IDocument.DEFAULT_CONTENT_TYPE)).install(textViewer);
}

@Override
public void uninstall() {
super.uninstall();
((LanguageConfigurationBracketMatchingReconcilingStrategy) getReconcilingStrategy(
IDocument.DEFAULT_CONTENT_TYPE)).uninstall();
}
}
Loading

0 comments on commit 143f2a7

Please sign in to comment.