Re: [Pydev-code] Getting started with PyDev scripting
Brought to you by:
fabioz
From: Fabio Z. <fa...@gm...> - 2006-04-13 15:28:44
|
> > > 1) > Is there some way of detecting whether or not there's a syntax error on > the > current line at sript execution? In the current form my script will > happily > propagate syntax errors from the def line, e.g: > > class moo: > def cow(self, 1): > > (gives self.1 =3D 1 on execution) Well, actually, you could, but that would be harder, mostly because you wan= t to do that even on other syntax errors (because you could do: editor.getAST= () and check its return for the abstract syntax tree with the results of the parsing, but it might fail in other errors, and not only in the current one), so, I wouldn't worry about this one, as the user would see the syntax error on that line anyway. 2) Is there a bug in getInsideParentesisToks? > If called with the string "(foo,)" then (the equivalent of) ['foo'] is > returned. If called with the string "(foo, )" then (the equivalent of) > ['foo', > ''] is returned. The input values are equivalent in python, so shouldn't > the > returned values be equal? Well, yes, I think so too ;-) Fixed for 1.0.6 The reason I ask is related to my comment at line 71 in my attached script: > # This can happen with legal def lines such as "def moo(self, ):" > > > 3) > Right now my script activates on "Ctrl-2" followed by "a<Enter>". I think > what > we initially discussed was having this as "Ctrl-2" followed by "a", which > just > requires swapping the True at the final line for a False. > > Which one should I use? The latter seems more convenient for me right now= , > but > using it makes it impossible to execute other scripts whose names begin > with > "a". Is there an easy way for users to rebind script names to their needs= ? > Who > decides which script should have what name? You can let it with True... If later something else appears it can be changed. The only way to rebind it currently is changing the script itself. And who decides is the script author ;-) Also, the script has 1 minor 'quirk': if your def line is the last line of the document (without any new-line in the end) -- fault of PySelection.addLine (which I just fixed, so, should work without this problem on 1.0.6). Cheers, Fabio |