[Pydev-code] Best way to set styles for method args after applying a completion proposal
Brought to you by:
fabioz
From: Mark L. <mid...@ve...> - 2016-02-26 05:28:20
|
I've implemented some custom code completion with a completion participant. When I apply one of the completions, I want to make the method arguments easy to edit, the same way that JDT and PyDev do. That is, a border style is set for each arg, and the first one is highlighted with the carrot positioned at the beginning. I have this working, but it's clunky. I'm setting styles on the StyledText widget for each argument. At first I did it with a LineStyleListener, but this blows away PyDev's syntax hightlighting. I had hoped that its styling was done with a LineStyleListener, but I see that it's not. Therefore I have to set the styles directly. I do that as soon as the completion proposal is selected. However, shortly after I set the styles to highlight the args, a parse occurs and my styles are wiped out. I implemented a PostParseListener top put them back. That works, but it looks terrible because the styles appear, disappear almost immediately, and then re-appear a second or two later. The defaul PyDev completion processor does this smoothly, but I looked all through the code and I can't see where it happens. Can someone tell me what the right way is to handle what I'm trying to do, or point me to the PyDev code that does it so I can follow that example? -Mark |