Repository navigation
Renaming files triggers uri_does_not_exist #5269
Copy link
Copy link
Closed
Labels
in editorRelates to code editing or language featuresRelates to code editing or language featuresin lsp/analysis serverSomething to be fixed in the Dart analysis serverSomething to be fixed in the Dart analysis serveris bugrelies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become availableSomething that requires changes in the Dart/Flutter SDK to ship before it will become available
Milestone
Description
Describe the bug
When renaming files I got uri_does_not_exist in the line modified by the refactoring.
To Reproduce
Steps to reproduce the behavior:
- Create a new empty project
- Add file
a.dart - Add import to main.dart
- Rename
a.darttoc.dart - Immediately click on
main.dart(I believe) - See that on
main.dartyou get theuri_does_not_existlint on the line that now isc.dart
Here is the zip with all logs: temp.zip (main.dart in this case is temp.dart).
Expected behavior
No errors.
Please complete the following information:
Workspace Environment
Dart Code extension: 3.97.20240902
Flutter extension: 3.97.20240902 (activated)
App: Visual Studio Code
App Host: desktop
Version: win 1.93.1
Workspace type: Dart (LSP)
Workspace name: temp
Dart (3.5.3): C:\Users\felip_0vh5fa6\.puro\shared\caches\36335019a8eab588c3c2ea783c618d90505be233\dart-sdk
Flutter (3.24.3): C:\Users\felip_0vh5fa6\.puro\envs\stable\flutter (No device)
Output from 'dart info'
C:\Users\felip_0vh5fa6\.puro\shared\caches\36335019a8eab588c3c2ea783c618d90505be233\dart-sdk\bin\dart.exe info
If providing this information as part of reporting a bug, please review the information
below to ensure it only contains things you're comfortable posting publicly.
General info
- Dart 3.5.3 (stable) (Wed Sep 11 16:22:47 2024 +0000) on "windows_x64"
- on windows / "Windows 10 Pro" 10.0 (Build 22631)
- locale is pt-BR
Project info
- sdk constraint: '^3.6.0-175.0.dev'
- dependencies: args
- dev_dependencies: lints, test
Process info
| Memory | CPU | Elapsed time | Command line |
|---|---|---|---|
| 0 MB | -- | dart.exe | |
| 0 MB | -- | dart.exe | |
| 0 MB | -- | dart.exe | |
| 0 MB | -- | dart.exe | |
| 0 MB | -- | dart.exe | |
| 0 MB | -- | dart.exe | |
| 0 MB | -- | dart.exe |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
in editorRelates to code editing or language featuresRelates to code editing or language featuresin lsp/analysis serverSomething to be fixed in the Dart analysis serverSomething to be fixed in the Dart analysis serveris bugrelies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become availableSomething that requires changes in the Dart/Flutter SDK to ship before it will become available
Activity
DanTup commentedon Sep 16, 2024
Thanks, I've been through the log and filtered it to just the important events and something does look wrong here.
repro_instrum_filtered.txt
The operation is done, undone, and redone in the log. The second time everything looks good, but the first time there is a stale
uri_does_not_existthat should've become anunused_import.The only obvious difference is that in the broken case, the file was opened by VS Code prior to the watch event being processed. I don't know if this is the trigger, but it is something to try and reproduce in a test.
DanTup commentedon Oct 28, 2024
I managed to repro this today by undoing and redoing using exactly the steps above. Not sure if important, but I didn't save
main.dartafter adding the initial import.Edit: And at one point, I repro'd without the undo/redo.
instrum copy.txt
FMorschel commentedon Oct 28, 2024
I do have auto-save set to 1 second so I don't think that would make a difference, but good to track.
DanTup commentedon Oct 28, 2024
Yeah, I don't think it matters. I think I've repro'd in a test, and I think it might be the same issue as dart-lang/sdk#55318 and so an easier way to reproduce is:
The
uri_does_not_existerror doesn't go away. I think it may be because creating the filefoo.dartdoes not invalidate any files that had an unresolved import forfoo.dart.[analysis_server] Don't treat non-existent files the same as empty fi…
DanTup commentedon Oct 28, 2024
Fixed by dart-lang/sdk@12d9554. The change is in the analysis server so ships with a future Dart/Flutter SDK.