Function /sub routine /method list

Ideas for new features

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

User avatar
webmasta
Posts: 168
Joined: Mon Jul 28, 2003 8:16 pm
Location: Toronto

Function /sub routine /method list

Post by webmasta »

With the hoopla twirling for enhancements, I may as well add my 2+1 cent worth..

How about a Function /sub routine /method list in floating window similar to the clip library..

Last few days I had the nitemarish priviledge of working on a 4000 line perl script that best describes spagetti code, in as much as TP is my #1 editor, for this particular project I had to resort to UE specifically for the funtion list option... was not a happy camper for sure.

In TP I can do a regex and have my subs listed in the search results window, however thsi is inconvenient on the best of days as the MDI doesnt allow for pulling the results onto another screen for easy navigation..

I would like to think that TP is writen in TP with possibly about 20-30 times more lines of code... how do you guys move around in your files?? keith and stephen ??

I've been doing without it but this last project really enforced that TP absolutely needs a function list based on the syntax file.

I tried using cTags ... naaa, prefer built in TP list for all the right reasons.

How say ye Helios? anytime soon?? next major release?? Should I wait or should I "get to love UE like I love TP"
Frank Fesevur
Posts: 16
Joined: Fri Jun 13, 2003 12:46 pm
Location: The Netherlands

Post by Frank Fesevur »

I know it is not exactly what you want (it is an add-on), but for the time being look at http://findtag.sourceforge.net.

Regards,
Frank
User avatar
webmasta
Posts: 168
Joined: Mon Jul 28, 2003 8:16 pm
Location: Toronto

Post by webmasta »

Thnx Frank .. I used the ctags but its not even close to a viable alternative to having the built in function list ... took me forever to figure it out and up to now I am still not sure I have it under control.. very confusing even for a seasoned programmer... and proper integration documentation is virtually non existtent.

TP really needs a function list.. I had a poll on my post above but somehow it disappeared from the time I posted it last nite to this morning, which leads me to suspect that helios edited my post and deleted the poll.. which they should have the decency to indicate.

If it was not edited by helios, then I apologise for jumping to the wrong conclusion... but if it was, then I have the sneaky feeling that a function list is nowhere in the future of TP, which will make it the editor on the back burner (at least for me)
User avatar
CodeBase
Posts: 30
Joined: Thu Jun 26, 2003 7:18 pm
Location: Edmonton, AB

Post by CodeBase »

This is a very good idea. But TextPad is a very general purpose text editor. It might be tricky to come up with a method to define what is a "function" in a given language.
User avatar
webmasta
Posts: 168
Joined: Mon Jul 28, 2003 8:16 pm
Location: Toronto

Post by webmasta »

The function will be grabbed using regex as defined in the syntax file

simple eg for perl = ^sub
simple eg for javascript = ^function

Its a tad more complicated than this but definetly can be done easily.

As to general purpose, could be wrong but I think TP is used more for programming than anything else ..its a programmer's editor first and everything else after... maybe because I program ...
Frank Fesevur
Posts: 16
Joined: Fri Jun 13, 2003 12:46 pm
Location: The Netherlands

Post by Frank Fesevur »

CodeBase wrote:It might be tricky to come up with a method to define what is a "function" in a given language.
It is not so diffucult, when you use ctags. This can recognize many different laguages. See my previous post, download the tool and see for yourself.

Regards,
Frank
eherzel
Posts: 1
Joined: Fri Sep 05, 2003 2:08 pm

Post by eherzel »

a better way is to define some keywords for this, e.g. for TCL I will see all procs, namespaces, classes and the methods inside the classes, so the keywords are 'proc namespace class method' and the view in the function list should be a tree, eg:

Code: Select all

|- proc Test
|- namespace Test1
|  |- proc huhu
|  |- proc soso
|- class view
   |- constructor
   |- destructor
   |- method test1
   |- method test2
Enrico
User avatar
webmasta
Posts: 168
Joined: Mon Jul 28, 2003 8:16 pm
Location: Toronto

Post by webmasta »

Keeping it alive .... :wink:
User avatar
webmasta
Posts: 168
Joined: Mon Jul 28, 2003 8:16 pm
Location: Toronto

