diff --git a/src/vs/workbench/parts/codeEditor/codeEditor.contribution.ts b/src/vs/workbench/parts/codeEditor/codeEditor.contribution.ts index c8a7d860be517d1433c7c3556790ec1c1ef39b0d..95050238b93197b0bc5bd0dd01925b4a9440fd7c 100644 --- a/src/vs/workbench/parts/codeEditor/codeEditor.contribution.ts +++ b/src/vs/workbench/parts/codeEditor/codeEditor.contribution.ts @@ -12,5 +12,4 @@ import './electron-browser/toggleMinimap'; import './electron-browser/toggleMultiCursorModifier'; import './electron-browser/toggleRenderControlCharacter'; import './electron-browser/toggleRenderWhitespace'; -import './electron-browser/toggleWordWrap'; -import './electron-browser/wordWrapMigration'; +import './electron-browser/toggleWordWrap'; \ No newline at end of file diff --git a/src/vs/workbench/parts/codeEditor/electron-browser/wordWrapMigration.ts b/src/vs/workbench/parts/codeEditor/electron-browser/wordWrapMigration.ts deleted file mode 100644 index 48b4ecdae9cb4a7c3d2f7f7ffdde51bda1e83fbc..0000000000000000000000000000000000000000 --- a/src/vs/workbench/parts/codeEditor/electron-browser/wordWrapMigration.ts +++ /dev/null @@ -1,143 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -'use strict'; - -import * as nls from 'vs/nls'; -import { Disposable } from 'vs/base/common/lifecycle'; -import { TPromise } from 'vs/base/common/winjs.base'; -import { IEditorContribution } from 'vs/editor/common/editorCommon'; -import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; -import { registerEditorContribution } from 'vs/editor/browser/editorExtensions'; -import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; -import { IMessageService } from 'vs/platform/message/common/message'; -import { IPreferencesService } from 'vs/workbench/parts/preferences/common/preferences'; -import { Action } from 'vs/base/common/actions'; -import Severity from 'vs/base/common/severity'; - -interface IStorageData { - dontShowPrompt: boolean; -} - -class WordWrapMigrationStorage { - private static readonly KEY = 'wordWrapMigration'; - - private _storageService: IStorageService; - private _value: IStorageData; - - constructor(storageService: IStorageService) { - this._storageService = storageService; - this._value = this._read(); - } - - private _read(): IStorageData { - let jsonValue = this._storageService.get(WordWrapMigrationStorage.KEY, StorageScope.GLOBAL); - if (!jsonValue) { - return null; - } - try { - return JSON.parse(jsonValue); - } catch (err) { - return null; - } - } - - public get(): IStorageData { - return this._value; - } - - public set(data: IStorageData): void { - this._value = data; - this._storageService.store(WordWrapMigrationStorage.KEY, JSON.stringify(this._value), StorageScope.GLOBAL); - } -} - -class WordWrapMigrationController extends Disposable implements IEditorContribution { - - private static readonly ID = 'editor.contrib.wordWrapMigrationController'; - private static _checked = false; - - constructor( - editor: ICodeEditor, - @IConfigurationService private configurationService: IConfigurationService, - @IMessageService private messageService: IMessageService, - @IStorageService private storageService: IStorageService, - @IPreferencesService private preferencesService: IPreferencesService - ) { - super(); - - this._promptIfNecessary(); - } - - public getId(): string { - return WordWrapMigrationController.ID; - } - - private _promptIfNecessary(): void { - if (WordWrapMigrationController._checked) { - // Already checked - return; - } - WordWrapMigrationController._checked = true; - - let result = this.configurationService.inspect('editor.wrappingColumn'); - if (typeof result.value === 'undefined') { - // Setting is not used - return; - } - - const storage = new WordWrapMigrationStorage(this.storageService); - const storedData = storage.get(); - if (storedData && storedData.dontShowPrompt) { - // Do not prompt stored - return; - } - - let isUserSetting = (typeof result.user !== 'undefined'); - this._prompt(storage, isUserSetting); - } - - private _prompt(storage: WordWrapMigrationStorage, userSettings: boolean): void { - const okAction = new Action( - 'wordWrapMigration.ok', - nls.localize('wordWrapMigration.ok', "OK"), - null, - true, - () => TPromise.as(true) - ); - const dontShowAgainAction = new Action( - 'wordWrapMigration.dontShowAgain', - nls.localize('wordWrapMigration.dontShowAgain', "Don't Show Again"), - null, - true, - () => { - storage.set({ - dontShowPrompt: true - }); - return TPromise.as(true); - } - ); - const openSettings = new Action( - 'wordWrapMigration.openSettings', - nls.localize('wordWrapMigration.openSettings', "Open Settings"), - null, - true, - () => { - if (userSettings) { - this.preferencesService.openGlobalSettings(); - } else { - this.preferencesService.openWorkspaceSettings(); - } - return TPromise.as(true); - } - ); - this.messageService.show(Severity.Info, { - message: nls.localize('wordWrapMigration.prompt', "The setting `editor.wrappingColumn` has been deprecated in favor of `editor.wordWrap`."), - actions: [okAction, openSettings, dontShowAgainAction] - }); - } -} - -registerEditorContribution(WordWrapMigrationController);