continuedev / continue

⏩ Continue is the leading open-source AI code assistant. You can connect any models and any context to build custom autocomplete and chat experiences inside VS Code and JetBrains
https://docs.continue.dev/
Apache License 2.0
18.88k stars 1.6k forks source link

Add a parameter for the commit slash command to only run on staged changes #1893

Open FozzieHi opened 3 months ago

FozzieHi commented 3 months ago

Validations

Problem

I'd like to run the /commit slash command only on staged changes, as opposed to all changes which is the current behaviour.

Solution

Add a boolean parameter to the commit slash command called stagedOnly. If true, include only the staged changes; If false, include both staged and unstaged changes. I'm happy to create a PR with this functionality.

priyashpatil commented 3 months ago

I don't use the /commit, My current workaround is "CMD+Shift+P" -> "Git: commit staged" -> "CMD+I" -> "Write commit using conventional commit standards":

Screenshot 2024-08-02 at 4 43 29 PM

Patrick-Erichsen commented 3 months ago

Neat workflow @priyashpatil ! This could be a useful custom quick action, although I'm unsure if there is a LSP extension for git files like this that we would need.

@FozzieHi - thanks for calling this out. I think if anything the default behavior should be to only generate the commit off of staged changes, and then we could add a param to optionally include unstaged changes (e.g. includeUnstaged).

If we made that change, I think we would want to provide some sort of helpful feedback to the user in the scenario where they attempt to generate a commit but haven't staged any changes.

We would definitely welcome a PR if you're interested in taking this on!

FozzieHi commented 3 months ago

@Patrick-Erichsen Sounds good. I did assume it was only doing staged changes to begin with until I started to realise it was writing about unstaged changes as well. I do have a demo running locally, I'll just swap around the params and create a PR.

Patrick-Erichsen commented 3 months ago

Excellent, looking forward to the PR!