Re: [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 17:47:52
|
I found where PyDev is doing the magic, in PyLinkedModeCompletionProposal. I made my own copy of this class, modifying the goToLinkedModeFromArgs() method to parse my arg string. It has parameter names and values (i.e. somename=someVal), and I want the editable fields to be just the param values. -Mark On 02/26/2016 12:28 AM, Mark Leone wrote: > 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 > > ------------------------------------------------------------------------------ > Site24x7 APM Insight: Get Deep Visibility into Application Performance > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > Monitor end-to-end web transactions and take corrective actions now > Troubleshoot faster and improve end-user experience. Signup Now! > http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 > _______________________________________________ > pydev-code mailing list > pyd...@li... > https://lists.sourceforge.net/lists/listinfo/pydev-code > |