Skip to content

Commit

Permalink
auto-renaming tags notifier popping up multiple times. Fixes #97833
Browse files Browse the repository at this point in the history
  • Loading branch information
aeschli committed May 15, 2020
1 parent 4c36782 commit 13952ac
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions extensions/html-language-features/client/src/htmlMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,21 +298,26 @@ export function activate(context: ExtensionContext) {
});

const promptForTypeOnRenameKey = 'html.promptForTypeOnRename';
const promptForTypeOnRename =
!workspace.getConfiguration().get(SettingIds.renameOnType, { languageId: 'html' }) &&
extensions.getExtension('formulahendry.auto-rename-tag') &&
(context.globalState.get(promptForTypeOnRenameKey) !== false);

toDispose.push(window.onDidChangeActiveTextEditor(async e => {
if (e && promptForTypeOnRename && documentSelector.indexOf(e.document.languageId) !== -1) {
context.globalState.update(promptForTypeOnRenameKey, false);
const configure = localize('configureButton', 'Configure');
const res = await window.showInformationMessage(localize('renameOnTypeQuestion', 'VS Code now has built-in support for auto-renaming tags. Do you want to enable it?'), configure);
if (res === configure) {
commands.executeCommand('workbench.action.openSettings', SettingIds.renameOnType);
const promptForTypeOnRename = extensions.getExtension('formulahendry.auto-rename-tag') !== undefined &&
(context.globalState.get(promptForTypeOnRenameKey) !== false) &&
!workspace.getConfiguration('editor', { languageId: 'html' }).get('renameOnType');

if (promptForTypeOnRename) {
const activeEditorListener = window.onDidChangeActiveTextEditor(async e => {
if (e && documentSelector.indexOf(e.document.languageId) !== -1) {
context.globalState.update(promptForTypeOnRenameKey, false);
activeEditorListener.dispose();
const configure = localize('configureButton', 'Configure');
const res = await window.showInformationMessage(localize('renameOnTypeQuestion', 'VS Code now has built-in support for auto-renaming tags. Do you want to enable it?'), configure);
if (res === configure) {
commands.executeCommand('workbench.action.openSettings', SettingIds.renameOnType);
}
}
}
}));
});
toDispose.push(activeEditorListener);
}

toDispose.push();
}

function getPackageInfo(context: ExtensionContext): IPackageInfo | null {
Expand Down

0 comments on commit 13952ac

Please sign in to comment.