-
Notifications
You must be signed in to change notification settings - Fork 3
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
Does not generate a graph output #1
Comments
Hi!
I believe you’re using it as intended. Unfortunately grift is very much unfinished. I’ve not been able to prioritize it too much recently, only just getting back into it yesterday.
The uncommented unit tests show exactly what examples are implemented, which is just properties on types and parameters to methods if I’m not mistaken, not the contents of functions yet. That said, I would have thought that your example would at least provide the names of the classes in the graph, even if they aren’t connected, but that may also be something that needs to just be implemented and tested.
If you’re at all interested, I’d be happy to look over some PRs if you have specific needs for this tool. If not that’s totally fine too!
--
Kevin Lundberg
… On Feb 4, 2018, at 6:00 AM, Jan Olbrich ***@***.***> wrote:
Hey,
I'm trying to run grift with a minimal example. I've build it from source with swift build and use the executable from .build/x86_64-apple-macosx10.10/debug/
class ClassA {
func test() {}
}
class ClassB {
func bla() {
let a = ClassA()
a.test()
}
}
Both classes are in seperate Files.
If I understand grift dependencies correct, I just have to place grift in the same directory as the files and then run it.
The output I get is:
digraph { }
What am I doing wrong here?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I'll have a look if I find some time. It might take some time though. Was curious what data you got from sourcekit and how you achieved that. Easiest way is running the tool ;) |
Ah cool :). So far I've taken the code structure info from sourcekit and searched through that for any type information I could find. It kind of works but there's some stuff missing (like function return types) that needs some sort of workaround. I suspect that the way grift does things will evolve over time in order to handle all these different cases that sourcekit itself might not be able to manage. |
Depending on the data you need maybe sourcekitten doc is more appropriate. My problem with doc is, it does not return detailed information about method substructures. So I have to stick to index at the moment. It does provide some information, but returns vars and their type in two independent objects (doc returns them in one). Just checked. In doc key.typename you could extract the return value. |
Hmm, I tried docs instead of structure and for this code: struct Thing { func foo() -> Double { return 0.0 } } I got this output (which has no [{
"<No File>" : {
"key.diagnostic_stage" : "source.diagnostic.stage.swift.parse",
"key.substructure" : [
{
"key.bodyoffset" : 14,
"key.nameoffset" : 7,
"key.accessibility" : "source.lang.swift.accessibility.internal",
"key.length" : 52,
"key.substructure" : [
{
"key.bodyoffset" : 37,
"key.nameoffset" : 20,
"key.accessibility" : "source.lang.swift.accessibility.internal",
"key.length" : 35,
"key.name" : "foo()",
"key.kind" : "source.lang.swift.decl.function.method.instance",
"key.bodylength" : 12,
"key.namelength" : 5,
"key.offset" : 15
}
],
"key.name" : "Thing",
"key.kind" : "source.lang.swift.decl.struct",
"key.bodylength" : 37,
"key.namelength" : 5,
"key.offset" : 0
}
],
"key.offset" : 0,
"key.length" : 52
}
}] I was considering exploring using syntax highlighting info combined with doc or structure somehow to get the return type, but that seems a bit brittle. I haven't tried index yet, that might prove fruitful if I can figure out how to do that through sourcekitten. |
Interesting. I get this for a small project I'm using:
But I used this command:
Maybe it resolves the files differently if you don't use projects. I'm also surprised that your methods doesn't have "key.substructure". |
Hey,
I'm trying to run grift with a minimal example. I've build it from source with
swift build
and use the executable from.build/x86_64-apple-macosx10.10/debug/
Both classes are in seperate Files.
If I understand
grift dependencies
correct, I just have to place grift in the same directory as the files and then run it.The output I get is:
What am I doing wrong here?
The text was updated successfully, but these errors were encountered: