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

[Bug]: Chat doesn't seem to have access to the code #385

Closed
2 tasks done
grangej opened this issue Nov 4, 2023 · 6 comments
Closed
2 tasks done

[Bug]: Chat doesn't seem to have access to the code #385

grangej opened this issue Nov 4, 2023 · 6 comments
Assignees
Labels

Comments

@grangej
Copy link

grangej commented Nov 4, 2023

Before Reporting

  • I have checked FAQ, and there is no solution to my issue
  • I have searched the existing issues, and there is no existing issue for my issue

What happened?

Recently the chat no longer has access to the code, even when I manually specify the @code in the prompt.

For example:

Error:

I apologize for the inconvenience, but it seems there is a technical issue. The updated code from the file "/*****/features/DraftInvite/DraftInviteView.swift" was not loaded correctly. The context still shows an empty file.

Could you please provide the updated code directly or describe the changes you've made so I can assist you more effectively?

How to reproduce the bug.

Make changes to the code and ask for updates to the code

Relevant log output

No response

macOS version

14.2

Xcode version

15.0.1

Copilot for Xcode version

0.26

Node version

v20.8.0

@grangej grangej added the bug Something isn't working label Nov 4, 2023
@intitni
Copy link
Owner

intitni commented Nov 5, 2023

It seems to work for me.

Screenshot 2023-11-05 at 12 36 35

Please let me know if you were selecting empty spaces in the editor like this?

Screenshot 2023-11-05 at 12 38 42

Does it work if you select a piece of code and ask about it?

Do you think you can MITM the request and see if the code is contained in the request body?

{
  "messages": [
    {
      "content": "You must always reply in Chinese\nYou are an AI programming assistant.\nYour reply should be concise, clear, informative and logical.\nYou MUST reply in the format of markdown.\nYou MUST embed every code you provide in a markdown code block.\nYou MUST add the programming language name at the start of the markdown code block.\nIf you are asked to help perform a task, you MUST think step-by-step, then describe each step concisely.\nIf you are asked to explain code, if it's too long, you SHOULD explain it step-by-step in a ordered list, concisely.\nMake your answer short and structured.\n ## System Info\n\nCurrent Time: Sunday, 2023-11-05 12:36:18+0800 (You can use it to calculate time in another time zone)\n\n## File and Code Scope\n\nYou can use the following context to answer my questions about the editing document or code. The context shows only a part of the code in the editing document, and will change during the conversation, so it may not match our conversation.\n\nWhen you don't known what I am asking, I am probably referring to the code.\n\n### Editing Document Context\n\nDocument Relative Path: 
<--The Code is Inserted Here Inside Content !-->
\/Tool\/Sources\/ChatContextCollectors\/ActiveDocumentChatContextCollector\/ActiveDocumentChatContextCollector.swift\n\nLanguage: swift\n\nFocused Context:\n```\npublic final class ActiveDocumentChatContextCollector: ChatContextCollector\nfunc getActiveDocumentContext(_ info: EditorInformation) -> ActiveDocumentContext\n```\n\nFocused Range [line, character]: [76, 8] - [86, 9]\n\nFocused Code (start from line 76):\n```swift\n        var activeDocumentContext = activeDocumentContext ?? .init(\n            filePath: \"\",\n            relativePath: \"\",\n            language: .builtIn(.swift),\n            fileContent: \"\",\n            lines: [],\n            selectedCode: \"\",\n            selectionRange: .outOfScope,\n            lineAnnotations: [],\n            imports: []\n        )\n\n```",
      "role": "system"
    },
    {
      "content": "what does this function do? (reply in English)",
      "role": "user"
    }
  ],
  "functions": [
    {
      "description": "Call when Editing Document Context provides too little context to answer a question.",
      "name": "expandFocusRange",
      "parameters": {
        "type": "object",
        "properties": {
        }
      }
    }
  ],
  "model": "gpt-35-turbo",
  "temperature": 0.7000000000000001,
  "stream": true
}

@grangej
Copy link
Author

grangej commented Nov 5, 2023

Unfortunately it does seem to be working this morning.

I will try and reproduce again and get a screenshot of both the editor and chat window as you have done. I did also at the time make sure that I wasn't selecting anything and also even tried selecting everything in the editing file. Perhaps it is the size of the file?

Happy to also try and proxy the request once I can reproduce it again.

@intitni
Copy link
Owner

intitni commented Nov 5, 2023

One possible reason is that the app failed to find the UI element for the editor, I will review the logic before the next release.

Currently, the app will try to find the element each time Xcode becomes active or the focused UI element changes (switching between editors or windows, etc.)

If you encounter this issue again, you can try deactivating and reactivating Xcode as a workaround.

@intitni intitni added pending release Finished, but not yet released maybe fixed released and removed pending release Finished, but not yet released labels Nov 9, 2023
@intitni
Copy link
Owner

intitni commented Nov 9, 2023

Released in 0.27.0

Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Dec 10, 2023
Copy link

This issue was closed because it has been inactive for 14 days since being marked as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants