Discussion › Forums › discussion › How does “Go to Definition” work?
This topic contains 0 voices and has 11 replies.
| Author | Posts |
|---|---|
| Author | Posts |
| November 24, 2008 at 8:52 pm #497 | |
|
cameos Member
|
Hi, I am new to PN, I notice that when I right click on C doc, there is “Go to Definition” in pop-up menu, but when I choose it, it seems that it does not do anything (at least appears to be so), I’d like to know how does it work? (I thought it would’ve worked like in MS Visual Studio, i.e., jumped to definition of function/variable) |
| November 25, 2008 at 3:19 pm #16142 | |
|
simon Key Master
|
Go To Definition currently only works within your current document. It relies on the tags implementation so if you can see the definition in the tags for the current file then Go To Definition will work. In the future I’ll probably support multi-file or project-based tags and then this will allow go to definition to be more useful. |
| November 26, 2008 at 7:00 am #16143 | |
|
cameos Member
|
Thanks! |
| November 2, 2009 at 3:43 am #16144 | |
|
CoDEmanX Member
|
multi-file support would be awesome! beside this, is it possible to make ctags recognize function calls like ::my_func(); ? i’d like to see the Go to Definition feature work for these. such calls can occur in c-like languages which support OOP, e.g. PHP //edit: never mind, it already works as long as the function is defined in the same file. I obviously tested it with a function declared in another file. |
| November 2, 2009 at 2:19 pm #16145 | |
|
Nux Member
|
You can try this: http://pnotepad.org/docs/howto/tag_custom_languages E.g. to catch something like this (for JavaScript): window.my_function = function() {…} I use: –langdef=javascript –langmap=javascript:.js –regex-javascript=/(^|[ t])([A-Za-z0-9_.]+)[ t]*=[ t]*function[ t]*(/2/f,Function/ I’m not sure if there is a way to add this all c-like languages or if you would have to add it for all of them. |
| November 26, 2009 at 3:19 pm #16146 | |
|
seulater Member
|
Just having tried it again after some years PN has come a LONG way (Great Job). The only thing that i can see at the moment that would be very useful is to get this “Go To Definition” working. The way i see it, whatever files i have in my Source File list that contain the Go To Definition word look up should be able to take me to that line and if that file is not open, it should open it and take me there. Nowadays, with code getting so large this feature is in high demand. |
| November 26, 2009 at 4:19 pm #16147 | |
|
simon Key Master
|
Yes, this is often requested and I do intend to work on it. Currently Go To Definition works only within your current file (and possibly in other open files, I don’t remember). |
| November 26, 2009 at 9:43 pm #16148 | |
|
seulater Member
|
>and possibly in other open files, I don’t remember ya, it does not do this, which is why when i have 8-17 C files in my project, it would be a AWESOME feature to have. after writing so much code one does forget where that function call went to |
| September 16, 2011 at 2:14 pm #16149 | |
|
Wellington Member
|
In fact, the function “Goto Definition” works half of the way: it puts the cursor in the function definition at the respective file, but it does not go to the file. If you know in which file the function is, you can see that. It seems that a little adjustment is needed. |
| September 19, 2011 at 8:01 am #16150 | |
|
CoDEmanX Member
|
Amazing, so it’s actually working across files, nonetheless based on the function name only: If I have two files opened with the same function declaration (e.g. “main”), Go to definition shows a auto-complete list (2x main) and no matter what I pick, it will put the cursor to the declaration of the former opened/created file. |
| October 8, 2011 at 10:24 pm #16152 | |
|
castorp Member
|
For me, the current file is not changed. After selecting the desired method from the popup I stay in the current fild. When I manually switch to the file containting the method I can see that the correct method is indeed selected. |
| October 11, 2011 at 11:23 am #16153 | |
|
CoDEmanX Member
|
I refered to Wellington’s post (“it puts the cursor in the function definition at the respective file, but it does not go to the file”), it does not change the tab for me either, but it sets the cursor. |
You must be logged in to reply to this topic.