GumTreeDiff / gumtree

An awesome code differencing tool
https://github.com/GumTreeDiff/gumtree/wiki
GNU Lesser General Public License v3.0
933 stars 174 forks source link

C parser configure in IdeaJ #262

Closed SherloqueChang closed 2 years ago

SherloqueChang commented 2 years ago

Hi, I'd like to use GumTree to obtain C file diff information by invoking Java API in IdeaJ. However, I had no idea how to configure C parser and I got the error message "No generator found".

jrfaller commented 2 years ago

Hi!

You have to install either cgum or tree-sitter-parser, look in the dedicated repos : https://github.com/GumTreeDiff/

SherloqueChang commented 2 years ago

Hi, I chose to install tree-sitter-parser. But when I followed README of https://github.com/GumTreeDiff/tree-sitter-parser and used command pip3 install tree_sitter to install tree-sitter Python's bindings, an error occured: Could not build wheels for tree_sitter, which is required to install pyproject.toml-based projects. I couldn't find a way to solve this problem. Is there any advice?

jrfaller commented 2 years ago

It would be better to discuss this issue on the tree-sitter-parser repository. Look here for more documentation on tree-sitter's python bindings : https://github.com/tree-sitter/py-tree-sitter

jrfaller commented 2 years ago

Hi!

Did you manage to get the tree sitter backend installed?

BTW, the tree sitter backend is installed on our Docker image if you want to try with less problems

SherloqueChang commented 2 years ago

Hi! Now I've successfully installed tree_sitter using tar.gz file, but I'm not sure if it can be used in a Java project.

My task is to parse/diff C code files using Java language, so I need to invoke Java API of GumTree in Windows OS, where I couldn't build cgum, and tree_sitter seems only work with python...

So is there any way to solve this problem? Thanks for your comment.

jrfaller commented 2 years ago

To have tree sitter with gumtree, you really need to have it installed using pip because we are using the Python bindings.

I think maybe you should use the Docker image?

SherloqueChang commented 2 years ago

I opened another issue ealier on https://github.com/GumTreeDiff/tree-sitter-parser/issues/2, where I hope to use Java code to get C edit actions. In this case, can Docker image or Python bindings tree_sitter meet my need? I'm confused right now...

jrfaller commented 2 years ago

Hooo sorry I didn't see! I reply to you there!

SherloqueChang commented 2 years ago

Thanks again