in src/formatter-settings/index.ts [32:56]
constructor(private readonly context: vscode.ExtensionContext) {
vscode.workspace.onDidChangeConfiguration(async (e) => {
if (e.affectsConfiguration(`java.${JavaConstants.SETTINGS_URL_KEY}`) || e.affectsConfiguration(`java.${JavaConstants.SETTINGS_PROFILE_KEY}`)) {
this.checkedProfileSettings = false;
this.onChangeProfileSettings();
} else if (this.webviewPanel && (e.affectsConfiguration(VSCodeSettings.TAB_SIZE) || e.affectsConfiguration(VSCodeSettings.INSERT_SPACES) || e.affectsConfiguration(VSCodeSettings.DETECT_INDENTATION))) {
await this.updateVSCodeSettings();
this.format();
}
if (e.affectsConfiguration(`java.${JavaConstants.SETTINGS_URL_KEY}`)) {
this.settingsUrl = vscode.workspace.getConfiguration("java").get<string>(JavaConstants.SETTINGS_URL_KEY);
if (this.settingsUrl && !isRemote(this.settingsUrl)) {
this.profilePath = await getProfilePath(this.settingsUrl);
}
}
});
vscode.workspace.onDidChangeTextDocument(async (e: vscode.TextDocumentChangeEvent) => {
if (!this.settingsUrl || e.document.uri.toString() !== vscode.Uri.file(this.profilePath).toString()) {
return;
}
if (!await this.parseProfileAndUpdate(e.document)) {
this.webviewPanel?.dispose();
}
});
}