I am trying to write a little plugin that takes the current editor selection and copies that snippet of code as html to the clipboard.
(The built-in action always create a complete html document. Later I also like the pluging to be configurable, so that it uses any formatting tags applicable to a certain blog/forum software.)
I managed to access the Editor, EditorColorsScheme, Document, SelectionModel, and MarkupModel.
Now I am just stuck. Where do I go from here?
The MarkupModel and the RangeHighlighters looked promising, but I don't think they are used for regular syntax highlighting?!
I can get the plain text from the selection model, but that does not help me in parsing the text and associating colors and fonts.
Can I somehow get the PSI subtree that matches the selection and then get the TextAttributes using the current color scheme?
Argl... any suggestions?