Skip to content
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

Add VS Code integration #1

Closed
MichaelCurrin opened this issue Aug 2, 2020 · 6 comments
Closed

Add VS Code integration #1

MichaelCurrin opened this issue Aug 2, 2020 · 6 comments

Comments

@MichaelCurrin
Copy link
Owner

VS Code does not work with git hooks. So after getting the shell version working I can look at making a vs code extension based on this one

https://github.com/benjaminadk/emojigit

I could even use my existing command as using the confirmation flow there is a terminal git commit command, but one gets there after using the extension UI. Also the confirmation in the terminal can be toggled. Maybe it is just behind the scenes

@MichaelCurrin
Copy link
Owner Author

MichaelCurrin commented Aug 2, 2020

The extension uses quick pick.

Look at the VS Code library API in the docs for how to preview a message in the pane or command view, then ask user to accept or not override with own message.

Also maybe look at the semantic commit extension which mixes typing your message with choosing chore, docs etc.

I need to generate a commit message, maybe using git API is JS in the first emojicommit extension above or the shell to read the git status. And then give the user a choice to accept (y/n or just prepopulate a single file) or override with own message.

Then commit with terminal as commit using the output message (it doesn't matter whether manual or auto generated)

@MichaelCurrin
Copy link
Owner Author

MichaelCurrin commented Aug 2, 2020

@MichaelCurrin
Copy link
Owner Author

Note from my testing that VS Code does actually respect the prepare-commit-msg hook, meaning that the hook can be used without writing a new VS Code extension (as I planned before).

But note that VS Code with this hook means just overwrites the message based on your input messange and hook logic. You don't get to confirm and you only see what was written when you check the log.

Also note that this flow does not actually use what you enter in the commit box - VS Code does not write to the .git/COMMIT_EDITMSG file and therefore there is nothing there for the hook to read. I found an issue on the VS Code repo about this that didn't get enough votes to get addressed.

Options are:

  • Create hook that is used on the terminal and also on VS Code but on every commit and it does not use the original message.
  • Create an extension based on the Emoji and Semantic commit ones

@MichaelCurrin
Copy link
Owner Author

Also extension templates are easy enough to use but i need to see how to make my extension installed on VS Code locally

@MichaelCurrin
Copy link
Owner Author

Also I don't know why the helloworld test sample downloads VS Code - the semantic commit one has a similar test setup without the download.

Also maybe the download is skipped on subsequent runs

@MichaelCurrin
Copy link
Owner Author

Done with tag v0.7.0 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant