Skip to content
This repository was archived by the owner on Aug 13, 2024. It is now read-only.

Commit 132a0ff

Browse files
committed
Merge pull request #314 from Rouche/master
Fixes #313
2 parents f212a80 + f53f723 commit 132a0ff

File tree

3 files changed

+12
-20
lines changed

3 files changed

+12
-20
lines changed

com.palantir.typescript/META-INF/MANIFEST.MF

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ Require-Bundle: org.eclipse.compare,
1818
org.eclipse.ui.editors,
1919
org.eclipse.ui.ide,
2020
org.eclipse.ui.views,
21-
org.eclipse.ui.workbench.texteditor
21+
org.eclipse.ui.workbench.texteditor,
22+
org.eclipse.jdt.ui
2223
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
2324
Bundle-ActivationPolicy: lazy
2425
Bundle-ClassPath: lib/guava-19.0.jar,

com.palantir.typescript/src/com/palantir/typescript/IPreferenceConstants.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.palantir.typescript;
1818

19+
import org.eclipse.jdt.ui.PreferenceConstants;
1920

2021
/**
2122
* The preference constants used for handling preferences.
@@ -56,8 +57,8 @@ public interface IPreferenceConstants {
5657
String EDITOR_CLOSE_JSDOCS = "editor.closeJSDocs";
5758
String EDITOR_INDENT_SIZE = "editor.indentSize";
5859
String EDITOR_INDENT_STYLE = "editor.indentStyle";
59-
String EDITOR_MATCHING_BRACKETS = "editor.matchingBrackets";
60-
String EDITOR_MATCHING_BRACKETS_COLOR = "editor.matchingBracketsColor";
60+
String EDITOR_MATCHING_BRACKETS = PreferenceConstants.EDITOR_MATCHING_BRACKETS;
61+
String EDITOR_MATCHING_BRACKETS_COLOR = PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR;
6162

6263
String FORMATTER_INSERT_SPACE_AFTER_COMMA_DELIMITER = "formatter.insertSpaceAfterCommaDelimiter";
6364
String FORMATTER_INSERT_SPACE_AFTER_FUNCTION_KEYWORD_FOR_ANONYMOUS_FUNCTIONS = "formatter.insertSpaceAfterFunctionKeywordForAnonymousFunctions";

com.palantir.typescript/src/com/palantir/typescript/text/TypeScriptEditor.java

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.eclipse.core.resources.IFile;
2626
import org.eclipse.core.resources.IProject;
2727
import org.eclipse.core.resources.IResource;
28+
import org.eclipse.jdt.ui.PreferenceConstants;
2829
import org.eclipse.jface.preference.IPreferenceStore;
2930
import org.eclipse.jface.text.BadLocationException;
3031
import org.eclipse.jface.text.DocumentEvent;
@@ -158,12 +159,16 @@ public FileLanguageService getLanguageService() {
158159
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
159160
super.init(site, input);
160161

162+
this.characterPairMatcher = createCharacterPairMatcher();
163+
161164
if (input instanceof IPathEditorInput) {
162165
IResource resource = ResourceUtil.getResource(input);
163166
IProject project = resource.getProject();
164167

165168
// set a project-specific preference store
166169
ChainedPreferenceStore chainedPreferenceStore = new ChainedPreferenceStore(new IPreferenceStore[] {
170+
PreferenceConstants.getPreferenceStore(),
171+
TypeScriptPlugin.getDefault().getPreferenceStore(),
167172
new ProjectPreferenceStore(project),
168173
EditorsUI.getPreferenceStore(),
169174
PlatformUI.getPreferenceStore()
@@ -223,11 +228,11 @@ public void selectAndReveal(int offset, int length, String name) {
223228

224229
@Override
225230
protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
226-
super.configureSourceViewerDecorationSupport(support);
227-
228231
support.setCharacterPairMatcher(this.characterPairMatcher);
229232
support.setMatchingCharacterPainterPreferenceKeys(IPreferenceConstants.EDITOR_MATCHING_BRACKETS,
230233
IPreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR);
234+
235+
super.configureSourceViewerDecorationSupport(support);
231236
}
232237

233238
@Override
@@ -288,21 +293,6 @@ protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler rule
288293
return sourceViewer;
289294
}
290295

291-
@Override
292-
protected void initializeEditor() {
293-
super.initializeEditor();
294-
295-
this.characterPairMatcher = createCharacterPairMatcher();
296-
297-
// set the preference store
298-
ChainedPreferenceStore chainedPreferenceStore = new ChainedPreferenceStore(new IPreferenceStore[] {
299-
TypeScriptPlugin.getDefault().getPreferenceStore(),
300-
EditorsUI.getPreferenceStore(),
301-
PlatformUI.getPreferenceStore()
302-
});
303-
this.setPreferenceStore(chainedPreferenceStore);
304-
}
305-
306296
@Override
307297
protected void initializeKeyBindingScopes() {
308298
this.setKeyBindingScopes(new String[] {

0 commit comments

Comments
 (0)