| Summary: | Syntax highlighting and themeing | ||
|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Simon Kaegi <simon_kaegi> |
| Component: | Editor | Assignee: | Project Inbox <orion.editor-inbox> |
| Status: | RESOLVED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | bokowski, eclipse.felipe, john.arthorne, karol, mamacdon, Mike_Wilson, Silenio_Quarti, susan |
| Version: | 0.2 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
|
Description
Simon Kaegi
If I am not mistaken, the editor component already uses its own stylesheet. This stylesheet applies to the editor only, not the complete page. I believe that it is appropriate for a plugin to contribute such an editor-only stylesheet, so that the editor can be themed. We could think about it but I'm concerned this might allow a cleverly written stylesheet to do things it was not intended to do. Notes: - Currently the editor has one css that includes all styles -- syntax highlight (keyword, etc) -- rules styles (background color for the line numbering etc) -- bracket matching color -- current line highlight -- default editor styles (font, background, etc) You can pass an array of css files to the editor, so it possible to split the css information on several files. This can be useful if the users wants to restyle the colors for the syntax highlight without changing, for example, the colors for the line numbering ruler. What I suspect you will need, and currently you won't have in the editor, is the capability of changing the css files for the editor without recreating it. (In reply to comment #2) > We could think about it but I'm concerned this might allow a cleverly written > stylesheet to do things it was not intended to do. Do you have any pointers to the relevant scare literature? What kind of bad things could a stylesheet do? Also, wouldn't we expect users to only install plugins from reputable sources? ;-) (In reply to comment #4) > Do you have any pointers to the relevant scare literature? What kind of bad > things could a stylesheet do? Also, wouldn't we expect users to only install > plugins from reputable sources? ;-) Until recently you could run JavaScript in CSS "expression"s and "behavior"s and I suspect a little research is needed. Perhaps it's fine but we need to be incredibly careful about letting a plugin execute code in the security context of the main application. I buy the reputable source argument only as far as we have some control of what that reputable source can do. Right now there is no way to contribute styles to the editor via extensions (or anywhere else in the UI, really, despite the fact that some services allow you to specify what CSS classes should be applied to UI elements). Is there anything we can do wrt defining an acceptable CSS subset that is "safe" to use? Some quick Googling suggests that expression support was limited to IE and is disabled in IE8+ when running in standards mode [1]. I tested with IE9 and found that setExpression still executed when the document mode was Quirks or IE7 Standards, but not IE8 Standards or above. [1] http://msdn.microsoft.com/en-us/library/cc304082(v=vs.85).aspx#expressions [2] http://msdn.microsoft.com/en-us/library/ms537634%28v=vs.85%29.aspx Since we won't have a story for contributing CSS from plugins for 0.3, I'm proposing we at least provide a reasonable default set of syntax highlighting themes in bug 360967. Currently it appears to be impossible to write a simple syntax highlighter other than the HTML one, because we hard-code the CSS themes for the HTML grammar in our editor. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=363970#c9 https://bugs.eclipse.org/bugs/show_bug.cgi?id=334212#c2 We just added support to TextView to change the theme (setOptions changing stylesheets and themeClass). Closing as part of a mass clean up of inactive bugs. Please reopen if this problem still occurs or is relevant to you. For more details see: https://dev.eclipse.org/mhonarc/lists/orion-dev/msg03444.html |