Code Explorer
-
Hi,
in the last years I used PsPad. This editor has a lot of nice features but it misses one: the code folding. For this reason I was trying to use Notepad++.
I found in Notepad++ almost all features I use in PsPad but I miss one: the Code Explorer.
The Code Explorer basically parses of my Perl code and shows, in a separate box, the list of the subroutines. When I am on a line of my code in the edit window, I can click on a button in the Code Explorer Box and it tells me in what function I am. This is very useful when I have several thousands lines functions: I do a search of the code I need to change and then I verify if I am in the right function.
Is there in Notepad++ a similar functionality?
Thanks
Massimo
Reno, NV, USA -
A function list panel exist.
It should helps you. -
Oh, yes, I found it, but is there a way to see in what function I currently am?
I was able only to see the list of the functions it does not tell me in what function the line I am working on, is. -
Am I wrong or this function list does not work for javascript files?
-
@Massimo-Balestra
FunctionList does not highlight the current function based on the cursor position (see also #715).
An update of the JavaScript parser is on the ToDo-list. -
So what you want is a visual representation of context/scope. Such a feature wouldn’t be limited to functions, but would include them.
That would be like… a text minimap?
The minimap shows different lines to account for nesting
|----------------------|
list = {
list.code=(etc)
|----------------------|It basically tells you the what your cursor is in the middle of.
-
This sounds complicated. What I would need is: I have a 2000 lines function, I have a ticket when they ask me to change something, I search for what I have to change, I put my cursor in that line, and the “function list” tells me in what function I am, In this way I can verify, searching where this function is called, what other sections of my software are involved in the fix I am doing. If the function is 10 lines long it is not a problem, if it is few thousand lines this can be a big help.
-
Given that the functionality you want doesn’t currently exist, we have to go looking for other options…
Here’s what I might do in the same situation:
-
Write a regular expression that matches subroutine declaration lines (for Perl this might be something like ^\h*sub\h+ ). Tweak that regular expression to match your situation (I’m no longer a Perl expert!).
-
Run a Mark search using that regular expression with the Bookmark and Wrap options enabled – this will bookmark all lines in your file that are subroutine definition lines.
-
Go to your “line of interest”…look around it…hang out there…have fun…(maybe even set a manual bookmark there)…and when you’re ready, use the find-previous-bookmark functionality to see what subroutine you’re currently in (if you set the manual bookmark you can easily move back to your line-of-interest using the find-next-bookmark capability).
You can create a macro for 1 and 2 so that you have to do that stuff one time only.
It’s actually not so bad of a workaround–try it. :-)
-
-
Thank you Scott.
I think I will use one of your suggestions or something similar.
Or I will still use PsPad when I need this functionality. -
@Massimo-Balestra,
You could use SourceCookifier or TagsView plugin (search those in the Plugin Manager).
BR