-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
I've got a work-in-progress CL to roll the new formatter into the SDK. This morning, I built the SDK and poked around in Visual Studio Code (which I have pointed at my just-built SDK). As most do, I have it set to auto-format when I save a file.
To my surprise, it applied the new formatting style to the code I was working on even though the surrounding package's language version is 3.0.
I tracked the problem down to analysis_server/lib/src/lsp/source_edits.dart. If I swap that out with DartFormatter.latestShortStyleLanguageVersion and rebuild the SDK, I get the old style. That means that result.unit.declaredElement?.library.languageVersion.effective must be returning null.
Do you have any idea why it isn't picking up the language version of the surrounding package?
I checked, and I didn't see any lingering .packages files, and the package does have a .dart_tool/package_config.json file with an appropriate language version set:
{
"name": "dart_style",
"rootUri": "../",
"packageUri": "lib/",
"languageVersion": "3.0"
}
I tried with two unrelated packages and got the same behavior in both.