Fabio Zadrozny wrote:
I've checked it, and I have some suggestions:
1. Instead of having 80 as the default, you could use the preferences
the user specified as its print margin:
from org.python.pydev.plugin import PydevPlugin
from org.eclipse.ui.texteditor import
AbstractDecoratedTextEditorPreferenceConstants
cols =
PydevPlugin.getChainedPrefStore().getInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN
);
That is really good. Done - I have updated the version on the web page:
http://pilger.googlepages.com/pydevstuff
Actually, this brings up an observation about Pydev extension scripts:
there is no mechanism to allow a script to have preferences. I don't
know how you could provide one, but it would be nice.
2. When you try to indent the following:
#_line_to_wrap1_eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
# class Foo:
# def m1():
# pass
#_line_to_wrap2_eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
if you start doing it at the first line, it will stop there, and not get
the full comment block (so, I think it could indent all that started
with '#' + character, instead of bailing out when it finds the first '#'
+ space)
I have kept this thing simple as I did not want to get into analyzing
what the text actually is (code or text) because then I would have to do
different things. If it is indented multiline text then I should rewrap
it to the new indentation, if it is a bunch of lines of code starting at
the same indent then I should leave them alone.
I don't know how to distinguish:
# This is line one,
# and this is line two that should be wrapped.
from:
# print "This is line one, "
# print " and this is line two that should not be wrapped."
Your observation would also apply to lines inside multiline docstrings.
I bailed on doing this much analysis. I bailed on rewrapping more than
one paragraph and I even bailed on handling the first line of a docstring.
I may do more later but so far I have not found these restrictions too
much of a burden, especially when compared to reformatting comments by
hand.
I think that this thing obeys the Pareto Principle - it does 80% of what
I want for 20% of the effort required to do it completely.
Don
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
pydev-code mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pydev-code