Repository navigation
Closed
Closed
Bug
Copy link
Description
System details
RStudio Edition : Desktop or Server
RStudio Version : 2024.12.1+563 up through latest Mariposa Orchid `main`
OS Version : any
R Version : any
Steps to reproduce the problem
- add
COPILOT_LOG_LEVEL=3to~/.Renviron - launch RStudio
- open an existing script (e.g. "foo.R")
- close RStudio
- launch RStudio
Describe the problem in detail
- RStudio loads "foo.R" when it launches, as it should
- in the various Copilot messages spewed into the Console will be:
RESPONSE
------------------
{"jsonrpc":"2.0","id":"060b3e35-108c-4ab5-805d-65ae72226c35","error":{"code":-32602,"message":"Document for URI could not be found: file:///Users/gary/foo/foo.R, URIs of the known document are: "}}
------------------
- no completions will show in that file until you make an edit to it
Describe the behavior you expected
- no error, and completions work without making an edit
The problem is we aren't notifying Copilot (via textDocument/didOpen) about files that get opened automatically at RStudio launch time; once changes are made to the file it will start working and show completions.
Here's the code that currently suppresses this error:
Lines 170 to 176 in 2b935d3
| // Handle 'document could not be found' errors up-front. These errors | |
| // will normally self-resolve after the user starts editing the document, | |
| // so it should suffice just to indicate that no completions are available. | |
| int code = error.code; | |
| if (code == CopilotConstants.ErrorCodes.DOCUMENT_NOT_FOUND) | |
| { | |
| events_.fireEvent(new CopilotEvent(CopilotEventType.COMPLETION_RECEIVED_NONE)); |
QA Notes
Once you have opened a PR, add additional information for QA on how to validate the change, paying special attention to the level of risk, adjacent areas that could be affected by the change, and any important contextual information not present in the original description.
- I have read the guide for submitting good bug reports.
- I have installed the latest version of RStudio, and confirmed that the issue still persists.
- If I am reporting an RStudio crash, I have included a diagnostics report.
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
Activity
gtritchie commentedon May 27, 2025
Note to self, the documents are loaded during session startup at
rstudio/src/gwt/src/org/rstudio/studio/client/workbench/views/source/Source.java
Line 678 in bef453f
ronblum commentedon Jun 17, 2025
Verified in RStudio Desktop 2025.08.0-daily+214 on Windows 11. Also confirmed that requests/responses are made when clicking or moving the mouse in the file without making any edits.