|
Specifically, I'm using UltraEdit and perhaps there's no way perfect way
to implement code folding with it, given how it uses its syntax
highlighting file to do so (i.e., you have to specify an "Opening" and
"Closing" character in which to enfold code, such as braces).
But my question is more general: is it possible to implement code
folding with Python given that it has no real block delimiters? Or is
this still a matter of which particular editor/IDE you use? For my part
I've tried (as was suggested elsewhere) to use 'def' as an opening and
closing keyword, but this of course will enfold everything between two
defs, even if you have more code between your function definitons (such
as a new class definition).
So maybe I'm stuck in UE, but I'm curious if there is some general way
to do this, or is Python just too simple and concise for its own good? :) | |
Share:
|
> But my question is more general: is it possible to implement code folding with Python given that it has no real block delimiters? Or is this still a matter of which particular editor/IDE you use?
Yes, it is an editor thing. In Vim, it's as simple as
:set foldmethod=indent
and presto! I'm sure other quality editors provide similar
options. ;)
So maybe I'm stuck in UE, but I'm curious if there is some general way to do this, or is Python just too simple and concise for its own good? :)
Most editors are "just too simple and concise for [their] own
good". :)
-tkc | | |
John Salerno írta: Specifically, I'm using UltraEdit and perhaps there's no way perfect way to implement code folding with it, given how it uses its syntax highlighting file to do so (i.e., you have to specify an "Opening" and "Closing" character in which to enfold code, such as braces).
But my question is more general: is it possible to implement code folding with Python given that it has no real block delimiters? Or is this still a matter of which particular editor/IDE you use? For my part I've tried (as was suggested elsewhere) to use 'def' as an opening and closing keyword, but this of course will enfold everything between two defs, even if you have more code between your function definitons (such as a new class definition).
So maybe I'm stuck in UE, but I'm curious if there is some general way to do this, or is Python just too simple and concise for its own good? :)
There are many editors that do this. For Python, folding is based on
IDENT and DEDENT tokens. You can look for their definition in the Python
Language Reference.
For example, SPE can do this. See this screenshot: http://stani.be/python/spe/screensho...ux-blender.png
Best,
Laszlo | | |
John Salerno wrote: But my question is more general: is it possible to implement code folding with Python given that it has no real block delimiters? Or is this still a matter of which particular editor/IDE you use?
since the Python syntax *has* real block delimiters (look up INDENT and
DEDENT in the language reference), it's an editor issue.
</F> | | |
John Salerno schrieb: Specifically, I'm using UltraEdit and perhaps there's no way perfect way to implement code folding with it, given how it uses its syntax highlighting file to do so (i.e., you have to specify an "Opening" and "Closing" character in which to enfold code, such as braces).
But my question is more general: is it possible to implement code folding with Python given that it has no real block delimiters? Or is this still a matter of which particular editor/IDE you use? For my part I've tried (as was suggested elsewhere) to use 'def' as an opening and closing keyword, but this of course will enfold everything between two defs, even if you have more code between your function definitons (such as a new class definition).
So maybe I'm stuck in UE, but I'm curious if there is some general way to do this, or is Python just too simple and concise for its own good? :)
Eric3, the Qt-based and in python written IDE can do that. So I'd say
it's an UE-problem - nad it has to be: to perform folding, one has to
find out what constitutes a block. Obviously this CAN be done with
python-code - do it CAN be done in editor code.
Diez | | |
Fredrik Lundh wrote: John Salerno wrote:
But my question is more general: is it possible to implement code folding with Python given that it has no real block delimiters? Or is this still a matter of which particular editor/IDE you use?
since the Python syntax *has* real block delimiters (look up INDENT and DEDENT in the language reference), it's an editor issue.
</F>
Interesting. This might help me then, assuming UE can use characters
other than strings to delimit blocks.
Thanks! | | |
Diez B. Roggisch wrote: Eric3, the Qt-based and in python written IDE can do that. So I'd say it's an UE-problem - nad it has to be: to perform folding, one has to find out what constitutes a block. Obviously this CAN be done with python-code - do it CAN be done in editor code.
::lowers head in embarassment:: I wanted to try out Eric3, but I
couldn't figure out how to install it! Is there a binary file? All I
found was a zipped file with a bunch of stuff I didn't recognize in it.
There was even a file called eric3.py which I thought might be it, but
running it did nothing. | | |
John Salerno napisa³(a): ::lowers head in embarassment:: I wanted to try out Eric3, but I couldn't figure out how to install it! Is there a binary file? All I found was a zipped file with a bunch of stuff I didn't recognize in it. There was even a file called eric3.py which I thought might be it, but running it did nothing.
You'll need PyQt to run that one. And QScintilla too.
--
Jarek Zgoda http://jpa.berlios.de/ | | |
Komodo code folds Python, Perl, PHP . . . | | |
"John Salerno" <jo******@NOSPAMgmail.com> wrote in message
news:jx******************@news.tufts.edu... Specifically, I'm using UltraEdit and perhaps there's no way perfect way to implement code folding with it, given how it uses its syntax highlighting file to do so (i.e., you have to specify an "Opening" and "Closing" character in which to enfold code, such as braces).
But my question is more general: is it possible to implement code folding with Python given that it has no real block delimiters? Or is this still a matter of which particular editor/IDE you use? For my part I've tried (as was suggested elsewhere) to use 'def' as an opening and closing keyword, but this of course will enfold everything between two defs, even if you have more code between your function definitons (such as a new class definition).
So maybe I'm stuck in UE, but I'm curious if there is some general way to do this, or is Python just too simple and concise for its own good? :) | | |
"John Salerno" <jo******@NOSPAMgmail.com> wrote in message
news:jx******************@news.tufts.edu... But my question is more general: is it possible to implement code folding with Python given that it has no real block delimiters?
SciTE can fold Python. | | |
On 2006-06-15, Paul McGuire <pt***@austin.rr._bogus_.com> wrote: "John Salerno" <jo******@NOSPAMgmail.com> wrote in message news:jx******************@news.tufts.edu... But my question is more general: is it possible to implement code folding with Python given that it has no real block delimiters?
SciTE can fold Python.
If only there were a way for users to bind key-sequences...
--
Grant Edwards grante Yow! I was making donuts
at and now I'm on a bus!
visi.com | | |
BartlebyScrivener wrote: Komodo code folds Python, Perl, PHP . . .
also the free ActivePython's Pythonwin IDE | | |
Paul McGuire napisa³(a): But my question is more general: is it possible to implement code folding with Python given that it has no real block delimiters?
SciTE can fold Python.
All other good editors can too. So general answer to this question is
"yes". Because Python *has* real block delimiters...
--
Jarek Zgoda http://jpa.berlios.de/ | | |
John Salerno wrote: But my question is more general: is it possible to implement code folding with Python given that it has no real block delimiters?
I can't speak for UltraEdit, but the Zeus will quite
happily fold Python code: http://www.zeusedit.com/features.html
Jussi Jumppanen
Author: Zeus For Windows IDE | | This discussion thread is closed Replies have been disabled for this discussion. Similar topics
reply
views
Thread by Chris McKeever |
last post: by
|
1 post
views
Thread by Nuff Said |
last post: by
|
8 posts
views
Thread by Joe Wong |
last post: by
|
1 post
views
Thread by LenS |
last post: by
|
reply
views
Thread by John Wels |
last post: by
|
6 posts
views
Thread by TPJ |
last post: by
|
5 posts
views
Thread by EP |
last post: by
|
1 post
views
Thread by Slain |
last post: by
|
reply
views
Thread by Grant Edwards |
last post: by
| | | | | | | | | | | |