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

Fix persisting context files #678

Closed
wants to merge 1 commit into from
Closed

Conversation

Sa1to
Copy link
Contributor

@Sa1to Sa1to commented Feb 15, 2024

It fixes #636

Test plan

  1. Send message to the chat asking about context of the repo
  2. Change account and go back to the initial one
  3. Open initial chat from the history
  4. Check if you see context files in the chat

@Sa1to Sa1to force-pushed the sa1to/fix-persisting-contextfiles branch from a2071c6 to 3771878 Compare February 16, 2024 13:37
@Sa1to Sa1to marked this pull request as ready for review February 16, 2024 14:11
contextFiles.forEach { contextFile ->
val element = ContextFile()
element.uri = contextFile.uri.toString()
if (!it.contextFiles.contains(element)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general the approach is good. However I think we should be more precise about the saved files.

  1. Probably we should distinguish the local files and the files from the remote repo contexts.
  2. We should consider persisting a given file only once - it this implementation the same file but different fragment (the lines, see example below). Maybe we should save only the files that are presented? 🤔

Note that VS Code persists the context files with their proper links.

{
  "uri": "https://sourcegraph.sourcegraph.com//github.com/sourcegraph/jetbrains@3761a12f72c5bcf8f777924d75f32db729c57788/-/blob/CONTRIBUTING.md?L49-56",
  "repoName": "github.com/sourcegraph/jetbrains",
  "revision": "3761a12f72c5bcf8f777924d75f32db729c57788",
  "range": {
    "start": {
      "line": 48,
      "character": 0
    },
    "end": {
      "line": 56,
      "character": 0
    }
  },
  "type": "file"
},

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have this code at all in JetBrains, instead of relying on the extension code's history? The extension shards chat history by account, preventing bugs like this, #1210 that I noticed yesterday, etc.

@pkukielka pkukielka closed this May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants