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

Feature request: #5

Open
Barben360 opened this issue Jan 11, 2019 · 11 comments
Open

Feature request: #5

Barben360 opened this issue Jan 11, 2019 · 11 comments

Comments

@Barben360
Copy link

Hello it's me again and again!
Would it be possible to add the possibility to add comments to the commit?

From git commit documentation:

-m , --message=
Use the given as the commit message. If multiple -m options
are given, their values are concatenated as separate paragraphs.

This means that comments could be appended in the command line reusing -m "comment line 1" -m "comment line 2", etc

@Barben360
Copy link
Author

However this inserts a double-backline between each paragraph, which is not exactly a multiline comment.

@benjaminadk
Copy link
Owner

Are you thinking something like what is described in this article? This format is:

git commit -m ":emoji: Title with max of 50 chars \n\n Body with max of 72 chars"

Is it possible with using newline characters?

@Barben360
Copy link
Author

Yes I'm thinking about this. However I've just tested, using \n character doesn't go back to line, it just inserts characters \ and n in the commit title.

@Barben360
Copy link
Author

Some hint here: git commit -F <filename> creates the commit message from a file. Therefore if you generate a temp file with the commit title and message (including multiline), you can just generate the temp file and generate the line:
git commit -F <filename> && rm <filename>. However the rm will only work on unix-based distributions. I think you should consider applying the commit and removing the file directly in your extension and not just generate the command line.

@benjaminadk
Copy link
Owner

So does the user create the temp file in vscode? Or do I parse the user input from the vscode UI and generate a file from that? I have to look into vscode api and see if it offers a multiline input. Right now all I can think of is parsing the single line text for the \n character and formatting a template string and creating the temp file with the extension.

@Barben360
Copy link
Author

As a user I think it is a bad idea to make the user create the temp file. This is quite a lot of work for just a commit. Generating it would be the best. If multiline input is possible in quick actions, then this would be the best solution. I have no idea if this is possible, but I think not. Your solution parsing \n would be quite a good compromise I think.
Another solution would be to have a section in "Source control" panel on the left to manage gitmoji commits, multiline in forms is possible here (at least it is for the built-in git message editor). But that would imply a full redesign of your extension.

@akaleeroy
Copy link

First of all nice work on the extension! 👏

I'd like multi-line commits too. I'm coming from using a custom git commit template:

git config --global commit.template ~/.gitmessage.txt

.gitmessage.txt file ↓

# https://gitmoji.carloscuesta.me

# :art: Improving structure / format of the code
# :zap: Improving performance
# :fire: Removing code or files
# ...

Committing looks like:
git commit -a
COMMIT_EDITMSG file opens in default editor
↳ track down what kind of commit I want, un-comment it, write my commit message, hit Return twice, write the details, save and close

It's a great experience because you have the full power of a code editor, you get multi-line commits, spell checking, you can set rulers to 50 characters, you get another look at the committed file names and you can change your mind: Hang on this isn't a ✏️ Fixing typos it's a 💬 Changing text and literals...

The upsides with your extension are triggering with a command (incl. keybinding) and that sweet sweet fuzzy search command palette menu, instead of doing Ctrl F. I can't figure out how to integrate the commit template workflow directly into VSCode, save for opening a terminal and typing out git commit. If you try to use the Source control panel it forces you into a little textbox.

@benjaminadk
Copy link
Owner

benjaminadk commented Aug 29, 2019

I am brainstorming. I just found this article and the last option - adding $ between -m and the quoted message. The article says that $ makes the shell honor \n on *nix systems. This works on my Windows 10 machine. This could be an option is vscode settings. Lile allowMultiline or something.


OR - maybe try to integrate with git's flow somehow. If extensions could write to user's machine i guess it could overwrite the template and open the editor with the selected emoji and text on the subject line on each commit. not sure if this is possible or the best approach though.

@Barben360
Copy link
Author

Nice discovery! I also found out that you can commit directly a text file as a message:

git commit -F message.txt

In the documentation of VSCode extensions, I can see several interesting things:

  • Virtual documents to generate read-only files (maybe the commit message can be one of them?)
  • Source control API which allows you to integrate with source control (and then probably git flow).

@benjaminadk
Copy link
Owner

I added basic multiline support.
Having a problem with my azure devops account. I didnt renew an email address i used for the microsoft account i created the account for this extension with.
Bottom line is that i cant publish an update at this point. I am looking into it.

@pke
Copy link

pke commented May 28, 2020

@benjaminadk can you submit updates by now again?

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

4 participants