prati0100 / git-gui

Tcl/Tk based UI for Git. I am currently acting as the project's maintainer.
161 stars 87 forks source link

Autocompletion in commit messages #20

Open johnjohndoe opened 4 years ago

johnjohndoe commented 4 years ago

Recently, IntelliJ introduced autocompletion in commit messages for code references. It would be nice to have this in git-gui, too.

bertwesarg commented 4 years ago

I consider Git GUI not a programming GUI.

bertwesarg commented 4 years ago

I consider Git GUI not a programming GUI.

Correction:

I consider Git GUI not a programming IDE.

prati0100 commented 4 years ago

I agree with Bert.

The kind of autocompletion you linked to is just way too much to be a part of a relatively simple frontend for Git. Giving suggestions like IntelliJ does would involve parsing the entire project, and then figuring out what the best match would be. This means we have to somehow write parsers for all popular languages. That is something that just doesn't belong in git-gui. It is a full fledged IDE feature.

That said, I think simple word suggestions might be something worth considering. While "smart" suggestions like IDEs is not what we probably want to do, I think suggesting words from a user-specified dictionary would be something some people might like.

But unless some Tcl/Tk package for autocompletion already exists, it would be a pretty big effort that I for one will probably not undertake. So unless you or someone else volunteers to do this, I don't think it will happen any time soon. And even if someone does decide to go ahead with the idea, I can't say anything for sure until I see the patch.

logiclrd commented 4 years ago

It might be useful to have it autopopulate a dictionary by scanning changed files for tokens matching both something like ^[a-zA-Z0-9_$@]{6,}$ and [^A-Z][A-Z], heuristically guessing that these would be longer multi-word identifiers but without loading literally everything it sees into the dictionary. I say the whole file, rather than just the changed hunks, because it could be really useful to have autocompletion of the name of a function in which a change was made, even if the function's heading is outside of the hunk scope.

My sample regular expressions aren't perfect, they don't match snake_case_identifiers, but that's an implementation detail :-)

logiclrd commented 4 years ago

The Google found this: https://wiki.tcl-lang.org/page/autocomplete

prati0100 commented 4 years ago

I'm not sure whether doing half-baked autocomplete is better than no autocomplete. But I guess I should wait till someone comes up with a sample implementation to judge.

johnjohndoe commented 4 years ago

... too much to be a part of a relatively simple frontend for Git. Giving suggestions like IntelliJ does would involve parsing the entire project ... write parsers for all popular languages ... full fledged IDE feature.

Excuse me for not explaining further what I had in mind when creating this issue. I do not want anyone to re-implement any language parser or the like. What I imagine is possible is that git-gui offers some kind of plugin architecture which allows existing modules from IDEs to be plugged-in. This would allow leaving the heavy lifting of indexing and parsing to the external IDE module while benefiting from its result. Something which I cannot answer is whether such modules offer an interface to attach from an external application such as git-gui. If someone has experience in this field I would be interested to read about it.