Code folding
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
must be optional !
If this were a feature, I would likely have it OFF (!) almost all of the time.
I am one of those people who barely ever uses it in C#, and I've used that for quite a few midsize projects. I just find it isn't terribly practical addition to the way I [personally] write code. The first thing I generally do is turn folding off when I open a VS solution with various regions collapsed. I just don't like not being able to see everything.
Don't get me wrong, though, I actually would like to *have* the option. The only time I see using it that much is when reviewing a project, either when starting it, or when reviewing a big round of my recent work. Personally, I like seeing ALL of the code I write with nothing hidden that could be biting me at compile time. Of course, I don't generally do things like put more than one class definition per file, so that's why it doesn't sound very appealing to me. I keep my code as modularized as I possibly can.
We've beat this dead horse a thousand times already, but there is one way I can think of to make it work in as simplistic a fashion as possible - with a Namespace2 that has an alternate bracketing mechanism. Even if a "bracket is designated as "#region" and "#endregion", the folding needs to ignore things inside of a comment, syntax block, string, etc.
Then there's also the problem I should mention of being sure the folding-start and folding-end brackets don't have characters that are also regular brackets or operators, because the existing TextPad applies a pretty simple approach to determining what type of code gets what type of color treatment. I've run into these limitations before. Like if I assign a SingleComment to a # for a Perl-esque language, there is no way for me to also have the # character be colored correctly when in another context.. such as when existing in a bare-looking string like s/#search/replace/gi, and even though perl definitely supports using that character for things like an alternate matching operand like m#regex-match-test#. To help combat occurrences of these oddities from screwing up my syntax highlighting for cgi scripts, I use a triple ### for a SingleCommentAlt. Not great, but it does basically work. Anyways, the short version of my comment here should just be that this is a very difficult problem, only complicated by things like how to even approach what code instrumentation should be matched against the fold start/end indicators.
The other final sticky point I'll mention is where to keep the data for what is and is not "folded". This data can't be in the file being edited itself, so it has to be in the workspace file. That's fine by me, but it isn't all that portable. There isn't a way around this issue unless TextPad starts spanning extra files like file.ext.folds all over the place - which sucks if you ask me, and I trust that Helios would only go with the workspace thing, just like it does for the existing bookmarks.
Personally, since I wouldn't use the feature, and since there are so many difficulties in applying a good, generic approach that will be as cross-platform [target] and multifunctional as TextPad's target end-use paradigm... I can see why it isn't in there yet.
- - -
On a more positive note:
To the person talking about bookmarking functions - use a macro. I have long used a macro that I run when I first open a file. It clears all bookmarks and then does a RegEx search and marks all lines matching something like:
^[[:space:]]*\(class\|function\|sub\|def\|type\)[[:space:]]\{1\}
I code in many languages, and this macro I use works very well for me when using any/all of my languages, including including PHP, Perl, ASP-VB, ASP-JScript, WSH, Python, and BlitzMax. There are probably specialized cases such as PHP/ASP with embedded Javascript in the HTML blocks due to the namespacing where this wouldn't necessarily work right off, but if you instrument your code properly, I think you will find it a quite successful approach... I've been doing it for many years :)
·· Z ··
I am one of those people who barely ever uses it in C#, and I've used that for quite a few midsize projects. I just find it isn't terribly practical addition to the way I [personally] write code. The first thing I generally do is turn folding off when I open a VS solution with various regions collapsed. I just don't like not being able to see everything.
Don't get me wrong, though, I actually would like to *have* the option. The only time I see using it that much is when reviewing a project, either when starting it, or when reviewing a big round of my recent work. Personally, I like seeing ALL of the code I write with nothing hidden that could be biting me at compile time. Of course, I don't generally do things like put more than one class definition per file, so that's why it doesn't sound very appealing to me. I keep my code as modularized as I possibly can.
We've beat this dead horse a thousand times already, but there is one way I can think of to make it work in as simplistic a fashion as possible - with a Namespace2 that has an alternate bracketing mechanism. Even if a "bracket is designated as "#region" and "#endregion", the folding needs to ignore things inside of a comment, syntax block, string, etc.
Then there's also the problem I should mention of being sure the folding-start and folding-end brackets don't have characters that are also regular brackets or operators, because the existing TextPad applies a pretty simple approach to determining what type of code gets what type of color treatment. I've run into these limitations before. Like if I assign a SingleComment to a # for a Perl-esque language, there is no way for me to also have the # character be colored correctly when in another context.. such as when existing in a bare-looking string like s/#search/replace/gi, and even though perl definitely supports using that character for things like an alternate matching operand like m#regex-match-test#. To help combat occurrences of these oddities from screwing up my syntax highlighting for cgi scripts, I use a triple ### for a SingleCommentAlt. Not great, but it does basically work. Anyways, the short version of my comment here should just be that this is a very difficult problem, only complicated by things like how to even approach what code instrumentation should be matched against the fold start/end indicators.
The other final sticky point I'll mention is where to keep the data for what is and is not "folded". This data can't be in the file being edited itself, so it has to be in the workspace file. That's fine by me, but it isn't all that portable. There isn't a way around this issue unless TextPad starts spanning extra files like file.ext.folds all over the place - which sucks if you ask me, and I trust that Helios would only go with the workspace thing, just like it does for the existing bookmarks.
Personally, since I wouldn't use the feature, and since there are so many difficulties in applying a good, generic approach that will be as cross-platform [target] and multifunctional as TextPad's target end-use paradigm... I can see why it isn't in there yet.
- - -
On a more positive note:
To the person talking about bookmarking functions - use a macro. I have long used a macro that I run when I first open a file. It clears all bookmarks and then does a RegEx search and marks all lines matching something like:
^[[:space:]]*\(class\|function\|sub\|def\|type\)[[:space:]]\{1\}
I code in many languages, and this macro I use works very well for me when using any/all of my languages, including including PHP, Perl, ASP-VB, ASP-JScript, WSH, Python, and BlitzMax. There are probably specialized cases such as PHP/ASP with embedded Javascript in the HTML blocks due to the namespacing where this wouldn't necessarily work right off, but if you instrument your code properly, I think you will find it a quite successful approach... I've been doing it for many years :)
·· Z ··
- Nicholas Jordan
- Posts: 124
- Joined: Mon Dec 20, 2004 12:33 am
- Location: Central Texas ISO Latin-1
- Contact:
raw clocks
I spend 90+ % of my time trying to work around hooks that force one to use fasciclae and take up several pages and giga-clocks to do it. I usually have fifteen or twenty browser windows open just waiting on all the ( styles ) to finish their idea of what I am supposed to do, along with several instances of tp ~ then there's zip and tar and I have so much to do that I need raw clocks 80% of the time || the other 20% I need simplifications such as this.
Do not enforce it one way or the other, the left margin +/- click would be handier than a menu in a drop-down. If it is a menu, should be first order menu or tool button.
Otherwise I will be doing dishes at the local fast-food place.
Do not enforce it one way or the other, the left margin +/- click would be handier than a menu in a drop-down. If it is a menu, should be first order menu or tool button.
Otherwise I will be doing dishes at the local fast-food place.
[quote="CodeBase"]I also would like this feature, but I don't think it needs to be a feature that you can turn off in the preferences. When TextPad recognizes text can be be folded, there would be a minus (-) sign in the margin. If you don't want to fold the text, just don't click the minus and change it to a plus (+).[/quote]
That is exactly how it is implemented in Eclipse and Firefox also. My vote for it.
That is exactly how it is implemented in Eclipse and Firefox also. My vote for it.
I develop robot programs, and robots rarely have a decent IDE for their programs. Code folding would help a lot, especially when reverse engineering code written by somebody else (98% of the cases).
Please consider some languages have composite block terminators, like "END IF" so, you've got to have a way to process them as a single keyword (maybe "END%20IF" or so?).
As macouno was earlier suggesting, a list of functions could be automatically filled when opening a file, based on a language rule, eg:
procedure=PROC\ENDPROC
function=FUNC\ENDFUNC
Then from the list of functions you may navigate the code.
Please consider some languages have composite block terminators, like "END IF" so, you've got to have a way to process them as a single keyword (maybe "END%20IF" or so?).
As macouno was earlier suggesting, a list of functions could be automatically filled when opening a file, based on a language rule, eg:
procedure=PROC\ENDPROC
function=FUNC\ENDFUNC
Then from the list of functions you may navigate the code.
Code Folding
This is essential for clarity of use. I love TextPad for everything I do. I use it for web page design and coding in assorted languages. Code folding would be a great enhancement!
-
- Posts: 6
- Joined: Fri Jan 11, 2008 9:02 am
So there isnt anything new on this topic? Still no possibility to include code folding?
I really like textpad and even when I looked for alternatives I came back to it. But now I think I will try out notepad++ - basically because of that code folding thing. Auto completion would be great as well (maybe based on the syntax-highlight file of a language), but there are a few addons for that I think.
regards
I really like textpad and even when I looked for alternatives I came back to it. But now I think I will try out notepad++ - basically because of that code folding thing. Auto completion would be great as well (maybe based on the syntax-highlight file of a language), but there are a few addons for that I think.
regards
Sidebar function "menu"
I think this would be at least as useful as code folding.BKDotCom wrote:At the very least a "automatic bookmarks" side-bar option.
It would list all the function names to q quick go-to..
Currently I use the F2-bookmark thing for jumping to bookmarks I've set...
Or maybe even a sidebar that would show the first x characters or a preg-match of F2'd lines...
A menu similar to the document selector that lists all functions in the open document: clicking on the function name would jump the view to that function.
Or better yet, both: clicking on the function name both jumps to that function and toggles its folded/expanded state.
-
- Posts: 6
- Joined: Fri Jan 11, 2008 9:02 am
There is an Add-on called "FindProcs" which creates such a menu. It claims to let you see a listbox with all the occurrences of a proc, class, method. Select one and have the text cursor positioned in front of the selected one. It needs Tcl/Tk 8 installed.
I tried to install it a few weeks ago but I didnt succeed. Now while writing this post I see the hint that tcl/tk8 has to be installed, which I havent
Maybe I'll give it an other shot sometimes.
If someone succeeds in installing this addon, I would be glad if he could post a quick how-to in this thread. The readme.txt was at some points a little bit vague...
I tried to install it a few weeks ago but I didnt succeed. Now while writing this post I see the hint that tcl/tk8 has to be installed, which I havent
Maybe I'll give it an other shot sometimes.
If someone succeeds in installing this addon, I would be glad if he could post a quick how-to in this thread. The readme.txt was at some points a little bit vague...