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

Context: Git Diff name may be misleading? #2782

Open
3 tasks done
Astlaan opened this issue Nov 1, 2024 · 4 comments
Open
3 tasks done

Context: Git Diff name may be misleading? #2782

Astlaan opened this issue Nov 1, 2024 · 4 comments
Assignees
Labels
area:context-providers Relates to context providers good-first-issue Suggested issue for new contributors ide:vscode Relates specifically to VS Code extension kind:bug Indicates an unexpected problem or unintended behavior

Comments

@Astlaan
Copy link

Astlaan commented Nov 1, 2024

Before submitting your bug report

Relevant environment info

- OS: Windows
- Continue version: v0.8.55
- IDE version: VSCode 1.95.1
- Model: openrouter/anthropic/claude-3.5-sonnet:beta
- config.json:
  
{
  "models": [
    {
      "title": "Claude 3.5 Sonnet",
      "provider": "openrouter",
      "model": "anthropic/claude-3.5-sonnet:beta",
      "apiBase": "https://openrouter.ai/api/v1",
      "apiKey": "...",
      "contextLength": 200000,
      "cacheBehavior": {
        "cacheSystemMessage": true,
        "cacheConversation": true
      },
      "capabilities": {
        "uploadImage": true
      }
    },
    {
      "title": "Gemini Flash 1.5",
      "provider": "openrouter",
      "model": "google/gemini-flash-1.5",
      "apiBase": "https://openrouter.ai/api/v1",
      "apiKey": "...",
      "contextLength": 1000000,
      "capabilities": {
        "uploadImage": true
      }
    }
  ],
  "tabAutocompleteModel": {
    "title": "Codestral",
    "provider": "mistral",
    "model": "codestral-latest",
    "apiKey": ""
  },
  "embeddingsProvider": {
    "provider": "voyage",
    "model": "voyage-code-2",
    "apiKey": "..."
  },
  "reranker": {
    "name": "voyage",
    "params": {
      "model": "rerank-1",
      "apiKey": "..."
    }
  },
  // "embeddingsProvider": {
  //   "provider": "huggingface-tei",
  //   "apiBase": "http://localhost:8080"
  // },
  // "reranker": {
  //   "name": "huggingface-tei",
  //   "params": {
  //     "apiBase": "http://localhost:8081",
  //     "truncate": true,
  //     "truncation_direction": "Right"
  //   }
  // },
  "customCommands": [
    {
      "name": "test",
      "prompt": "{{{ input }}}\n\nWrite a comprehensive set of unit tests for the selected code. It should setup, run tests that check for correctness including important edge cases, and teardown. Ensure that the tests are complete and sophisticated. Give the tests just as chat output, don't edit any file.",
      "description": "Write unit tests for highlighted code"
    }
  ],
  "contextProviders": [
    {
      "name": "code",
      "params": {}
    },
    {
      "name": "docs",
      "params": {}
    },
    {
      "name": "diff",
      "params": {}
    },
    {
      "name": "terminal",
      "params": {}
    },
    {
      "name": "problems",
      "params": {}
    },
    {
      "name": "folder",
      "params": {}
    },
    {
      "name": "codebase",
      "params": {}
    }
  ],
  "slashCommands": [
    {
      "name": "edit",
      "description": "Edit selected code"
    },
    {
      "name": "comment",
      "description": "Write comments for the selected code"
    },
    {
      "name": "share",
      "description": "Export the current chat session to markdown"
    },
    {
      "name": "cmd",
      "description": "Generate a shell command"
    },
    {
      "name": "commit",
      "description": "Generate a git commit message"
    }
  ]
}

Description

Problem

It seems that the @git Diff context tag can only see Staged changes.

I gave the following prompt:

@file.py @ Git Diff does the current diff look correct?

If the changes are unstaged, the model replies:

Since you mentioned that Git shows no current changes and asked if the current diff looks correct - if there are no changes detected by Git, there would be no diff to evaluate.
[...]

Only if I stage them it is able to see them.

I think it is nice to have a feature that allows to pass only the Staged Changes to the model, since sometimes we have more uncommited changes and we want to commit only part of them.
However, I think the current tag is misleading, since the git diff command shows all changes, not just the Staged Changes. One would expect the @git Diff tag to include all changes that are visible in the git diff command. As such, I would classify this issue as a Bug instead of an Improvement.

Proposed Solution

  1. Change the current tag name from @Git Diff to @Git Diff (staged)
  2. Bonus: Add another tag, that provides the entire contents of git diff to the model. Name could be @Git Diff (All), or simply @Git Diff (similar to the current name).

To reproduce

No response

Log output

No response

@sestinj sestinj self-assigned this Nov 1, 2024
@dosubot dosubot bot added area:context-providers Relates to context providers ide:vscode Relates specifically to VS Code extension kind:bug Indicates an unexpected problem or unintended behavior labels Nov 1, 2024
@sestinj sestinj added the good-first-issue Suggested issue for new contributors label Nov 6, 2024
@sestinj
Copy link
Contributor

sestinj commented Nov 6, 2024

@Astlaan thanks for pointing this out. I tend to actually think for now we want to just keep one that refers to the entire git diff (I personally also use staged changes for organization/review, but just including everything is going to make it more accessible to people who don't, or might be confused about why some of their diff isn't showing up). I made a quick change here so that we by default do that, but you can use the includeUnstaged option in config.json to override

@Astlaan
Copy link
Author

Astlaan commented Nov 8, 2024

@Astlaan thanks for pointing this out. I tend to actually think for now we want to just keep one that refers to the entire git diff (I personally also use staged changes for organization/review, but just including everything is going to make it more accessible to people who don't, or might be confused about why some of their diff isn't showing up). I made a quick change here so that we by default do that, but you can use the includeUnstaged option in config.json to override

Thank you. I still think having both of the options would be useful, as sometimes you wrote more code and want to make a smaller commit with a portion, and could be helpful to be able to review that portion without having to edit the config.json all the time.

Don't you think the "Git Diff" and "Git Diff: Staged only" is clear?

@jkrauss82
Copy link

I ran into the same issue and wrecked my head why git diff always replied with something like "no current changes".

I highly recommend supporting both suggested features and definitely rename git diff to something more intuitive, it is highly misleading in its current form for someone used to work with git on the command line (like me).

For me, git staged or git staged changes would be okay for renaming the current option.

@sestinj
Copy link
Contributor

sestinj commented Dec 6, 2024

This is already done and will be in the next release (by default we will include both staged and unstaged changes). For those that want an option, it is available in config.json.

I'll wait to close this until we've made a main release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:context-providers Relates to context providers good-first-issue Suggested issue for new contributors ide:vscode Relates specifically to VS Code extension kind:bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

3 participants