Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source Lookup fails for .clj files #81

Closed
laurentpetit opened this issue Mar 15, 2015 · 7 comments
Closed

Source Lookup fails for .clj files #81

laurentpetit opened this issue Mar 15, 2015 · 7 comments

Comments

@laurentpetit
Copy link
Member

Original issue 40 created by laurentpetit on 2009-11-29T18:10:07.000Z:

What steps will reproduce the problem?

  1. Create a new Clojure project with a new .clj file.
  2. Write a simple function call (eg (println "Hello"))
  3. Set a breakpoint on the function call
  4. Run the program in debug mode

What is the expected output? What do you see instead?
Normally we should expect Debug perspective to be activated and the line
with the breakpoint to be highlighted. However, instead we get a view
showing "Source not found."

What version of the product are you using? On what operating system?
This is on v 0.0.42 on Windows.

Please provide any additional information below.
While debugging the plugin, I've been able to track down the cause of the
problem. That is that the getSourceName method in the
ClojureSourceLookupParticipant class returns an absolute path when it
should return a relative path. This only happens when debugging .clj files.
If I modify the value returned by the getSourceName method, to a relative
path, the source file is found and everything appears normal.

@laurentpetit
Copy link
Member Author

Comment #1 originally posted by laurentpetit on 2009-12-01T22:57:08.000Z:

Adding example project though the problem occurs with every .clj file that is not
part of a jar, for any kind of Clojure project.

If I replace the getSourceName method in the ClojureSoureLookupParticipant class with:

public String getSourceName(Object object) throws CoreException {
    return "test.clj";
}

then it works fine so clearly there is something wrong with the method as it is.

@laurentpetit
Copy link
Member Author

Comment #2 originally posted by laurentpetit on 2009-12-03T20:52:57.000Z:

<empty>

@laurentpetit
Copy link
Member Author

Comment #3 originally posted by laurentpetit on 2009-12-03T21:14:17.000Z:

OK, I think I've narrowed down the bug even more.
It's only happening when one starts a REPL from a specific file.
It's not happening when one starts a REPL from the project's root, and then requires
the ns manually and calls the function.

So that's certainly because of the way the file has been passed by the launcher ...
via absolute filename rather than classpath relative ..

@laurentpetit
Copy link
Member Author

Comment #4 originally posted by laurentpetit on 2009-12-03T22:08:40.000Z:

ok, no time to correct right now, so here is a (semi :-)private memento for
correcting it later:

  • class ClojureElementViewer, method select(Viewer viewer, Object parentElement,
    Object element) for seeing how to say a file is a clojure file in the classpath of
    the project, and also to extract the classpath-relative part of it
  • modify somewhere near LaunchUtils .setFilesToLaunch / getFilestoLaunch to have
    classpath relative files ( ! 2 ways to initialise files to launch : from direct
    selection and launch shortcut, or launch configuration)
  • modify the way files are launched when selected : prepend @/ to them

@laurentpetit
Copy link
Member Author

Comment #5 originally posted by laurentpetit on 2009-12-07T21:12:09.000Z:

<empty>

@laurentpetit
Copy link
Member Author

Comment #6 originally posted by laurentpetit on 2009-12-07T22:23:35.000Z:

Tested the fix on the latest branch and it appears to work fine. Good job Laurent! :)

@laurentpetit
Copy link
Member Author

Comment #7 originally posted by laurentpetit on 2009-12-30T21:58:08.000Z:

<empty>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant