9
$\begingroup$

For a single project in Workbench, the "Find Definition" feature (F3, when a function name is selected) takes you to the place where the function was defined, see documentation. According to this documentation, Workbench should find your definition in any .m file in current workspace, which is not the case for me.

Even for project 'App1' which has reference to function from 'App2', the Find Definition cannot find function in 'App2' (which also shows as blue color of the function, meaning Workbench doesn't know its definition).

ADDED according to @magma: When I tried to get the definition of a function written in a different .m file, the Find Definition feature did not work. I even tried with all relevant .m files open in different tabs, to no avail.

Anybody has a clue? thanks Peter

$\endgroup$
  • $\begingroup$ Is this the same as "Find Selected Function" in the HELP menu? FindSelectedFunction doesn't work for add-on packages which is an ongoing bug and one wonders if it will ever be resolved?? $\endgroup$ – wolfies Jan 15 '14 at 16:31
  • $\begingroup$ @wolfies: I don't know, because "Find Selected Function" is in Mathematica GUI and "Find Definition" is in Wolfram Workbench. $\endgroup$ – Cendo Jan 16 '14 at 6:46
1
$\begingroup$

I have just tested this functionality and it works perfectly well within a single .m file. I tested both the F3 key and the popup menu call , as described in the user guide. All works well.

However, when I tried to get the definition of a function written in a different .m file, the Find Definition feature did not work. I even tried with all relevant .m files open in different tabs, to no avail.

So, my conclusion is that Find Definition only works in a single .m file, contrary to what is stated in the documentation.

On the bright side, the Find References functionality works as specified, even on multiple files. In fact, in my opinion, it has a better implementation than the Find Definition command, since it does not send you to a different place in the .m file, it simply creates a new search tab with all the references it found. In this way the user can decide where to go next.

I never tested these things before, since I do not like to work on the .m files directly, preferring to use the MMA front end editor with the .m file auto saved. This technique is explained in my answer here

$\endgroup$
  • $\begingroup$ did you really try F3 with function which is in a different project? For me it doesn't work even with WRI Workbench examples. $\endgroup$ – Cendo Jan 17 '14 at 10:18
  • $\begingroup$ @Cendo I rewrote my answer. You are right, it does not work as promised. $\endgroup$ – magma Jan 17 '14 at 10:50
  • $\begingroup$ Is this the same as Ctrl+Click? $\endgroup$ – Ajasja Jan 17 '14 at 10:53
  • $\begingroup$ @Ajasja : Yes it's the same according the documentation. $\endgroup$ – Cendo Jan 17 '14 at 11:41
0
$\begingroup$

Although this question is ancient, I would like to post a partial solution to the second problem (referencing symbols form other .m files inside a single application) here because this problem was really driving me up the wall at the time. I found the solution somewhere in Google but now I cannot recollect where exactly.

  1. Open the project you want to "fix".
  2. In Eclipse go to Window->Preferences window.
  3. Go to Wolfram->Special menu option.
  4. Click Delete Metadata Index... button. Confirm.
  5. Close Eclipse and open it again.
  6. Wait for a couple of seconds.
  7. Close Eclipse and open it again.

Now all symbols form the opened project should be correctly referenced (but not new ones, introduced after the metadata index was rebuilt).

It looks as if WWB has some problems with building metadata index and when forced to rebuild it, it rebuilds it more or less correctly.

Funny, but on my machine this feature sometimes starts working correctly and then breaks again. I haven't figured out what the reason is yet.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.