Skip to content

Large generated lib file is unusable by development tools such as intellij-rust #116

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

Closed
nicholastmosher opened this issue Jun 12, 2017 · 7 comments

Comments

@nicholastmosher
Copy link

Due to the huge contiguous file size of the lib.rs generated output, intellij-rust (and possibly other development help tools) is unable to parse the library for intelligent completion support. I've been able to manually fix this by breaking top-level modules into their own files (you can see an example here), but this is a tedious process that involves fixing scopes by inserting new use statements manually, etc.

I think it'd be helpful if svd2rust had an option to output top-level modules (or further, perhaps every module) to individual module files for easier navigation and completion.

@Emilgardis
Copy link
Member

This was previously how svd2rust worked. It was changed (presumably) because it meant you'd have to reparse the svd for each peripheral. I think however an utility tool for splitting large .rs files into multiple files could be something to look into.

@djmcgill
Copy link

I wrote such a utility: https://crates.io/crates/form

@kjetilkjeka
Copy link
Contributor

@djmcgill the form utility is great! I just used it on s32k144 and it's great to be able to see the code in the github viewer. And also beeing able to use git diffs on an isolated part of the generated code is very usefull when verifying that the regenerated code still makes sense.

Currently in the documentation svd2rust -i STM32F30x.svd | rustfmt | tee src/lib.rs is the recommended cmd. I think it would make sense to change it to include form.

@djmcgill
Copy link

@kjetilkjeka I'm glad you like it! I would recommend holding off on making it "official" until form has reached at least 1.0, its certainly not stable yet.

@idubrov
Copy link
Contributor

idubrov commented Oct 23, 2017

@djmcgill I tried it on stm32f103xx -- works great, thanks a lot!

P.S. Just make it official, that will make it stable really fast (after you get and fix all those thousands of issues like "why does it use /Users/davidmcgillicuddy directory by default :) )!

@jonas-schievink
Copy link
Contributor

Another annoyance caused by the huge lib.rs files is that it's basically impossible to view code via rustdoc's [src] links

@burrbull
Copy link
Member

burrbull commented Nov 7, 2022

Closing due to form

@burrbull burrbull closed this as completed Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants