chanhx / crabviz Goto Github PK
View Code? Open in Web Editor NEW🦀 A LSP-based interative call graph generator
License: Apache License 2.0
🦀 A LSP-based interative call graph generator
License: Apache License 2.0
Thanks for the utility!
I want to export the crabviz page entirely as html (including the click functionality) as well as reference the links to the code in an online browser. Can you please consider this feature request?
Error loading webview: Error: Could not register service worker: InvalidStateError: Failed to register a ServiceWorker: The document is in an invalid state..
Not sure what else I can provide here. I was trying to generate a call graph in the vs code extension
对项目很感兴趣,可否一起开发
In a project at work, the call graph probably has several thousand items (we have et least 800 elixir modules).
When initially created the graph is just a thin vertical line, after maximally zooming in, it is a bold vertical line created from blocks, that seem to have labels. It is still not quite usable.
I have not yet been able to try this on smaller projects or comperably large projects in another language.
source file: tokio/src/runtime/runtime.rs
expected result: function new will be in the generated graph
Actual result: function new is missing
Looks amazing! But, Does this work with Python3? I get "no matching workspace symbols" errors. I think these were due to my init.py files which I deleted. However, no image is opening in vscode. Any ideas on how to get it working? Would be much appreciated :)
Is there a capability to do multi-select call flows? After generating the graph, the idea is to make some call flows stand out by making them brighter and the others less visible by clicking on just the flows that the user is interested in. It would be great to see this.
C++, clangd, and when i clicked generate call graph
, nothing happened.
impl<'w, 's, Q: WorldQuery, F: ReadOnlyWorldQuery> QueryIterationCursor<'w, 's, Q, F> {
fetch: Q::clone_fetch(&self.fetch), //<<<
filter: F::clone_fetch(&self.filter),//<<<
Cannot find a directed edge from some function to clone_fetch.
Cool use of the LSP! It would be much more useful to me if it was possible to display in a tree (-like) layout instead of blocks for each file.
Dear extension author,
Please publish this extension to the Open VSX marketplace.
Unfortunately, as Microsoft prohibits usages of the Microsoft marketplace by any other products or redistribution of .vsix
files from it, in order to use VS Code extensions in non-Microsoft products, we kindly ask that you take ownership of the VS Code extension namespace in Open VSX and publish this extension on Open VSX.
Open VSX is a vendor neutral alternative to the MS marketplace used by most other derivatives of VS Code like VSCodium, Gitpod, OpenVSCode, Theia-based IDEs, and so on.
You can read on about Open VSX at the Eclipse Foundation's Open VSX FAQ.
The docs to publish an extension can be found here. This process is straightforward and shouldn't take too long. Essentially, you need an authentication token and to execute the ovsx publish
command to publish your extension. There's also a doc explaining the whole process with an example GitHub Action workflow.
First of all, lovely extension! Super powerful, and already useful for me on smaller projects.
Would love to be able to filter files and objects by name. E.g. I select a folder and generate the call graph from that folder, but would like to filter out all test files.
I'm trying to run CrabViz, and I'm not getting a visualization. I do the following:
And nothing happens. CrabViz does briefly pop up with "loading languages" but that's about it.
I'm happy to debug, but not sure about how to do so. Are there instructions on how to do so?
I'm using VSCode with the SSH plugin, if that changes anything.
After exporting call graph, can we preview again with crabviz extension? Because other svg extensions i tried are not interactable.
When I click on an item, it becomes relevant only to that item.
But if I click on a blank space (or scroll the canvas), it becomes all relevant.
Here are some ideas:
当我点击一项时,它变为只会这一项有关.
但如果我点空白的地方(或者拉动画布),就会变为全部相关.
我有一些想法:
这可能是#9的一个复制
I want to show graphviz about cranelift, but found error as follow.
I don't know exactly why. Can you take a look for me?
2023-12-28 22:52:16.484 [error] Error: command failed with error code 2: error parsing glob '!/{**/*.css,**/*.csv,**/*.gif,**/*.gitignore,**/*.html,**/*.md,**/*.jpeg,**/*.jpg,**/*.json,**/*.lex,**/*.lock,**/*.log,**/*.png,**/*.toml,**/*.txt,**/*.xml,**/*.yaml,**/*.yacc,**/*.yml,fuzz/artifacts,fuzz/corpus,benches/wasi/test.bin,benches/instantiation/wasi.wasm,*.bk,*.pyc,*.swo,*.swp,*.swx,*~,.*.rustfmt,.mypy_cache,/#*/#,cranelift.dbg*,docs/_build,docs/book,.vscode/,.vs/,rusty-tags.*,tags,target,.z3-trace,foo,.cargo,publish,vendor,examples/build,examples/.cache,*.coredump,docs/assemblyscript-hello-world/node_modules/,docs/assemblyscript-hello-world/package-lock.json,docs/assemblyscript-hello-world/*.lock,docs/assemblyscript-hello-world/*.{wat,wasm},docs/assemblyscript_demo/node_modules/,docs/assemblyscript_demo/package-lock.json,docs/assemblyscript_demo/*.lock,docs/assemblyscript_demo/*.{wat,wasm},crates/wasi-common/WASI/*.bk,crates/wasi-common/WASI/*.swp,crates/wasi-common/WASI/*.swo,crates/wasi-common/WASI/*.swx,crates/wasi-common/WASI/tags,crates/wasi-common/WASI/target,crates/wasi-common/WASI/Cargo.lock,crates/wasi-common/WASI/.*.rustfmt,crates/wasi-common/WASI/rusty-tags.*,crates/wasi-common/WASI/*~,crates/wasi-common/WASI//#*/#,crates/wasi-common/WASI/tools/witx/target,crates/wasi-common/WASI/tools/witx/Cargo.lock,crates/c-api/html,crates/c-api/wasm-c-api/out,crates/c-api/wasm-c-api/v8,crates/environ/target/,crates/environ/**/*.rs.bk,crates/environ/Cargo.lock,crates/environ/fuzz/corpus,crates/environ/fuzz/artifacts,crates/bench-api/stdout.log,crates/bench-api/stderr.log,crates/fuzzing/wasm-spec-interpreter/ocaml/_build,crates/fuzzing/wasm-spec-interpreter/ocaml/spec,cranelift/isle/target,cranelift/isle/*~,cranelift/isle/.*.swp,cranelift/isle/fuzz/target,cranelift/isle/fuzz/corpus,cranelift/isle/fuzz/artifacts,cranelift/docs/_build,tests/wasi_testsuite/wasi-common/tests/rust/target/,tests/wasi_testsuite/wasi-common/tests/assemblyscript/node_modules/,tests/spec_testsuite/commit_message,tests/spec_testsuite/repos/,tests/wasi_testsuite/wasi-threads/test/testsuite/*.wasm,tests/wasi_testsuite/wasi-common/*.wasm,tests/wasi_testsuite/wasi-common/.DS_Store,tests/wasi_testsuite/wasi-common/test-runner/__pycache__/,tests/wasi_testsuite/wasi-common/test-runner/.coverage,tests/wasi_testsuite/wasi-common/tests/c/testsuite/fs-tests.dir/writeable/*,tests/wasi_testsuite/wasi-common/tests/c/testsuite/fs-tests.dir/writeable/!.gitignore}': nested alternate groups are not allowed
at T (vscode-file://vscode-app/Users/huangzheng/Desktop/Visual%20Studio%20Code%202.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:1861:5893)
at vscode-file://vscode-app/Users/huangzheng/Desktop/Visual%20Studio%20Code%202.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:1869:4355
at async vscode-file://vscode-app/Users/huangzheng/Desktop/Visual%20Studio%20Code%202.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:1869:2925 crabviz.generateCallGraph {"value":"chanhx.crabviz","_lower":"chanhx.crabviz"}
Neat extension, I went to test it on some stuff I had lying around and noticed that it didn't identify functions that were called as routes for Actix. I have a repo that I was using while working through Zero to Production in Rust that I used to test.
I found that when looking at the graph for the entire src
folder, it shows that my functions for routes are never called:
When checking the call hierarchy in VS Code, it correctly shows that this health_check
function is called by run
, which is called by spawn_app
and main
:
Source is here for reference: https://github.com/Torsitano/zero-to-rust/blob/main/src/routes/health_check.rs
这插件简直梦中情插,只不过我之前用的是source insight,一直想要找一个类似下面这个repo 中的 visual studio 插件的效果:
https://github.com/league1991/CodeAtlasVsix
就那种点哪儿就跳哪儿那种。
当然,单纯用 call hierarchy 也行,可是就想看图。。只恨我自己太菜,啥rust啥都不懂,球球了,大佬让我白嫖下吧(狗头保命)
My project is designed with unity build methodology, meaning that everything gets compiled from a single source file. This seems to break crabviz. Example from "Extension Host" log when I try to parse my project folder:
2024-03-01 18:38:52.317 [error] Error: [UriError]: Scheme contains illegal characters.
at v (d:\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:96:31508)
at new k (d:\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:96:32708)
at w (d:\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:96:34346)
at k.parse (d:\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:96:33200)
at e.FileClassifier.classifyFilesInDirectory (c:\Users\conra\.vscode\extensions\chanhx.crabviz-0.3.2\dist\extension.js:1:107033)
at async e.FileClassifier.classifyFilesByLanguage (c:\Users\conra\.vscode\extensions\chanhx.crabviz-0.3.2\dist\extension.js:1:106556) crabviz.generateCallGraph {"value":"chanhx.crabviz","_lower":"chanhx.crabviz"}
My compile_commands.json:
[
{ "directory": "W:\\hi\\build", "file": "..\\code\\game\\game_main.cpp", "output": "C:\\Users\\conra\\AppData\\Local\\Temp\\game_main-11638f.o", "arguments": ["C:\\Program Files\\LLVM\\bin\\clang++.exe", "-xc++", "..\\code\\game\\game_main.cpp", "-o", "C:\\Users\\conra\\AppData\\Local\\Temp\\game_main-11638f.o", "--driver-mode=g++", "-g", "-O0", "-I", "..\\code\\", "-I", "..\\code\\3rdparty", "-std=c++20", "-D", "WIN32", "-D", "_WINDOWS", "-D", "_HAS_EXCEPTIONS=0", "-D", "_CRT_SECURE_NO_WARNING", "-fno-exceptions", "-fno-rtti", "-ferror-limit=0", "-Wall", "-Wextra", "-Werror", "-Wno-format", "-Wno-pragma-once-outside-header", "-Wno-gcc-compat", "-Wno-missing-field-initializers", "-Wno-missing-braces", "-Wno-unused-function", "-fsanitize=undefined", "-fno-omit-frame-pointer", "-fuse-ld=lld-link", "-Wl,/MANIFEST:EMBED,/INCREMENTAL:NO,C:\\Program Files\\LLVM\\lib\\clang\\18\\lib\\windows\\clang_rt.ubsan_standalone-x86_64.lib,C:\\Program Files\\LLVM\\lib\\clang\\18\\lib\\windows\\clang_rt.ubsan_standalone_cxx-x86_64.lib", "-dumpdir", "game.exe-", "--target=x86_64-pc-windows-msvc19.38.33134"]}
]
And here's the project: Project. Simply try to parase the code/
directory to reproduce.
there is a panic while generating a call graph:
Panic context:
>
version: 0.3.1631-standalone (83b3ba1b8 2023-08-19)
request: callHierarchy/outgoingCalls CallHierarchyOutgoingCallsParams {
item: CallHierarchyItem {
name: "output_record_batch_and_reset",
kind: Function,
tags: None,
detail: Some(
"fn output_record_batch_and_reset(&mut self) -> Result<RecordBatch>",
),
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "/Users/r4ntix/Workspace/github/arrow-datafusion/datafusion/core/src/physical_plan/joins/sort_merge_join.rs",
query: None,
fragment: None,
},
range: Range {
start: Position {
line: 1242,
character: 4,
},
end: Position {
line: 1249,
character: 5,
},
},
selection_range: Range {
start: Position {
line: 1242,
character: 7,
},
end: Position {
line: 1242,
character: 36,
},
},
data: None,
},
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
partial_result_params: PartialResultParams {
partial_result_token: None,
},
}
thread 'Worker' panicked at 'invalid offset', /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/line-index-0.1.0-pre.1/src/lib.rs:148:35
stack backtrace:
0: _rust_begin_unwind
1: core::panicking::panic_fmt
2: core::option::expect_failed
3: rust_analyzer::to_proto::range
4: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
5: alloc::vec::in_place_collect::<impl alloc::vec::spec_from_iter::SpecFromIter<T,I> for alloc::vec::Vec<T>>::from_iter
6: rust_analyzer::handlers::request::handle_call_hierarchy_outgoing
7: core::ops::function::FnOnce::call_once{{vtable.shim}}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 17:33:17] Request callHierarchy/outgoingCalls failed.
Message: request handler panicked: invalid offset
Code: -32603
Hey,
First of all thanks for making this awesome tool!
I remember visiting this tool a year of two ago and being blown away by what was already achieved.
It was still a little too clunky to get good use out of and when I came back and saw how far this has come I'm truly impressed.
[Suggestion]
It would be cool if we could configure a "call depth" for the selected function graph.
Currently when selecting a node you can only see the direct predecessors and successors.
It would be neet if we could configure this depth independently for each type (predecessor / successor).
How I imagine this could be implemented.
There seems to be some kind of mechanism to lookup the two corresponding nodes by type when selecting an item.
If we could repeat this selection n items we should have a path of depth n.
This is probably way harder than it looks though I thought it would be a worthwhile mention.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.