Sublime Forum

Function List

#1

It seems like this feature keeps popping up on the forums and elsewhere as one folks would like to see but it still doesn’t appear to be in ST2 or the beta for ST3.

A list of dropdown or otherwise-invokable functions or function sidebar or anything like that would be so very good.

Any chance it will arrive eventually?

0 Likes

#2

It sounds like you’re looking for either cmd+r or cmd+shift+p. If neither of those, then I’m not sure what you’re asking for.

0 Likes

#3

I think what he’s asking for is a way to display a list of all function names at the same time, not a way to search for them. Like in UltraEdit (or most other good code editors!) for example:
myego.cz/img/ultraedit/function-list.png

Ideally this “function list” should have the following features:

  • you could display the list sorted alphabetically or alternatively in the order in which the functions appear in the file
  • clicking on one of the function names in the function list takes you to that function in the code view (only in the view that’s currently active of course)
  • if the current cursor position in the code view is inside a function, the corresponding function name is highlighted in the function list (so you always know what function code you are currently viewing, without having to scroll around in the code to find the function declaration)

Of course this “function list” could (should) be extended to an “object list” in the long run, to show not only function names but also class names, method names and potentially even variable names.

As much as I love what I have seen from Sublime Text so far and as much as I would like to switch to it, not having access to such a feature is a complete showstopper for me. :open_mouth:

Cheers,
-Markus

0 Likes

#4

Isn’t it possible to solve this using a package?
The package can open a new buffer side by side . Read only containing the list.
It’s interactive like the Find in Files function, so a click will bring you to the function.

0 Likes

#5

[quote=“Markus Daum”]I think what he’s asking for is a way to display a list of all function names at the same time, not a way to search for them. Like in UltraEdit (or most other good code editors!) for example:
myego.cz/img/ultraedit/function-list.png[/quote]

I never found the usefulness of having a list of methods always displayed in my editor.
Take some of my editing space and unpractical to use.

Goto Symbol (ctrl(cmd)+r) display the list in apparition order, you can easily create a plugin if you want something similar in a more customized way (like sorting).

Navigate in the Goto Symbol list to preview the code, hit ENTER to go to it or ESC to return to your starting point.
Way more efficient than using the mouse to select in a function list.

When running Goto Symbol, the item located before your cursor is highlighted, so normally it’s the current method your are editing.
Hit ESC to return to your edit point.

There are so many powerful features in ST, I can imagine this feature be a showstopper for someone.

0 Likes

#6

[quote=“layne”]Isn’t it possible to solve this using a package?
The package can open a new buffer side by side . Read only containing the list.
It’s interactive like the Find in Files function, so a click will bring you to the function.[/quote]

Something like that ?
https://github.com/noraesae/ClassHierarchy

0 Likes

#7

[quote=“bizoo”]

[quote=“layne”]Isn’t it possible to solve this using a package?
The package can open a new buffer side by side . Read only containing the list.
It’s interactive like the Find in Files function, so a click will bring you to the function.[/quote]

Something like that ?
https://github.com/noraesae/ClassHierarchy[/quote]

Yes :wink:

0 Likes

#8

[quote=“bizoo”]I never found the usefulness of having a list of methods always displayed in my editor.
Take some of my editing space and unpractical to use.[/quote]

No, me neither. That’s why I prefer to have the whole thing collapsable, like in jedit for example:
expanded view:
i41.tinypic.com/mky9lz.jpg

collapsed view:
i43.tinypic.com/s1qc10.jpg

[quote=“bizoo”]When running Goto Symbol, the item located before your cursor is highlighted, so normally it’s the current method your are editing.
Hit ESC to return to your edit point.[/quote]

Nice. I like it. If anyone can figure out now how to sort this list alphabetically and maybe even expand it across the whole screen estate, I think I’m sold! :smile:

(Bad) habits you know… :blush: and having to work on a project with about 13.000 lines of code and about 250 functions in a single file (yes, I know), you think twice of leaving everything behind and diving into something new if it misses (or at least seems to miss) one of your favourite features, no matter how awesome the rest might be…

Anyway, thanks for the great answer!

0 Likes

#9

[quote=“bizoo”]

[quote=“layne”]Isn’t it possible to solve this using a package?
The package can open a new buffer side by side . Read only containing the list.
It’s interactive like the Find in Files function, so a click will bring you to the function.[/quote]

Something like that ?
https://github.com/noraesae/ClassHierarchy[/quote]

This looks very promising… would it be possible to open this not in a buffer but maybe in a transient floating window (à la “Goto Symbol”) instead somehow?

Thanks!

0 Likes

#10

I’d really like to know if there’s a way to use this and exclude functions such as lamdas. Using JavaScript ES6 I get a lot of () => functions listed which I never want to navigate.

0 Likes

#11

If you use the latest dev build (3112), anonymous functions are not included in the symbol list.

In general, there have been huge improvements in JavaScript and a bunch of other syntaxes since build 3103.

0 Likes

#12

Thank you very much - I didn’t even know about the Dev Builds. I’d been thinking about using VSCode for a bunch of little reasons, hopefully this will help keep me firmly in Sublime land :slight_smile:

0 Likes

#13

I believe it would be best not only to list the function/method names, but their signatures as well. Currently in a PHP class file, I have to search each and every method to see if their access modifiers, keywords and parameters like private, protected, public, final, static are implemented properly by other developers. For Ctrl+R (Windows), something like this in the popup drop down would suffice:

@getUser

  1. final public getUser(int $id):User
  2. final public getUsers(array $filters):array

And yes, that includes the number of methods listed…

0 Likes

#14

Just if someone still needs it:

1 Like