eclipse-typescript icon indicating copy to clipboard operation
eclipse-typescript copied to clipboard

Allow syntax highlighting colors to be customized

Open olra0001 opened this issue 11 years ago • 18 comments

When using a different syntax highlighting, e.g. with a dark background, one can barely see the coloring of the code. There is no possibility to adjust the coloring for TypeScript Editor nor does it inherit the colors of another editor, e.g. JavaScript.

For simplicity, it could inherit the one's of the JS editor and only provide customization for the TypeScript specifics.

olra0001 avatar Sep 06 '13 10:09 olra0001

+1 for this plz. i like using dark themes

mikesmullin avatar Sep 14 '13 05:09 mikesmullin

+1, I too would like a dark theme

teamdandelion avatar Oct 03 '13 07:10 teamdandelion

+1. it's no usable with a dark theme...

pichsenmeister avatar Nov 13 '13 15:11 pichsenmeister

+1 Just tried it out.... and same disappointment. This is purely aesthetics, granted, but I'm a dark colour theme guy- the editor is not configurable and is unreadable when Eclipse settings are leaning toward dark themes. Would be great to allow customisation of syntax colours. Wouldn't break workflow with other languages that way.

P.S. I am not suggesting this as a full stop viable alternative- this is purely in terms of applying colour themes- I installed Enide 0.7.04 plugin for Eclipse, then opened file with Node Editor rather than TypeScript editor and voila- colour themes applied to NodeScript. (Right click .ts file > Open With > Other > Node Editor). My JavaScript colorisation was applied to Node editor and typescript in return, which fits with my dark theme preferences. Now- to real work- very much looking forward to trying eclipse-typescript!

http://marketplace.eclipse.org/content/enide-eclipse-nodejs-ide#.UpY6rpFFv1I

objectkit avatar Nov 27 '13 18:11 objectkit

FWIW, Microsoft Visual Studio's paid version supports dark themes and typescript just fine

mikesmullin avatar Nov 27 '13 23:11 mikesmullin

One of my concerns with this request is that people will expect it to work with the theming support in the latest versions of Eclipse. From what I understand, those themes have to hardcode knowledge of certain languages like Java and JavaScript. One of the ideas I had was to tie the colors for TypeScript to those used for JavaScript. I think it will be unlikely that people would want those two languages to look different given their similarities. Thoughts?

derekcicerone-zz avatar Dec 02 '13 17:12 derekcicerone-zz

This is a good guide to the JavaScript color keys: https://github.com/eclipse-color-theme/eclipse-color-theme/blob/master/com.github.eclipsecolortheme/mappings/org.eclipse.wst.jsdt.ui.xml?source=cc

derekcicerone-zz avatar Dec 04 '13 03:12 derekcicerone-zz

Ok, looks like there are a few things necessary to make this work properly:

  1. Update the PresentationReconciler to use colors set in the preferences vs. hardcoded (easy)
  2. Implement a preference page for changing the colors (not hard but lots of code to do it right)
  3. Send a pull request to the Eclipse Color Theme plug-in (http://eclipsecolorthemes.org/?view=plugin) of the necessary preference key mappings to support the TypeScript editor (easy, but reliant upon them to accept it)

The second step is kinda optional if we can successfully get TypeScript supported by the theme plug-in since that would effectively provide the UI for setting the colors. I think I'll try that first (items 1 & 3) since creating the color preference page UI will be super painful.

derekcicerone-zz avatar Dec 04 '13 05:12 derekcicerone-zz

Ok, step 1 is complete. The plug-in identifier is "com.palantir.typescript".

The keys are as seen here: String SYNTAX_COLORING_COMMENT_COLOR = "syntaxColoring.comment.color"; String SYNTAX_COLORING_IDENTIFIER_COLOR = "syntaxColoring.identifier.color"; String SYNTAX_COLORING_KEYWORD_COLOR = "syntaxColoring.keyword.color"; String SYNTAX_COLORING_NUMBER_LITERAL_COLOR = "syntaxColoring.numberLiteral.color"; String SYNTAX_COLORING_OPERATOR_COLOR = "syntaxColoring.operator.color"; String SYNTAX_COLORING_PUNCTUATION_COLOR = "syntaxColoring.punctuation.color"; String SYNTAX_COLORING_REG_EXP_LITERAL_COLOR = "syntaxColoring.regExpLiteral.color"; String SYNTAX_COLORING_STRING_LITERAL_COLOR = "syntaxColoring.stringLiteral.color";

(this follows the naming conventions used by Scala - which seemed to use the most sane conventions amongst the various plug-ins I looked at for inspiration)

derekcicerone-zz avatar Dec 04 '13 21:12 derekcicerone-zz

Pull request created for the Eclipse Color Theme plug-in: https://github.com/eclipse-color-theme/eclipse-color-theme/pull/150

derekcicerone-zz avatar Dec 06 '13 18:12 derekcicerone-zz

Is there a way to set these colors manually, by editing a preferences file or something?

stacktracer avatar Mar 04 '14 22:03 stacktracer

Looks like they go under your workspace dir, in .metadata/.plugins/org.eclipse.core.runtime/.settings/com.palantir.typescript.prefs

stacktracer avatar Mar 04 '14 22:03 stacktracer

Here are my prefs (com.palantir.typescript.prefs) for interested people:

compiler.compileOnSave=true compiler.mapSourceFiles=true eclipse.preferences.version=1 editor.indentSize=2 tabWidth=2 syntaxColoring.comment.color=63,127,95 syntaxColoring.identifier.color=0,0,255 syntaxColoring.keyword.color=127,0,85 syntaxColoring.numberLiteral.color=196,140,255 syntaxColoring.operator.color=0,0,0 syntaxColoring.punctuation.color=0,0,0 syntaxColoring.regExpLiteral.color=128,64,64 syntaxColoring.stringLiteral.color=128,0,0

david-bouyssie avatar Oct 27 '15 10:10 david-bouyssie

No update?

Metalchocobo avatar Apr 15 '16 13:04 Metalchocobo

+1 Font colours itself are fine for me (same as in js editor), but variable highlighting and bracket highlighting do not seem to be customizable (vars / brackets unreadable with dark theme).

Katharsas avatar Apr 25 '16 22:04 Katharsas

Got the same problem, with a dark theme the highlighting renders an unreadable light grey block.

manuelmanhart avatar Apr 19 '18 12:04 manuelmanhart

@manuelmanhart I'd advise you to switch to something that uses tsserver, like https://github.com/angelozerr/typescript.java or VSCode (even better, dark theme included). With tsserver, you will have a much easier life getting IDE support for new TS features. This plugin has not seen any updates since April 2017.

Katharsas avatar Apr 20 '18 15:04 Katharsas

Thanks for your answer, I do use VS Code for my typescript projects. But we have some Java projects where the typescript is tightly included - for these I would like to stay with Eclipse.

I will have a look into typescript.java and tsserver, thanks again.

manuelmanhart avatar Apr 20 '18 18:04 manuelmanhart