loadNativePluginConfigFromProjectRoot function
Reloads all plugin configuration using a known projectRoot instead of
Directory.current. Call when the analyzer supplies a file path from
which the real project root can be derived (walk up to pubspec.yaml).
This is the fix for the analyzer-launched-plugin bug where the plugin's
start() runs with cwd set to the analysis-server process's working
directory, not the consumer project. Without a reload from the real
project root, SaropaLintRule.enabledRules stays null and every rule
is silently gated off at visitor-entry time.
Safe to call multiple times — static fields are simply overwritten. Never throws; failures in any step are caught and the rest still run.
Implementation
void loadNativePluginConfigFromProjectRoot(String projectRoot) {
if (projectRoot.isEmpty) return;
_loadFromRoot(projectRoot);
}