Community
Participate
Working Groups
The C editor already has the ability to convert tabs to spaces. This is ofter useful in meeting code style guidelines. Unfortunately the assembly editor lacks this ability. I have created a patch which refactors the existing functionality to make it available to both CEditor and AsmEditor.
Created attachment 51666 [details] Proposed patch This patch is made against our cvs tree which has been selectively patched from cdt head and also hand edited. Hence I'm not sure how it compares with the current HEAD and whether it can be applied. If this is a problem let me know and I will check out HEAD and diff against it...
Please provide a patch against HEAD, because it has changed a lot since. Creating a common editor base class for language independent features makes sense. I noticed that your patch also adds bracket highlighting to the assembly editor. Is this intended?
(In reply to comment #2) > Please provide a patch against HEAD, because it has changed a lot since. OK. I'll get on to this. > Creating a common editor base class for language independent features makes > sense. Yes -- it would be even more ideal if these were incorporated into the platforms TextEditor or something... > I noticed that your patch also adds bracket highlighting to the assembly > editor. Is this intended? In fact it was unintended -- I did the refactoring in rather a hurry and this stuff must have been pulled in by accident. It does make some sense to have it there though... Also I've been testing the patch over the last week or two and haven't noticed any other unintended side effects.
No kidding when you say there's been a lot of changes! I'm afraid I don't have time to do the merge right now. Probably the easiest option would be to perform the refactoring again. IIRC i just used 'Extract Superclass' to extract all the relevant fields/methods into a class called AbstractCDTEditor then made this the superclass for AsmTextEditor. There was also some fiddling around since CSourceViewer (which it appears now contains the TabConverter class) needed to be treated in a similar manner.
Created attachment 52000 [details] Second patch attempt. This patch should apply against head. I've tested it briefly and it appeared to work as intented. You may have to adjust code-style settings to see the behaviour. This patch also opens the door to making more CDT specific editor functionality to the assembly editor (and any other editors kicking around).
Thanks for the update. Some issues remain: - Tab conversion should be enabled when the editor is opened and not only when the settings are changed (@see CEDitor#createPartControl()). - The abstract editor should also update the textwidget's tab width upon preference changes (@see CEditor#handlePreferenceStoreChanged()). - The source viewer configuration should also be refactored to a common abstract class - to share the same tab-width and indent prefixes - Please add a proper copyright comment and javadoc to new classes.
Seems like the platform has added support for that in the general text editor (bug 82296). This way, the assembly editor would get that for free, I think.
Great! In order to take advantage of this the AsmSourceViewerConfiguration must make sure to pass its preference store to the parent in the constructor. This ensures that the AsmTextEditor inherits all the settings from the platform text editor e.g. tab width, tab conversion...
Thanks for the hint. I'll look into it.
Fixed. The Assembly Editor now supports the platform provided spaces for tabs feature.