Explorar el Código

Migrates debug setting

main
Eric Amodio hace 6 años
padre
commit
1543467542
Se han modificado 2 ficheros con 32 adiciones y 30 borrados
  1. +21
    -24
      src/configuration.ts
  2. +11
    -6
      src/extension.ts

+ 21
- 24
src/configuration.ts Ver fichero

@ -74,38 +74,35 @@ export class Configuration {
if (inspection.globalValue !== undefined) {
await this.update(to, migrationFn ? migrationFn(inspection.globalValue as TFrom) : inspection.globalValue, ConfigurationTarget.Global);
if (from !== to) {
try {
await this.update(from, undefined, ConfigurationTarget.Global);
}
catch (ex) {
debugger;
}
}
// Can't delete the old setting currently because it errors with `Unable to write to User Settings because <setting name> is not a registered configuration`
// if (from !== to) {
// try {
// await this.update(from, undefined, ConfigurationTarget.Global);
// }
// catch { }
// }
}
if (inspection.workspaceValue !== undefined) {
await this.update(to, migrationFn ? migrationFn(inspection.workspaceValue as TFrom) : inspection.workspaceValue, ConfigurationTarget.Workspace);
if (from !== to) {
try {
await this.update(from, undefined, ConfigurationTarget.Workspace);
}
catch (ex) {
debugger;
}
}
// Can't delete the old setting currently because it errors with `Unable to write to User Settings because <setting name> is not a registered configuration`
// if (from !== to) {
// try {
// await this.update(from, undefined, ConfigurationTarget.Workspace);
// }
// catch { }
// }
}
if (inspection.workspaceFolderValue !== undefined) {
await this.update(to, migrationFn ? migrationFn(inspection.workspaceFolderValue as TFrom) : inspection.workspaceFolderValue, ConfigurationTarget.WorkspaceFolder);
if (from !== to) {
try {
await this.update(from, undefined, ConfigurationTarget.WorkspaceFolder);
}
catch (ex) {
debugger;
}
}
// Can't delete the old setting currently because it errors with `Unable to write to User Settings because <setting name> is not a registered configuration`
// if (from !== to) {
// try {
// await this.update(from, undefined, ConfigurationTarget.WorkspaceFolder);
// }
// catch { }
// }
}
}

+ 11
- 6
src/extension.ts Ver fichero

@ -1,7 +1,7 @@
'use strict';
import { Objects, Versions } from './system';
import { commands, ConfigurationTarget, ExtensionContext, extensions, window, workspace } from 'vscode';
import { CodeLensLanguageScope, CodeLensScopes, configuration, Configuration, IConfig } from './configuration';
import { CodeLensLanguageScope, CodeLensScopes, configuration, Configuration, IConfig, OutputLevel } from './configuration';
import { CommandContext, ExtensionKey, GlobalState, QualifiedExtensionId, setCommandContext } from './constants';
import { Commands, configureCommands } from './commands';
import { Container } from './container';
@ -121,11 +121,6 @@ async function migrateSettings(context: ExtensionContext, previousVersion: strin
}
if (Versions.compare(previous, Versions.from(7, 5, 9)) !== 1) {
const section = configuration.name('advanced')('messages').value;
const messages = configuration.get<{ [key: string]: boolean }>(section);
messages[SuppressedMessages.WelcomeNotice] = false;
await configuration.update(section, messages, ConfigurationTarget.Global);
await configuration.migrate('annotations.file.gutter.gravatars', configuration.name('blame')('avatars').value);
await configuration.migrate('annotations.file.gutter.compact', configuration.name('blame')('compact').value);
await configuration.migrate('annotations.file.gutter.dateFormat', configuration.name('blame')('dateFormat').value);
@ -173,6 +168,16 @@ async function migrateSettings(context: ExtensionContext, previousVersion: strin
await configuration.migrate('recentChanges.file.lineHighlight.locations', configuration.name('recentChanges')('highlight')('locations').value);
}
if (Versions.compare(previous, Versions.from(8, 0, 0, 'beta2')) !== 1) {
const section = configuration.name('advanced')('messages').value;
const messages = configuration.get<{ [key: string]: boolean }>(section);
messages[SuppressedMessages.WelcomeNotice] = false;
await configuration.update(section, messages, ConfigurationTarget.Global);
await configuration.migrate<boolean, OutputLevel>('debug', configuration.name('outputLevel').value, v => v ? OutputLevel.Debug : configuration.get(configuration.name('outputLevel').value));
await configuration.migrate('debug', configuration.name('debug').value, v => undefined);
}
}
catch (ex) {
Logger.error(ex, 'migrateSettings');

Cargando…
Cancelar
Guardar