corrosion: Cannot place breakpoint in library code (.cargo cache).
This is pretty severe:
- open any source file in a library dependency of any project, by either opening the file or
- do a ctrl+click/definition lookup from any source file in a Rust project
- or put a breakpoint in the application code, debug and keep stepping until some library source file is reached
Example path:
$HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/glutin-0.18.0/src/lib.rs
- attempt to place a breakpoint at any point in the lib file
Result:
- there is no way to place a breakpoint
Expected results:
- a breakpoint can be placed and the breakpoint is triggered by running the main project via a Debug configuration
Additional information:
- ctrl-click and hover or any LSP activity in the editor containing the open library file don’t work
Workaround:
- import the entire
.cargofolder into the Eclipse workspace as a project via File -> Open Projects From Filesystems…. Breakpoints can be then placed in any library source code in the .cargo cache.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 18 (18 by maintainers)
We can create an issue for the RLS project, but I think this is unlikely to change. My gut feeling is that this would need deep changes in the RLS implementation and its dependency projects. We could as well ask the CDT guys to make breakpoints work for non-workspace resources, which is also unlikely to be implemented.
I did some tests with multiple workspaces trying to provoke failures and it did not show any problems. So I assume we can continue with this approach, as long as no problems arise. In this case, I would not go with the workaround placing a
Cargo.tomlandsrc/lib.rsfile in this directory directly. It is one thing to place a.projectfile in there, but placing other Rust config/source files in this directory has the potential to screw up other tools.I didn’t notice any problems in my manual test, or behavior different to adding the
~/.cargodirectory directly as a project. I only did some quick tests though. Also: this seems like potential bugs looming in LSP4E. Users could use linked resources in their projects as well.I thought the lookup would prefer locations in the same project as the source of the navigation. But I realized it is not the case and I don’t understand the logic which resource gets selected if multiple workspace resources represent the same file on the file system. Eclipse even warns when creating a link that contains resources that are already part of the workspace. I guess this solution would cause many other problems. I just included it, because it seems to be the only workaround I came up with, which makes the RLS to provide useful information for library source files (populates outline view, etc.).
Thanks for the reports. So this can definitely be improved.
Path is expected to be absolute here. It seems like it’s not necessarily the case, and relative
user.homeshould be supported.I suggest we open it as an enhancement request to RLS (support for source files without a Cargo.toml parent); and see whether there is some enthusiasm there.
I don’t think it’s much of an issue. For sure, some people will complain from time to time, but it would be a very small minority of people who 1. see this file 2. get curious about it 3. dislike it 4. think it’s worth the complaint.
I think it should work. The .project files are portable and usable by multiple instances and multiple users and multiple machines.
I don’t think LSP4E currently like linked resource that much. It has in several place built on the idea that workspace parent <=> filesystem parent, which become wrong with linked folders.
What would tell us which resources to link?
Let’s keep the issue open, Mark the relationship with #172 (GitHub sucks at relationship between tickets, it’s really retarded when you’re used to good old structured bug trackers), and then once #172 is fixed, we’ll revisit this issue and decide whether this is enough to close it.
@mickaelistria Your idea of getting
.cargoimported as a “default” or “hidden” project is starting to have some weight.It does appear that Importing the
.cargofolder from File -> Open Projects From Filesystems… enables breakpoint placement.EDIT: these breakpoints are triggered as expecting in debugging sessions.
I don’t know enough to help here. I invoke @akurtakov ! Alex, can you help with this?
Nope. LSP4E only covers the editor features. Breakpoint management comes from CDT debug support. It’s possible that CDT debug support also has limitation like this, but it’s not the same bug.