-
Notifications
You must be signed in to change notification settings - Fork 344
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
Splitting this from #4740 since it's not the same as the original issue and I'm not yet certain that it's plugin-related at all.
To reproduce:
- Create a simple empty project that references an analyzer plugin (like
custom_lint)
I'm not sure the plugin is relevant yet, but it seems to repro pretty reliably with and I couldn't repro without - Ensure
"dart.onlyAnalyzeProjectsWithOpenFiles":trueis set for the workspace and that no files are open - Run the Developer: Reload Window command to get a clean analyzer with no open files
- Open
analysis_options.yamland press Save - Close
analysis_options.yaml
Modifying analysis_options may or may not be relevant - Open a
.dartfile - Make some changes to the file
This open results in an error like:
Opening the file triggers rebuilding of analysis roots, but it also seems to remove the overlay:
1701185971585:Req:{"jsonrpc"::"2.0","method"::"textDocument/didOpen","params"::{"textDocument"::{"uri"::"file::///C%3A/Dev/Test%20Projects/dartcode_4740_repro/lib/dartcode_4740_repro.dart","languageId"::"dart","version"::1,"text"::"int calculate() {\n return 6 * 7;\n}\n"}},"clientRequestTime"::1701185971583}
1701185971585:Info:Setting overlay for C::\Dev\Test Projects\dartcode_4740_repro\lib\dartcode_4740_repro.dart
1701185971587:Info:Setting roots
1701185971588:Info:Done setting roots
1701185971588:Info:Done setting roots
1701185971588:Info:Removing overlay for C::\Dev\Test Projects\dartcode_4740_repro\lib\dartcode_4740_repro.dart
1701185972690:Req:{"jsonrpc"::"2.0","method"::"textDocument/didChange","params"::{"textDocument"::{"uri"::"file::///C%3A/Dev/Test%20Projects/dartcode_4740_repro/lib/dartcode_4740_repro.dart","version"::2},"contentChanges"::[{"range"::{"start"::{"line"::3,"character"::0},"end"::{"line"::3,"character"::0}},"rangeLength"::0,"text"::"d"}]},"clientRequestTime"::1701185972204}
1701185972690:Res:{"jsonrpc"::"2.0","method"::"window/showMessage","params"::{"message"::"Unable to edit document because the file was not previously opened:: C::\\Dev\\Test Projects\\dartcode_4740_repro\\lib\\dartcode_4740_repro.dart","type"::1}}
1701185972690:Res:{"jsonrpc"::"2.0","method"::"window/logMessage","params"::{"message"::"An unrecoverable error occurred.\n\nUnable to edit document because the file was not previously opened:: C::\\Dev\\Test Projects\\dartcode_4740_repro\\lib\\dartcode_4740_repro.dart\n\n-32099\n\nnull","type"::1}}
We always verify we have an overlay before processing a textDocument/didChange event so this results in us throwing.
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
