continue icon indicating copy to clipboard operation
continue copied to clipboard

Change inline @file context cause message loss after it

Open Joilence opened this issue 1 year ago • 3 comments

Before submitting your bug report

Relevant environment info

- OS: macOS 15.0
- Continue: 0.8.52
- IDE: VSCode 1.93.1
- Model: any
- config.json:
  
  {
  "models": [
    {
      "model": "claude-3-5-sonnet-20240620",
      "contextLength": 200000,
      "title": "Claude 3.5 Sonnet",
      "apiKey": "*********",
      "provider": "anthropic"
    }
  ],
  "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"
    }
  ],
  "tabAutocompleteModel": {
    "title": "Starcoder2 3b",
    "provider": "ollama",
    "model": "starcoder2:3b"
  },
  "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

https://github.com/user-attachments/assets/e241ba00-def4-4221-b4d9-b9177f2dbf9d

To reproduce

  1. Write a prompt: look @file1 and @file2, write code
  2. Change @file1 to another file, the rest of message (and @file) will disappear

Log output

No logs in the console.

Joilence avatar Sep 19 '24 08:09 Joilence

Thanks for the screen recording here @Joilence ! Very helpful.

My best guess is that there is some React state logic here that we are clearing out accidentally when you attempt to edit a context provider that comes before other providers. The logic for that is in this file: https://github.com/continuedev/continue/blob/3f8402af19ae010b60adaf893f06548f3cef877c/gui/src/components/mainInput/TipTapEditor.tsx

Not sure how soon we'll be able to get around to fixing but if you're interested in taking a look that would be much appreciated! 😁

https://github.com/continuedev/continue/blob/main/CONTRIBUTING.md

Patrick-Erichsen avatar Sep 19 '24 18:09 Patrick-Erichsen

Thanks for the reply! I am not familiar with React, hopefully this will catch someone else's attention :)

Joilence avatar Sep 19 '24 19:09 Joilence

#2387

Thanks for the screen recording here @Joilence ! Very helpful.

My best guess is that there is some React state logic here that we are clearing out accidentally when you attempt to edit a context provider that comes before other providers. The logic for that is in this file: https://github.com/continuedev/continue/blob/3f8402af19ae010b60adaf893f06548f3cef877c/gui/src/components/mainInput/TipTapEditor.tsx

Not sure how soon we'll be able to get around to fixing but if you're interested in taking a look that would be much appreciated! 😁

https://github.com/continuedev/continue/blob/main/CONTRIBUTING.md

Yes I came out with a fix #2387 . Was this intentional? I believe it's a better UX if a user has a long prompt and wants to change one file at the beginning it should not remove the entire prompt.

eagle3y3 avatar Sep 25 '24 04:09 eagle3y3

Perfect fix. It was intentional only to remove the text right after the "@", so your solution was great

sestinj avatar Sep 29 '24 02:09 sestinj