palantir / eclipse-typescript

An Eclipse plug-in for developing in the TypeScript language.
Apache License 2.0
339 stars 73 forks source link

Matching bracket color #313

Closed Rouche closed 8 years ago

Rouche commented 8 years ago

Hi,

I just want to know what color / system variable the TypeScript editor "matching bracket" color is using. I really want to change it because i use black theme. 2016-04-19_8-01-43 I tryed everything.

General->Editors->Text Editors->Annotations->Matching tags : Not working General->Editors->Structured Text Editor->Matching brackets highlight : Not working Javascript->Editor->Matching brackets highlight : Not working Java->Editor->Matching brackets highlight : Not working (of course)

Theres also another one defined in plugin.xml of org.eclipse.jdt.ui I overriden this color too. And yeah not working either.

<colorDefinition
    id="org.eclipse.jdt.ui.matchingBracketsColor"
    isEditable="false"
    label="%Dummy.label"
    value="240,240,240">
</colorDefinition>

Edit: I saw this line in IPreferenceConstants, should this line be changed to "org.eclipse.jdt.ui.matchingBracketsColor" ? It my screenshot this does not seem to be 128,128,128.

String EDITOR_MATCHING_BRACKETS_COLOR = "editor.matchingBracketsColor";
        store.setDefault(IPreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR, "128,128,128");

Thanks

derekcicerone-zz commented 8 years ago

Ah yeah we should use the default - good call. Wanna submit a PR for this? I think you are looking at the correct code to change.

Rouche commented 8 years ago

Eek, well i was just checking code really fast.

Unfortunatelly im not setup as a plugin development to fully test it, it might take some time. I also dont understand where this property is used (editor.matchingBracketsColor), is it internally by Eclipse?

derekcicerone-zz commented 8 years ago

I think its just internal to the plugin. I can also take a shot at this change but it might be a while - its hard for me to find time to develop lately.

Rouche commented 8 years ago

Its ok im trying to configure my environment. The project does not seem like the others ive seen. I dont see the "Maven Libraries" in classpath. Ill try tomorrow.

I might just use external maven and copy the generated jar in. Will be long but better than nothing :P

Regards

Rouche commented 8 years ago

VICTORY!!! There was 2 ChainedPreferenceStore set. Obviously only the one in init was set. OR set last. for now i just added the TypeScript default at the start of the chain in init, but the right way to do it would be to go get JDT default (Or the store that set the built-in matching bracket for StructuredTextEditor)

I will try to figure this out and PR after, but at least the solution is there.

For reference: https://bugs.eclipse.org/bugs/show_bug.cgi?id=215265

    @Override
    public void init(IEditorSite site, IEditorInput input) throws PartInitException {
        super.init(site, input);

        if (input instanceof IPathEditorInput) {
            IResource resource = ResourceUtil.getResource(input);
            IProject project = resource.getProject();

            // set a project-specific preference store
            ChainedPreferenceStore chainedPreferenceStore = new ChainedPreferenceStore(new IPreferenceStore[] {
                    TypeScriptPlugin.getDefault().getPreferenceStore(),
                    new ProjectPreferenceStore(project),
                    EditorsUI.getPreferenceStore(),
                    PlatformUI.getPreferenceStore()
            });
            this.setPreferenceStore(chainedPreferenceStore);
        }
    }

    @Override
    protected void initializeEditor() {
        super.initializeEditor();

        this.characterPairMatcher = createCharacterPairMatcher();

        // set the preference store
        ChainedPreferenceStore chainedPreferenceStore = new ChainedPreferenceStore(new IPreferenceStore[] {
                TypeScriptPlugin.getDefault().getPreferenceStore(),
                EditorsUI.getPreferenceStore(),
                PlatformUI.getPreferenceStore()
        });
        this.setPreferenceStore(chainedPreferenceStore);
    }
derekcicerone-zz commented 8 years ago

cool :)