6 ms·
Random thought: Every IDE I've used gives me the folder structure of the project on the left as a standard directory tree. Does any support navigating a project
by patrickthebold 3y ago
Random thought: Every IDE I've used gives me the folder structure of the project on the left as a standard directory tree. Does any support navigating a project as a graph of dependencies?
- abid786 3y agoWhat would that practically look like? How would circular dependencies be resolved, for example?
- nateabele 3y agoTwo nodes, and either two edges with one arrow each, or one edge with two arrows. ¯\_(ツ)_/¯
- karmakaze 3y agoThe two usual ways I've seen it is either by following the code/control-flow (calls or inverted as called by) or by following the data flow. You can select any code function and see the call (or called) graph (shown as a tree), similarly for any data element and see the data elements that use (or is used by) graph and pruning cycles.
- o11c 3y agoAs far as I'm concerned, if you have circular dependencies between directories, you're doing something wrong (see also my top-level comment). If you're sane and have a DAG of directories, you can just toposort.
- ranguna 3y agoIn rust I have a file that defines a struct and its implementations, then I have another file that has a static array of elements of that struct. But in the struct file, one of the implementations is a TryFrom<usize>, (which is ran when you have a variable of type usize and "cast" it into my struct) this TryFrom implementation returns the value of the nth element of the static array in the second file. I don't see anything wrong in having this circular dependancy. Potentially I could extract the TryFrom implementation into a 3rd file, breaking the circle, but tbh that feels like I'm doing that just for the sake for doing that, and it offers no real benefit. In this case I see a benefit in keeping the struct and its implementation in a file, and another file with a static variable (which btw is around 600 lines, yeah it's a big array) in a separate file. Don't follow rules blindly and try not to have absolute rules in your life, it'll make things simpler and more flexible.
- o11c 3y agoCircular dependencies between files are fine, subject to language limitations. Circular dependencies between directories are what's usually an indicator of something wrong.
- ccorcos 3y agoI have the exact same thought. What would it look like? I have two ideas. 1. Multiple directory trees that use symlinks to organize files orthogonally. Your typical directory structure may have things split by client / server. But what if I want to split things based on feature? An IDE could make this a lot easier. 2. Along the lines of this post, I’d love if an IDE would make it easier to create bookmarks and navigate between them to walk people through the code. I’d love to leave a comment sometimes that I can click to jump me to another location in the codebase. Stringing these together leads allows you to weave a narrative throughout the codebase to explain how things work! Is anyone working in these kinds of things??
- euroderf 3y agoMaybe you want a multitree.
- euroderf 3y agoSee for example https://adrenaline.ucsd.edu/kirsh/Articles/In_Process/MultiTrees.pdf https://adrenaline.ucsd.edu/kirsh/Articles/In_Process/MultiT...
- syndicatedjelly 3y agoNot quite an answer to your question, but I think what you’re getting at is, “I want a better way to visualize the file structure.” I agree, the table of contents style is not well-suited. As part of my coding workflow, I recently started opening a terminal and running ranger inside it, and just tabbing over to that terminal to navigate the left-to-right directory structure. So have VSCode open, and open a split terminal window with the regular terminal at top, and Ranger running in the bottom pane. Midnight Commander would work as well - any TUI file explorer really. I also have started including a “code map” in the architecture.md files of my projects. You can get a nice output by running `tree -L <levels>`, to load a markdown-embeddable tree diagram of the file structure, however many <levels> deep. I add the output to my markdown, and add a comment after each file/folder explaining what it’s for (in less than 10 words each) Ranger - https://github.com/ranger/ranger https://github.com/ranger/ranger Midnight Commander - https://midnight-commander.org/ https://midnight-commander.org/