How say ye?

Post by webmasta »

After three years less two weeks, how say ye? :o ?
mattrix
Posts: 7
Joined: Sun Aug 19, 2007 8:43 pm

Not sure how this'd work...

Post by mattrix »

I too would appreciate something like what they're asking for...
Trogdor
Posts: 3
Joined: Mon Jan 07, 2008 10:08 pm

Post by Trogdor »

I've used TextPad since 2002, it's my favorite development environment. This would be a VERY useful addition to TextPad, as it would make my life much easier, allowing me to get more done.

As to the argument that not all TextPad users are programmers, I submit this: I haven't done Java programming 10+ years, but there's Java compiling options built-in to TextPad.

Therefore, it's not too much to ask for a feature that's not useful to the entire user base; moreover, this proves that TextPad already has such features.

A friend of mine who (unlike me) does development on an Apple suggested another (Apple) editor which has this functionality built-in, inspiring me to look into whether TextPad might add this feature in the future.

Would it be going too far for me to offer this kind of deal?
Add this feature to TextPad, and I'll stop evaluating, become honest, and be a paying user of the software :wink:
Trogdor
Posts: 3
Joined: Mon Jan 07, 2008 10:08 pm

Post by Trogdor »

Interesting. A look at the Code Folding topic shows that there are even more people interested having a good list of functions / subroutines, combined with the ability to jump to them. So it's not just the few who've kept this thread alive for 5 years ... good to know.
qkz73
Posts: 33
Joined: Thu Jul 22, 2004 9:15 pm

markers macro regex

Post by qkz73 »

I'm going to be lame and repost something from the Code Folding thread - especially since you brought it up. The "outlining" abilities are commonly mentioned but extremely difficult to implement.

Just use a macro for your functions. 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 what I have used for many years (~10)...

^[[:space:]]*\(class\|function\|sub\|def\|type\)[[:space:]]\{1\}

This 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 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...

Of course, an extra "project" window with all of your classes and functions broken down would be nice. But how exactly can we expect TextPad to approach this in the general case?

I've been a PAYING user for a very long time, and I've gotten along just fine on many very large projects. Several of my old cgi scripts (perl) that are still in service and need occasional modifications are are well into several thousand lines. This feature is by no means a "must" for me. If I want my code easier to navigate, then I believe modularization is the better answer.
- QKZ -
qkz73
Posts: 33
Joined: Thu Jul 22, 2004 9:15 pm

more positive

Post by qkz73 »

As far as implementation if this were to be done, here's an idea. Bear with me.

1) Have more than one "type" of bookmark. And have a dockable treeview window summarizing your bookmarks.

2) For example, there could be 3 types. Hitting the bookmark key (like F2) more than once will cycle through the different levels. Each bookmark could have a configurable color for the little flag in the UI so that it is obvious via the sidebar what type of bookmark is in place. As a default, varying levels of gray could be used.

3) Have a docking window (treeview) that is a bookmark summary. Possibly, this could be an option that merges with the document selector.

4) Upon a file/open, there could be an auto-bookmarking regex macro that is run and sets the various types of bookmarks. This would be associated with the Document Class for the file type, and thusly customizeable for each type of language.

Hopefully that is more constructive / workable. I didn't initially mean to sound quite so critical. I really don't think there is any kind of consensus on the outlining feature, though. Still, it would be interesting as an option. And this class/method breakdown listing would also be a nice optional addition.

·· Z ··
Trogdor
Posts: 3
Joined: Mon Jan 07, 2008 10:08 pm

Post by Trogdor »

I admit, the macro idea sounds good.

My only trepidation is, what happens when I wish to use bookmarks for something else? I 'spose it's easy enough to clear-all-bookmarks first, and then run the macro again when done.

Also, there's the added hassle of actually running the macro every time I open a script, but frankly I don't think this is an issue. I do lots of things out of habit that others think are hassle; once this becomes a habit, it shouldn't be a problem.

That said, I think QKZ's outline of the implementation is sound. Different types of bookmarks, an outline/treeview window that can be docked, generated by a regex macro that runs on file/open based on the Document Class for the file type.

My only additional request would be the double-click-to-jump-there ability.
Post Reply