Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 314424

Summary: [Cheatsheet] Add a tag for sample code sections in custom cheat sheets that can be formatted and easily copied into editor
Product: [Eclipse Project] Platform Reporter: Ben Spiller <bjs>
Component: User AssistanceAssignee: platform-ua-inbox <platform-ua-inbox>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: cgold
Version: 4.0   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Ben Spiller CLA 2010-05-26 05:55:04 EDT
Build Identifier: 20100218-1602

The cheat sheet feature in Eclipse is nicely implemented and versatile, but it's unnecessarily hard and visually unappealing when your cheat sheet is guiding the user through adding text to the editor (e.g. to demonstrate a programming language you're supporting in eclipse). 

A great enchancement would be a new tag to allow 'code' samples to be added to the cheatsheet item or subitem text, with the following properties:
- a monospaced font should be applied to the text
- it should be possible to add some indentation to make multiple lines easier to read (obviously cheat sheet authors will want to avoid large indents and overly long sample code chunks, which are not appropriate for cheat sheets. But it's very reasonable to display 2-3 lines of sample code in a cheatsheet step and a indents (e.g. 2 spaces) would improve readability without compromising the cheatsheet experience)
- a button that makes it easy to copy this text into the editor (e.g. by copying it to the clipboard, or by pasting it at the current insertion point, or an icon that can be dragged and dropped into the editor, ...). Otherwise repeatedly copying text from the cheat sheet into the editor is quite a fiddly business. 

This would be a *big* usability improvement,and open the way for the existing cheatsheet mechanism to be used for teaching programming language concepts without the current UI restrictions that make this difficult. 

Reproducible: Always
Comment 1 Chris Goldthorpe CLA 2010-05-26 13:54:27 EDT
Is the main restriction you are trying to overcome the lack of control-C support? (It is possible to copy text but you have to right click and select copy).
Comment 2 Ben Spiller CLA 2010-05-27 04:53:42 EDT
Hi Chris,

(In reply to comment #1)
> Is the main restriction you are trying to overcome the lack of control-C
> support? (It is possible to copy text but you have to right click and select
> copy).

Well that compounds the problem, but I'm aware there are other bugs entered for that already. I'm concerned about both 1) getting sample code from the cheat sheet into the editor and 2) formatting. 

Ctrl+C support would obviously *help* with (1), but it can still be fiddly and error prone for users to have to select the right block of text (i.e. the sample code but not the surrounding explanatory text) and repeatedly copy it, especially in an in-depth tutorial with many steps. If there was markup in the cheatsheet to say 'this block of text is to be treated as sample code' with a button to either put the whole block on the clipboard, or insert it directly into the active editor window that would improve the user experience a lot. 

I think (2) is also very important - having a tag that could distinguish sample code from the surrounding explanation (by used a monospaced font) would improve the visual clarity of a cheatsheet that includes sample code. But I think the number 1 usability problem for our company at the moment is that there's no way to indent code. I wouldn't want to have large indents, or over-use them, due to the width constraints, but it's very hard to read even 3-4 lines of complicated code without indentation, and also looks a bit shoddy. At present there's just no way for a cheatsheet author to do this

Many wiki systems I've dealt with have a {code}...{code} type construct, recognising that code snippets are an important semantic entity that need different formatting rules and behaviour, and it would be great to see something similar (e.g. <code></code>) in the cheatsheets. 

(As an aside, I'm thinking that if the cheatsheets had a way of marking code I could write unit tests that processed the cheatsheet xml and checked the syntactic correctness of the embedded code blocks, which would also be cool)

Is that a bit clearer? A first step would be just to deal with the formatting issues, then insert-into-editor support could be added later?
Comment 3 Eclipse Webmaster CLA 2019-09-06 16:04:38 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.