mirror of
https://github.com/Microsoft/vscode
synced 2024-09-19 18:48:00 +00:00
sqlite - reduce changes
This commit is contained in:
parent
e7ddb88e1e
commit
3560e67017
|
@ -322,7 +322,7 @@ export class WindowsManager implements IWindowsMainService {
|
|||
|
||||
// See note on #onBeforeShutdown() for details how these events are flowing
|
||||
private onBeforeWindowClose(win: ICodeWindow): void {
|
||||
if (this.lifecycleService.isQuitRequested) {
|
||||
if (this.lifecycleService.quitRequested) {
|
||||
return; // during quit, many windows close in parallel so let it be handled in the before-quit handler
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ export class CommonFindController extends Disposable implements editorCommon.IEd
|
|||
protected _state: FindReplaceState;
|
||||
protected _updateHistoryDelayer: Delayer<void>;
|
||||
private _model: FindModelBoundToEditorModel;
|
||||
private storageService: IStorageService;
|
||||
private _storageService: IStorageService;
|
||||
private _clipboardService: IClipboardService;
|
||||
protected readonly _contextKeyService: IContextKeyService;
|
||||
|
||||
|
@ -90,7 +90,7 @@ export class CommonFindController extends Disposable implements editorCommon.IEd
|
|||
this._editor = editor;
|
||||
this._findWidgetVisible = CONTEXT_FIND_WIDGET_VISIBLE.bindTo(contextKeyService);
|
||||
this._contextKeyService = contextKeyService;
|
||||
this.storageService = storageService;
|
||||
this._storageService = storageService;
|
||||
this._clipboardService = clipboardService;
|
||||
|
||||
this._updateHistoryDelayer = new Delayer<void>(500);
|
||||
|
@ -107,9 +107,9 @@ export class CommonFindController extends Disposable implements editorCommon.IEd
|
|||
|
||||
this._state.change({
|
||||
searchScope: null,
|
||||
matchCase: this.storageService.getBoolean('editor.matchCase', StorageScope.WORKSPACE, false),
|
||||
wholeWord: this.storageService.getBoolean('editor.wholeWord', StorageScope.WORKSPACE, false),
|
||||
isRegex: this.storageService.getBoolean('editor.isRegex', StorageScope.WORKSPACE, false)
|
||||
matchCase: this._storageService.getBoolean('editor.matchCase', StorageScope.WORKSPACE, false),
|
||||
wholeWord: this._storageService.getBoolean('editor.wholeWord', StorageScope.WORKSPACE, false),
|
||||
isRegex: this._storageService.getBoolean('editor.isRegex', StorageScope.WORKSPACE, false)
|
||||
}, false);
|
||||
|
||||
if (shouldRestartFind) {
|
||||
|
@ -159,21 +159,21 @@ export class CommonFindController extends Disposable implements editorCommon.IEd
|
|||
|
||||
private saveQueryState(e: FindReplaceStateChangedEvent) {
|
||||
if (e.isRegex) {
|
||||
this.storageService.store('editor.isRegex', this._state.actualIsRegex, StorageScope.WORKSPACE);
|
||||
this._storageService.store('editor.isRegex', this._state.actualIsRegex, StorageScope.WORKSPACE);
|
||||
}
|
||||
if (e.wholeWord) {
|
||||
this.storageService.store('editor.wholeWord', this._state.actualWholeWord, StorageScope.WORKSPACE);
|
||||
this._storageService.store('editor.wholeWord', this._state.actualWholeWord, StorageScope.WORKSPACE);
|
||||
}
|
||||
if (e.matchCase) {
|
||||
this.storageService.store('editor.matchCase', this._state.actualMatchCase, StorageScope.WORKSPACE);
|
||||
this._storageService.store('editor.matchCase', this._state.actualMatchCase, StorageScope.WORKSPACE);
|
||||
}
|
||||
}
|
||||
|
||||
private loadQueryState() {
|
||||
this._state.change({
|
||||
matchCase: this.storageService.getBoolean('editor.matchCase', StorageScope.WORKSPACE, this._state.matchCase),
|
||||
wholeWord: this.storageService.getBoolean('editor.wholeWord', StorageScope.WORKSPACE, this._state.wholeWord),
|
||||
isRegex: this.storageService.getBoolean('editor.isRegex', StorageScope.WORKSPACE, this._state.isRegex)
|
||||
matchCase: this._storageService.getBoolean('editor.matchCase', StorageScope.WORKSPACE, this._state.matchCase),
|
||||
wholeWord: this._storageService.getBoolean('editor.wholeWord', StorageScope.WORKSPACE, this._state.wholeWord),
|
||||
isRegex: this._storageService.getBoolean('editor.isRegex', StorageScope.WORKSPACE, this._state.isRegex)
|
||||
}, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ export abstract class ReferencesController implements editorCommon.IEditorContri
|
|||
@ICodeEditorService private readonly _editorService: ICodeEditorService,
|
||||
@INotificationService private readonly _notificationService: INotificationService,
|
||||
@IInstantiationService private readonly _instantiationService: IInstantiationService,
|
||||
@IStorageService private readonly storageService: IStorageService,
|
||||
@IStorageService private readonly _storageService: IStorageService,
|
||||
@IConfigurationService private readonly _configurationService: IConfigurationService,
|
||||
) {
|
||||
this._editor = editor;
|
||||
|
@ -95,14 +95,14 @@ export abstract class ReferencesController implements editorCommon.IEditorContri
|
|||
}
|
||||
}));
|
||||
const storageKey = 'peekViewLayout';
|
||||
const data = <LayoutData>JSON.parse(this.storageService.get(storageKey, StorageScope.GLOBAL, '{}'));
|
||||
const data = <LayoutData>JSON.parse(this._storageService.get(storageKey, StorageScope.GLOBAL, '{}'));
|
||||
this._widget = this._instantiationService.createInstance(ReferenceWidget, this._editor, this._defaultTreeKeyboardSupport, data);
|
||||
this._widget.setTitle(nls.localize('labelLoading', "Loading..."));
|
||||
this._widget.show(range);
|
||||
this._disposables.push(this._widget.onDidClose(() => {
|
||||
modelPromise.cancel();
|
||||
|
||||
this.storageService.store(storageKey, JSON.stringify(this._widget.layoutData), StorageScope.GLOBAL);
|
||||
this._storageService.store(storageKey, JSON.stringify(this._widget.layoutData), StorageScope.GLOBAL);
|
||||
this._widget = null;
|
||||
this.closeWidget();
|
||||
}));
|
||||
|
|
|
@ -205,7 +205,7 @@ export class SuggestMemories {
|
|||
|
||||
constructor(
|
||||
editor: ICodeEditor,
|
||||
@IStorageService private readonly storageService: IStorageService,
|
||||
@IStorageService private readonly _storageService: IStorageService,
|
||||
) {
|
||||
this._persistSoon = new RunOnceScheduler(() => this._flush(), 3000);
|
||||
this._setMode(editor.getConfiguration().contribInfo.suggestSelection);
|
||||
|
@ -224,7 +224,7 @@ export class SuggestMemories {
|
|||
this._strategy = mode === 'recentlyUsedByPrefix' ? new PrefixMemory() : mode === 'recentlyUsed' ? new LRUMemory() : new NoMemory();
|
||||
|
||||
try {
|
||||
const raw = this.storageService.get(`${this._storagePrefix}/${this._mode}`, StorageScope.WORKSPACE);
|
||||
const raw = this._storageService.get(`${this._storagePrefix}/${this._mode}`, StorageScope.WORKSPACE);
|
||||
if (raw) {
|
||||
this._strategy.fromJSON(JSON.parse(raw));
|
||||
}
|
||||
|
@ -244,6 +244,6 @@ export class SuggestMemories {
|
|||
|
||||
private _flush() {
|
||||
const raw = JSON.stringify(this._strategy);
|
||||
this.storageService.store(`${this._storagePrefix}/${this._mode}`, raw, StorageScope.WORKSPACE);
|
||||
this._storageService.store(`${this._storagePrefix}/${this._mode}`, raw, StorageScope.WORKSPACE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,6 +147,7 @@ export module StaticServices {
|
|||
export const storageService = define(IStorageService, () => NullStorageService);
|
||||
|
||||
export const logService = define(ILogService, () => new NullLogService());
|
||||
|
||||
}
|
||||
|
||||
export class DynamicStandaloneServices extends Disposable {
|
||||
|
|
|
@ -23,11 +23,11 @@ class IntegrityStorage {
|
|||
private static readonly KEY = 'integrityService';
|
||||
|
||||
private storageService: IStorageService;
|
||||
private _value: IStorageData;
|
||||
private value: IStorageData;
|
||||
|
||||
constructor(storageService: IStorageService) {
|
||||
this.storageService = storageService;
|
||||
this._value = this._read();
|
||||
this.value = this._read();
|
||||
}
|
||||
|
||||
private _read(): IStorageData {
|
||||
|
@ -42,19 +42,19 @@ class IntegrityStorage {
|
|||
}
|
||||
}
|
||||
|
||||
public get(): IStorageData {
|
||||
return this._value;
|
||||
get(): IStorageData {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public set(data: IStorageData): void {
|
||||
this._value = data;
|
||||
this.storageService.store(IntegrityStorage.KEY, JSON.stringify(this._value), StorageScope.GLOBAL);
|
||||
set(data: IStorageData): void {
|
||||
this.value = data;
|
||||
this.storageService.store(IntegrityStorage.KEY, JSON.stringify(this.value), StorageScope.GLOBAL);
|
||||
}
|
||||
}
|
||||
|
||||
export class IntegrityServiceImpl implements IIntegrityService {
|
||||
|
||||
public _serviceBrand: any;
|
||||
_serviceBrand: any;
|
||||
|
||||
private _storage: IntegrityStorage;
|
||||
private _isPurePromise: Thenable<IntegrityTestResult>;
|
||||
|
@ -101,7 +101,7 @@ export class IntegrityServiceImpl implements IIntegrityService {
|
|||
);
|
||||
}
|
||||
|
||||
public isPure(): Thenable<IntegrityTestResult> {
|
||||
isPure(): Thenable<IntegrityTestResult> {
|
||||
return this._isPurePromise;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ export interface ILifecycleService {
|
|||
/**
|
||||
* Will be true if the program was requested to quit.
|
||||
*/
|
||||
isQuitRequested: boolean;
|
||||
quitRequested: boolean;
|
||||
|
||||
/**
|
||||
* Due to the way we handle lifecycle with eventing, the general app.on('before-quit')
|
||||
|
@ -100,12 +100,14 @@ export class LifecycleService extends Disposable implements ILifecycleService {
|
|||
private static readonly QUIT_FROM_RESTART_MARKER = 'quit.from.restart'; // use a marker to find out if the session was restarted
|
||||
|
||||
private windowToCloseRequest: { [windowId: string]: boolean } = Object.create(null);
|
||||
private quitRequested = false;
|
||||
private pendingQuitPromise: TPromise<boolean>;
|
||||
private pendingQuitPromiseComplete: TValueCallback<boolean>;
|
||||
private oneTimeListenerTokenGenerator = 0;
|
||||
private windowCounter = 0;
|
||||
|
||||
private _quitRequested = false;
|
||||
get quitRequested(): boolean { return this._quitRequested; }
|
||||
|
||||
private _wasRestarted: boolean = false;
|
||||
get wasRestarted(): boolean { return this._wasRestarted; }
|
||||
|
||||
|
@ -138,10 +140,6 @@ export class LifecycleService extends Disposable implements ILifecycleService {
|
|||
}
|
||||
}
|
||||
|
||||
get isQuitRequested(): boolean {
|
||||
return !!this.quitRequested;
|
||||
}
|
||||
|
||||
ready(): void {
|
||||
this.registerListeners();
|
||||
}
|
||||
|
@ -152,12 +150,12 @@ export class LifecycleService extends Disposable implements ILifecycleService {
|
|||
app.on('before-quit', e => {
|
||||
this.logService.trace('Lifecycle#before-quit');
|
||||
|
||||
if (this.quitRequested) {
|
||||
if (this._quitRequested) {
|
||||
this.logService.trace('Lifecycle#before-quit - returning because quit was already requested');
|
||||
return;
|
||||
}
|
||||
|
||||
this.quitRequested = true;
|
||||
this._quitRequested = true;
|
||||
|
||||
// Emit event to indicate that we are about to shutdown
|
||||
this.logService.trace('Lifecycle#onBeforeShutdown.fire()');
|
||||
|
@ -177,7 +175,7 @@ export class LifecycleService extends Disposable implements ILifecycleService {
|
|||
|
||||
// Windows/Linux: we quit when all windows have closed
|
||||
// Mac: we only quit when quit was requested
|
||||
if (this.quitRequested || process.platform !== 'darwin') {
|
||||
if (this._quitRequested || process.platform !== 'darwin') {
|
||||
app.quit();
|
||||
}
|
||||
});
|
||||
|
@ -213,7 +211,7 @@ export class LifecycleService extends Disposable implements ILifecycleService {
|
|||
|
||||
window.close();
|
||||
} else {
|
||||
this.quitRequested = false;
|
||||
this._quitRequested = false;
|
||||
delete this.windowToCloseRequest[windowId];
|
||||
}
|
||||
});
|
||||
|
@ -230,7 +228,7 @@ export class LifecycleService extends Disposable implements ILifecycleService {
|
|||
// if there are no more code windows opened, fire the onShutdown event, unless
|
||||
// we are on macOS where it is perfectly fine to close the last window and
|
||||
// the application continues running (unless quit was actually requested)
|
||||
if (this.windowCounter === 0 && (!isMacintosh || this.isQuitRequested)) {
|
||||
if (this.windowCounter === 0 && (!isMacintosh || this._quitRequested)) {
|
||||
this.logService.trace('Lifecycle#onShutdown.fire()');
|
||||
this._onShutdown.fire();
|
||||
}
|
||||
|
@ -246,7 +244,7 @@ export class LifecycleService extends Disposable implements ILifecycleService {
|
|||
|
||||
this.logService.trace('Lifecycle#unload()', window.id);
|
||||
|
||||
const windowUnloadReason = this.quitRequested ? UnloadReason.QUIT : reason;
|
||||
const windowUnloadReason = this._quitRequested ? UnloadReason.QUIT : reason;
|
||||
|
||||
// first ask the window itself if it vetos the unload
|
||||
return this.onBeforeUnloadWindowInRenderer(window, windowUnloadReason).then(veto => {
|
||||
|
|
|
@ -32,15 +32,19 @@ export function resolveWorkbenchCommonProperties(storageService: IStorageService
|
|||
}
|
||||
|
||||
function getOrCreateInstanceId(storageService: IStorageService): string {
|
||||
const result = storageService.get('telemetry.instanceId', StorageScope.GLOBAL, uuid.generateUuid());
|
||||
storageService.store('telemetry.instanceId', result, StorageScope.GLOBAL);
|
||||
const key = 'telemetry.instanceId';
|
||||
|
||||
const result = storageService.get(key, StorageScope.GLOBAL, uuid.generateUuid());
|
||||
storageService.store(key, result, StorageScope.GLOBAL);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function getOrCreateFirstSessionDate(storageService: IStorageService): string {
|
||||
const firstSessionDate = storageService.get('telemetry.firstSessionDate', StorageScope.GLOBAL, new Date().toUTCString());
|
||||
storageService.store('telemetry.firstSessionDate', firstSessionDate, StorageScope.GLOBAL);
|
||||
const key = 'telemetry.firstSessionDate';
|
||||
|
||||
const firstSessionDate = storageService.get(key, StorageScope.GLOBAL, new Date().toUTCString());
|
||||
storageService.store(key, firstSessionDate, StorageScope.GLOBAL);
|
||||
|
||||
return firstSessionDate;
|
||||
}
|
|
@ -11,20 +11,20 @@ import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostC
|
|||
@extHostNamedCustomer(MainContext.MainThreadStorage)
|
||||
export class MainThreadStorage implements MainThreadStorageShape {
|
||||
|
||||
private storageService: IStorageService;
|
||||
private _storageService: IStorageService;
|
||||
|
||||
constructor(
|
||||
extHostContext: IExtHostContext,
|
||||
@IStorageService storageService: IStorageService
|
||||
) {
|
||||
this.storageService = storageService;
|
||||
this._storageService = storageService;
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
}
|
||||
|
||||
$getValue<T>(shared: boolean, key: string): Thenable<T> {
|
||||
let jsonValue = this.storageService.get(key, shared ? StorageScope.GLOBAL : StorageScope.WORKSPACE);
|
||||
let jsonValue = this._storageService.get(key, shared ? StorageScope.GLOBAL : StorageScope.WORKSPACE);
|
||||
if (!jsonValue) {
|
||||
return TPromise.as(undefined);
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ export class MainThreadStorage implements MainThreadStorageShape {
|
|||
let jsonValue: any;
|
||||
try {
|
||||
jsonValue = JSON.stringify(value);
|
||||
this.storageService.store(key, jsonValue, shared ? StorageScope.GLOBAL : StorageScope.WORKSPACE);
|
||||
this._storageService.store(key, jsonValue, shared ? StorageScope.GLOBAL : StorageScope.WORKSPACE);
|
||||
} catch (err) {
|
||||
return TPromise.wrapError(err);
|
||||
}
|
||||
|
|
|
@ -160,9 +160,11 @@ export abstract class BaseEditor extends Panel implements IEditor {
|
|||
// Save all editor memento for this editor type
|
||||
BaseEditor.EDITOR_MEMENTOS.forEach(editorMemento => {
|
||||
if (editorMemento.id === this.getId()) {
|
||||
editorMemento.save();
|
||||
editorMemento.saveState();
|
||||
}
|
||||
});
|
||||
|
||||
super.saveState();
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
|
@ -193,9 +195,9 @@ export class EditorMemento<T> implements IEditorMemento<T> {
|
|||
return this._id;
|
||||
}
|
||||
|
||||
saveState(group: IEditorGroup, resource: URI, state: T): void;
|
||||
saveState(group: IEditorGroup, editor: EditorInput, state: T): void;
|
||||
saveState(group: IEditorGroup, resourceOrEditor: URI | EditorInput, state: T): void {
|
||||
saveEditorState(group: IEditorGroup, resource: URI, state: T): void;
|
||||
saveEditorState(group: IEditorGroup, editor: EditorInput, state: T): void;
|
||||
saveEditorState(group: IEditorGroup, resourceOrEditor: URI | EditorInput, state: T): void {
|
||||
const resource = this.doGetResource(resourceOrEditor);
|
||||
if (!resource || !group) {
|
||||
return; // we are not in a good state to save any state for a resource
|
||||
|
@ -214,14 +216,14 @@ export class EditorMemento<T> implements IEditorMemento<T> {
|
|||
// Automatically clear when editor input gets disposed if any
|
||||
if (resourceOrEditor instanceof EditorInput) {
|
||||
once(resourceOrEditor.onDispose)(() => {
|
||||
this.clearState(resource);
|
||||
this.clearEditorState(resource);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
loadState(group: IEditorGroup, resource: URI): T;
|
||||
loadState(group: IEditorGroup, editor: EditorInput): T;
|
||||
loadState(group: IEditorGroup, resourceOrEditor: URI | EditorInput): T {
|
||||
loadEditorState(group: IEditorGroup, resource: URI): T;
|
||||
loadEditorState(group: IEditorGroup, editor: EditorInput): T;
|
||||
loadEditorState(group: IEditorGroup, resourceOrEditor: URI | EditorInput): T {
|
||||
const resource = this.doGetResource(resourceOrEditor);
|
||||
if (!resource || !group) {
|
||||
return void 0; // we are not in a good state to load any state for a resource
|
||||
|
@ -237,9 +239,9 @@ export class EditorMemento<T> implements IEditorMemento<T> {
|
|||
return void 0;
|
||||
}
|
||||
|
||||
clearState(resource: URI, group?: IEditorGroup): void;
|
||||
clearState(editor: EditorInput, group?: IEditorGroup): void;
|
||||
clearState(resourceOrEditor: URI | EditorInput, group?: IEditorGroup): void {
|
||||
clearEditorState(resource: URI, group?: IEditorGroup): void;
|
||||
clearEditorState(editor: EditorInput, group?: IEditorGroup): void;
|
||||
clearEditorState(resourceOrEditor: URI | EditorInput, group?: IEditorGroup): void {
|
||||
const resource = this.doGetResource(resourceOrEditor);
|
||||
if (resource) {
|
||||
const cache = this.doLoad();
|
||||
|
@ -277,7 +279,7 @@ export class EditorMemento<T> implements IEditorMemento<T> {
|
|||
return this.cache;
|
||||
}
|
||||
|
||||
save(): void {
|
||||
saveState(): void {
|
||||
const cache = this.doLoad();
|
||||
|
||||
// Cleanup once during shutdown
|
||||
|
|
|
@ -233,7 +233,7 @@ export abstract class BaseTextEditor extends BaseEditor implements ITextEditor {
|
|||
return;
|
||||
}
|
||||
|
||||
this.editorMemento.saveState(this.group, resource, editorViewState);
|
||||
this.editorMemento.saveEditorState(this.group, resource, editorViewState);
|
||||
}
|
||||
|
||||
protected retrieveTextEditorViewState(resource: URI): IEditorViewState {
|
||||
|
@ -260,7 +260,7 @@ export abstract class BaseTextEditor extends BaseEditor implements ITextEditor {
|
|||
*/
|
||||
protected clearTextEditorViewState(resources: URI[], group?: IEditorGroup): void {
|
||||
resources.forEach(resource => {
|
||||
this.editorMemento.clearState(resource, group);
|
||||
this.editorMemento.clearEditorState(resource, group);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -268,7 +268,7 @@ export abstract class BaseTextEditor extends BaseEditor implements ITextEditor {
|
|||
* Loads the text editor view state for the given resource and returns it.
|
||||
*/
|
||||
protected loadTextEditorViewState(resource: URI): IEditorViewState {
|
||||
return this.editorMemento.loadState(this.group, resource);
|
||||
return this.editorMemento.loadEditorState(this.group, resource);
|
||||
}
|
||||
|
||||
private updateEditorConfiguration(configuration = this.configurationService.getValue<IEditorConfiguration>(this.getResource())): void {
|
||||
|
|
|
@ -434,7 +434,7 @@ export class PersistentContributableViewsModel extends ContributableViewsModel {
|
|||
this._register(this.storageService.onWillClose(() => this.saveViewsStates()));
|
||||
}
|
||||
|
||||
saveViewsStates(): void {
|
||||
private saveViewsStates(): void {
|
||||
const storedViewsStates: { [id: string]: { collapsed: boolean, size: number, order: number } } = {};
|
||||
for (const viewDescriptor of this.viewDescriptors) {
|
||||
const viewState = this.viewStates.get(viewDescriptor.id);
|
||||
|
|
|
@ -1005,14 +1005,14 @@ export const enum CloseDirection {
|
|||
|
||||
export interface IEditorMemento<T> {
|
||||
|
||||
saveState(group: IEditorGroup, resource: URI, state: T): void;
|
||||
saveState(group: IEditorGroup, editor: EditorInput, state: T): void;
|
||||
saveEditorState(group: IEditorGroup, resource: URI, state: T): void;
|
||||
saveEditorState(group: IEditorGroup, editor: EditorInput, state: T): void;
|
||||
|
||||
loadState(group: IEditorGroup, resource: URI): T;
|
||||
loadState(group: IEditorGroup, editor: EditorInput): T;
|
||||
loadEditorState(group: IEditorGroup, resource: URI): T;
|
||||
loadEditorState(group: IEditorGroup, editor: EditorInput): T;
|
||||
|
||||
clearState(resource: URI, group?: IEditorGroup): void;
|
||||
clearState(editor: EditorInput, group?: IEditorGroup): void;
|
||||
clearEditorState(resource: URI, group?: IEditorGroup): void;
|
||||
clearEditorState(editor: EditorInput, group?: IEditorGroup): void;
|
||||
}
|
||||
|
||||
class EditorInputFactoryRegistry implements IEditorInputFactoryRegistry {
|
||||
|
|
|
@ -26,11 +26,11 @@ export class LargeFileOptimizationsWarner extends Disposable implements IEditorC
|
|||
private readonly _editor: ICodeEditor,
|
||||
@INotificationService private readonly _notificationService: INotificationService,
|
||||
@IConfigurationService private readonly _configurationService: IConfigurationService,
|
||||
@IStorageService private readonly storageService: IStorageService,
|
||||
@IStorageService private readonly _storageService: IStorageService,
|
||||
) {
|
||||
super();
|
||||
|
||||
this._isDisabled = this.storageService.getBoolean('editor.neverPromptForLargeFiles', StorageScope.GLOBAL, false);
|
||||
this._isDisabled = this._storageService.getBoolean('editor.neverPromptForLargeFiles', StorageScope.GLOBAL, false);
|
||||
|
||||
this._register(this._editor.onDidChangeModel((e) => {
|
||||
const model = this._editor.getModel();
|
||||
|
@ -58,7 +58,7 @@ export class LargeFileOptimizationsWarner extends Disposable implements IEditorC
|
|||
label: nls.localize('neverShowAgain', "OK. Never show again"),
|
||||
run: () => {
|
||||
this._isDisabled = true;
|
||||
this.storageService.store('editor.neverPromptForLargeFiles', true, StorageScope.GLOBAL);
|
||||
this._storageService.store('editor.neverPromptForLargeFiles', true, StorageScope.GLOBAL);
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -17,6 +17,7 @@ import { IDebugConfiguration, IDebugService, State } from 'vs/workbench/parts/de
|
|||
import { AbstractDebugAction, PauseAction, ContinueAction, StepBackAction, ReverseContinueAction, StopAction, DisconnectAction, StepOverAction, StepIntoAction, StepOutAction, RestartAction, FocusSessionAction } from 'vs/workbench/parts/debug/browser/debugActions';
|
||||
import { FocusSessionActionItem } from 'vs/workbench/parts/debug/browser/debugActionItems';
|
||||
import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration';
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { Themable } from 'vs/workbench/common/theme';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
|
@ -29,7 +30,6 @@ import { RunOnceScheduler } from 'vs/base/common/async';
|
|||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { isExtensionHostDebugging } from 'vs/workbench/parts/debug/common/debugUtils';
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
|
||||
const DEBUG_TOOLBAR_POSITION_KEY = 'debug.actionswidgetposition';
|
||||
const DEBUG_TOOLBAR_Y_KEY = 'debug.actionswidgety';
|
||||
|
|
|
@ -125,17 +125,6 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati
|
|||
}));
|
||||
}
|
||||
|
||||
protected saveState(): void {
|
||||
const replHistory = this.history.getHistory();
|
||||
if (replHistory.length) {
|
||||
this.storageService.store(HISTORY_STORAGE_KEY, JSON.stringify(replHistory), StorageScope.WORKSPACE);
|
||||
} else {
|
||||
this.storageService.remove(HISTORY_STORAGE_KEY, StorageScope.WORKSPACE);
|
||||
}
|
||||
|
||||
super.saveState();
|
||||
}
|
||||
|
||||
setVisible(visible: boolean): Promise<void> {
|
||||
if (!visible) {
|
||||
dispose(this.model);
|
||||
|
@ -413,6 +402,17 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati
|
|||
this.replInput.setDecorations(DECORATION_KEY, decorations);
|
||||
}
|
||||
|
||||
protected saveState(): void {
|
||||
const replHistory = this.history.getHistory();
|
||||
if (replHistory.length) {
|
||||
this.storageService.store(HISTORY_STORAGE_KEY, JSON.stringify(replHistory), StorageScope.WORKSPACE);
|
||||
} else {
|
||||
this.storageService.remove(HISTORY_STORAGE_KEY, StorageScope.WORKSPACE);
|
||||
}
|
||||
|
||||
super.saveState();
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
this.replInput.dispose();
|
||||
if (this.replElementsChangeListener) {
|
||||
|
|
|
@ -54,12 +54,12 @@ export class HtmlPreviewPart extends BaseWebviewEditor {
|
|||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IOpenerService private readonly _openerService: IOpenerService,
|
||||
@IPartService private readonly _partService: IPartService,
|
||||
@IStorageService readonly storageService: IStorageService,
|
||||
@IStorageService readonly _storageService: IStorageService,
|
||||
@ITextModelService private readonly _textModelResolverService: ITextModelService,
|
||||
@IInstantiationService private readonly _instantiationService: IInstantiationService,
|
||||
@IEditorGroupsService readonly editorGroupService: IEditorGroupsService
|
||||
) {
|
||||
super(HtmlPreviewPart.ID, telemetryService, themeService, contextKeyService, storageService);
|
||||
super(HtmlPreviewPart.ID, telemetryService, themeService, contextKeyService, _storageService);
|
||||
|
||||
this.editorMemento = this.getEditorMemento<HtmlPreviewEditorViewState>(editorGroupService, this.viewStateStorageKey);
|
||||
}
|
||||
|
@ -243,10 +243,10 @@ export class HtmlPreviewPart extends BaseWebviewEditor {
|
|||
}
|
||||
|
||||
private saveHTMLPreviewViewState(input: HtmlInput, editorViewState: HtmlPreviewEditorViewState): void {
|
||||
this.editorMemento.saveState(this.group, input, editorViewState);
|
||||
this.editorMemento.saveEditorState(this.group, input, editorViewState);
|
||||
}
|
||||
|
||||
private loadHTMLPreviewViewState(input: HtmlInput): HtmlPreviewEditorViewState {
|
||||
return this.editorMemento.loadState(this.group, input);
|
||||
return this.editorMemento.loadEditorState(this.group, input);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -251,7 +251,7 @@ export class OutlinePanel extends ViewletPanel {
|
|||
options: IViewletViewOptions,
|
||||
@IInstantiationService private readonly _instantiationService: IInstantiationService,
|
||||
@IThemeService private readonly _themeService: IThemeService,
|
||||
@IStorageService private readonly storageService: IStorageService,
|
||||
@IStorageService private readonly _storageService: IStorageService,
|
||||
@IEditorService private readonly _editorService: IEditorService,
|
||||
@IMarkerService private readonly _markerService: IMarkerService,
|
||||
@IConfigurationService private readonly _configurationService: IConfigurationService,
|
||||
|
@ -261,7 +261,7 @@ export class OutlinePanel extends ViewletPanel {
|
|||
@IContextMenuService contextMenuService: IContextMenuService,
|
||||
) {
|
||||
super(options, _keybindingService, contextMenuService, configurationService);
|
||||
this._outlineViewState.restore(this.storageService);
|
||||
this._outlineViewState.restore(this._storageService);
|
||||
this._contextKeyFocused = OutlineViewFocused.bindTo(contextKeyService);
|
||||
this._contextKeyFiltered = OutlineViewFiltered.bindTo(contextKeyService);
|
||||
this._disposables.push(this.onDidFocus(_ => this._contextKeyFocused.set(true)));
|
||||
|
@ -436,7 +436,7 @@ export class OutlinePanel extends ViewletPanel {
|
|||
}
|
||||
|
||||
private _onDidChangeUserState(e: { followCursor?: boolean, sortBy?: boolean, filterOnType?: boolean }) {
|
||||
this._outlineViewState.persist(this.storageService);
|
||||
this._outlineViewState.persist(this._storageService);
|
||||
if (e.followCursor) {
|
||||
// todo@joh update immediately
|
||||
}
|
||||
|
|
|
@ -474,12 +474,6 @@ export class OutputService extends Disposable implements IOutputService, ITextMo
|
|||
this._register(this.storageService.onWillClose(() => this.saveState()));
|
||||
}
|
||||
|
||||
private saveState(): void {
|
||||
if (this.activeChannel) {
|
||||
this.storageService.store(OUTPUT_ACTIVE_CHANNEL_KEY, this.activeChannel.id, StorageScope.WORKSPACE);
|
||||
}
|
||||
}
|
||||
|
||||
provideTextContent(resource: URI): TPromise<ITextModel> {
|
||||
const channel = <OutputChannel>this.getChannel(resource.path);
|
||||
if (channel) {
|
||||
|
@ -639,6 +633,12 @@ export class OutputService extends Disposable implements IOutputService, ITextMo
|
|||
const resource = URI.from({ scheme: OUTPUT_SCHEME, path: channel.id });
|
||||
return this.instantiationService.createInstance(ResourceEditorInput, nls.localize('output', "{0} - Output", channel.label), nls.localize('channel', "Output channel for '{0}'", channel.label), resource);
|
||||
}
|
||||
|
||||
private saveState(): void {
|
||||
if (this.activeChannel) {
|
||||
this.storageService.store(OUTPUT_ACTIVE_CHANNEL_KEY, this.activeChannel.id, StorageScope.WORKSPACE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class LogContentProvider {
|
||||
|
|
|
@ -222,7 +222,7 @@ export class SettingsEditor2 extends BaseEditor {
|
|||
}
|
||||
|
||||
private restoreCachedState(): void {
|
||||
const cachedState = this.editorMemento.loadState(this.group, this.input);
|
||||
const cachedState = this.editorMemento.loadEditorState(this.group, this.input);
|
||||
if (cachedState && typeof cachedState.target === 'object') {
|
||||
cachedState.target = URI.revive(cachedState.target);
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ export class SettingsEditor2 extends BaseEditor {
|
|||
|
||||
clearInput(): void {
|
||||
this.inSettingsEditorContextKey.set(false);
|
||||
this.editorMemento.clearState(this.input, this.group);
|
||||
this.editorMemento.clearEditorState(this.input, this.group);
|
||||
super.clearInput();
|
||||
}
|
||||
|
||||
|
@ -920,7 +920,7 @@ export class SettingsEditor2 extends BaseEditor {
|
|||
this.settingsTreeModel.update(resolvedSettingsRoot);
|
||||
|
||||
// Make sure that all extensions' settings are included in search results
|
||||
const cachedState = this.editorMemento.loadState(this.group, this.input);
|
||||
const cachedState = this.editorMemento.loadEditorState(this.group, this.input);
|
||||
if (cachedState && cachedState.searchQuery) {
|
||||
this.triggerSearch(cachedState.searchQuery);
|
||||
} else {
|
||||
|
@ -1295,7 +1295,7 @@ export class SettingsEditor2 extends BaseEditor {
|
|||
if (this.isVisible()) {
|
||||
const searchQuery = this.searchWidget.getValue().trim();
|
||||
const target = this.settingsTargetsWidget.settingsTarget as SettingsTarget;
|
||||
this.editorMemento.saveState(this.group, this.input, { searchQuery, target });
|
||||
this.editorMemento.saveEditorState(this.group, this.input, { searchQuery, target });
|
||||
}
|
||||
|
||||
super.saveState();
|
||||
|
|
|
@ -33,6 +33,7 @@ import { ActionBar, IActionItemProvider, Separator, ActionItem } from 'vs/base/b
|
|||
import { IThemeService, LIGHT } from 'vs/platform/theme/common/themeService';
|
||||
import { isSCMResource, getSCMResourceContextKey } from './scmUtil';
|
||||
import { attachBadgeStyler, attachInputBoxStyler } from 'vs/platform/theme/common/styler';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { InputBox, MessageType } from 'vs/base/browser/ui/inputbox/inputBox';
|
||||
import { Command } from 'vs/editor/common/modes';
|
||||
import { renderOcticons } from 'vs/base/browser/ui/octiconLabel/octiconLabel';
|
||||
|
@ -49,7 +50,6 @@ import { IViewDescriptorRef, PersistentContributableViewsModel, IAddedViewDescri
|
|||
import { IViewDescriptor, IViewsViewlet, IView } from 'vs/workbench/common/views';
|
||||
import { IPanelDndController, Panel } from 'vs/base/browser/ui/splitview/panelview';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
|
||||
export interface ISpliceEvent<T> {
|
||||
index: number;
|
||||
|
@ -1055,8 +1055,8 @@ export class SCMViewlet extends PanelViewlet implements IViewModel, IViewsViewle
|
|||
@IContextMenuService protected contextMenuService: IContextMenuService,
|
||||
@IThemeService protected themeService: IThemeService,
|
||||
@ICommandService protected commandService: ICommandService,
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
@IStorageService storageService: IStorageService
|
||||
@IStorageService storageService: IStorageService,
|
||||
@IConfigurationService configurationService: IConfigurationService
|
||||
) {
|
||||
super(VIEWLET_ID, { showHeaderInTitleWhenSingleView: true, dnd: new SCMPanelDndController() }, configurationService, partService, contextMenuService, telemetryService, themeService, storageService);
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ class PartsSplash {
|
|||
constructor(
|
||||
@IThemeService private readonly _themeService: IThemeService,
|
||||
@IPartService private readonly _partService: IPartService,
|
||||
@IStorageService private readonly storageService: IStorageService,
|
||||
@IStorageService private readonly _storageService: IStorageService,
|
||||
@IEnvironmentService private readonly _envService: IEnvironmentService,
|
||||
@ILifecycleService lifecycleService: ILifecycleService,
|
||||
@IBroadcastService private broadcastService: IBroadcastService
|
||||
|
@ -67,7 +67,7 @@ class PartsSplash {
|
|||
sideBarWidth: getTotalWidth(this._partService.getContainer(Parts.SIDEBAR_PART)),
|
||||
statusBarHeight: getTotalHeight(this._partService.getContainer(Parts.STATUSBAR_PART)),
|
||||
};
|
||||
this.storageService.store('parts-splash-data', JSON.stringify({
|
||||
this._storageService.store('parts-splash-data', JSON.stringify({
|
||||
id: PartsSplash._splashElementId,
|
||||
colorInfo,
|
||||
layoutInfo,
|
||||
|
|
|
@ -57,7 +57,7 @@ export abstract class TerminalService implements ITerminalService {
|
|||
@IPanelService protected readonly _panelService: IPanelService,
|
||||
@IPartService private readonly _partService: IPartService,
|
||||
@ILifecycleService lifecycleService: ILifecycleService,
|
||||
@IStorageService protected readonly storageService: IStorageService
|
||||
@IStorageService protected readonly _storageService: IStorageService
|
||||
) {
|
||||
this._activeTabIndex = 0;
|
||||
this._isShuttingDown = false;
|
||||
|
|
|
@ -34,7 +34,7 @@ export class TerminalConfigHelper implements ITerminalConfigHelper {
|
|||
@IConfigurationService private readonly _configurationService: IConfigurationService,
|
||||
@IWorkspaceConfigurationService private readonly _workspaceConfigurationService: IWorkspaceConfigurationService,
|
||||
@INotificationService private readonly _notificationService: INotificationService,
|
||||
@IStorageService private readonly storageService: IStorageService
|
||||
@IStorageService private readonly _storageService: IStorageService
|
||||
) {
|
||||
this._updateConfig();
|
||||
this._configurationService.onDidChangeConfiguration(e => {
|
||||
|
@ -160,7 +160,7 @@ export class TerminalConfigHelper implements ITerminalConfigHelper {
|
|||
}
|
||||
|
||||
public setWorkspaceShellAllowed(isAllowed: boolean): void {
|
||||
this.storageService.store(IS_WORKSPACE_SHELL_ALLOWED_STORAGE_KEY, isAllowed, StorageScope.WORKSPACE);
|
||||
this._storageService.store(IS_WORKSPACE_SHELL_ALLOWED_STORAGE_KEY, isAllowed, StorageScope.WORKSPACE);
|
||||
}
|
||||
|
||||
public mergeDefaultShellPathAndArgs(shell: IShellLaunchConfig, platformOverride: platform.Platform = platform.platform): void {
|
||||
|
@ -172,7 +172,7 @@ export class TerminalConfigHelper implements ITerminalConfigHelper {
|
|||
// Check if workspace setting exists and whether it's whitelisted
|
||||
let isWorkspaceShellAllowed = false;
|
||||
if (shellConfigValue.workspace !== undefined || shellArgsConfigValue.workspace !== undefined) {
|
||||
isWorkspaceShellAllowed = this.storageService.getBoolean(IS_WORKSPACE_SHELL_ALLOWED_STORAGE_KEY, StorageScope.WORKSPACE, undefined);
|
||||
isWorkspaceShellAllowed = this._storageService.getBoolean(IS_WORKSPACE_SHELL_ALLOWED_STORAGE_KEY, StorageScope.WORKSPACE, undefined);
|
||||
}
|
||||
|
||||
// Always allow [] args as it would lead to an odd error message and should not be dangerous
|
||||
|
@ -205,11 +205,11 @@ export class TerminalConfigHelper implements ITerminalConfigHelper {
|
|||
this._notificationService.prompt(Severity.Info, nls.localize('terminal.integrated.allowWorkspaceShell', "Do you allow {0} (defined as a workspace setting) to be launched in the terminal?", changeString),
|
||||
[{
|
||||
label: nls.localize('allow', "Allow"),
|
||||
run: () => this.storageService.store(IS_WORKSPACE_SHELL_ALLOWED_STORAGE_KEY, true, StorageScope.WORKSPACE)
|
||||
run: () => this._storageService.store(IS_WORKSPACE_SHELL_ALLOWED_STORAGE_KEY, true, StorageScope.WORKSPACE)
|
||||
},
|
||||
{
|
||||
label: nls.localize('disallow', "Disallow"),
|
||||
run: () => this.storageService.store(IS_WORKSPACE_SHELL_ALLOWED_STORAGE_KEY, false, StorageScope.WORKSPACE)
|
||||
run: () => this._storageService.store(IS_WORKSPACE_SHELL_ALLOWED_STORAGE_KEY, false, StorageScope.WORKSPACE)
|
||||
}]
|
||||
);
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ export class TerminalInstance implements ITerminalInstance {
|
|||
@IThemeService private readonly _themeService: IThemeService,
|
||||
@IConfigurationService private readonly _configurationService: IConfigurationService,
|
||||
@ILogService private _logService: ILogService,
|
||||
@IStorageService private readonly storageService: IStorageService
|
||||
@IStorageService private readonly _storageService: IStorageService
|
||||
) {
|
||||
this._disposables = [];
|
||||
this._skipTerminalCommands = [];
|
||||
|
@ -471,7 +471,7 @@ export class TerminalInstance implements ITerminalInstance {
|
|||
this._attachPressAnyKeyToCloseListener();
|
||||
}
|
||||
|
||||
const neverMeasureRenderTime = this.storageService.getBoolean(NEVER_MEASURE_RENDER_TIME_STORAGE_KEY, StorageScope.GLOBAL, false);
|
||||
const neverMeasureRenderTime = this._storageService.getBoolean(NEVER_MEASURE_RENDER_TIME_STORAGE_KEY, StorageScope.GLOBAL, false);
|
||||
if (!neverMeasureRenderTime && this._configHelper.config.rendererType === 'auto') {
|
||||
this._measureRenderTime();
|
||||
}
|
||||
|
@ -505,7 +505,7 @@ export class TerminalInstance implements ITerminalInstance {
|
|||
{
|
||||
label: nls.localize('dontShowAgain', "Don't Show Again"),
|
||||
isSecondary: true,
|
||||
run: () => this.storageService.store(NEVER_MEASURE_RENDER_TIME_STORAGE_KEY, true, StorageScope.GLOBAL)
|
||||
run: () => this._storageService.store(NEVER_MEASURE_RENDER_TIME_STORAGE_KEY, true, StorageScope.GLOBAL)
|
||||
} as IPromptChoice
|
||||
];
|
||||
this._notificationService.prompt(
|
||||
|
|
|
@ -154,14 +154,14 @@ export class TerminalService extends AbstractTerminalService implements ITermina
|
|||
}
|
||||
|
||||
// Don't suggest if the user has explicitly opted out
|
||||
const neverSuggest = this.storageService.getBoolean(NEVER_SUGGEST_SELECT_WINDOWS_SHELL_STORAGE_KEY, StorageScope.GLOBAL, false);
|
||||
const neverSuggest = this._storageService.getBoolean(NEVER_SUGGEST_SELECT_WINDOWS_SHELL_STORAGE_KEY, StorageScope.GLOBAL, false);
|
||||
if (neverSuggest) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Never suggest if the setting is non-default already (ie. they set the setting manually)
|
||||
if (this._configHelper.config.shell.windows !== getDefaultShell(platform.Platform.Windows)) {
|
||||
this.storageService.store(NEVER_SUGGEST_SELECT_WINDOWS_SHELL_STORAGE_KEY, true, StorageScope.GLOBAL);
|
||||
this._storageService.store(NEVER_SUGGEST_SELECT_WINDOWS_SHELL_STORAGE_KEY, true, StorageScope.GLOBAL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -190,7 +190,7 @@ export class TerminalService extends AbstractTerminalService implements ITermina
|
|||
{
|
||||
label: nls.localize('never again', "Don't Show Again"),
|
||||
isSecondary: true,
|
||||
run: () => this.storageService.store(NEVER_SUGGEST_SELECT_WINDOWS_SHELL_STORAGE_KEY, true, StorageScope.GLOBAL)
|
||||
run: () => this._storageService.store(NEVER_SUGGEST_SELECT_WINDOWS_SHELL_STORAGE_KEY, true, StorageScope.GLOBAL)
|
||||
}]
|
||||
);
|
||||
}
|
||||
|
|
|
@ -477,7 +477,7 @@ export class WalkThroughPart extends BaseEditor {
|
|||
private saveTextEditorViewState(input: WalkThroughInput): void {
|
||||
const scrollPosition = this.scrollbar.getScrollPosition();
|
||||
|
||||
this.editorMemento.saveState(this.group, input, {
|
||||
this.editorMemento.saveEditorState(this.group, input, {
|
||||
viewState: {
|
||||
scrollTop: scrollPosition.scrollTop,
|
||||
scrollLeft: scrollPosition.scrollLeft
|
||||
|
@ -486,7 +486,7 @@ export class WalkThroughPart extends BaseEditor {
|
|||
}
|
||||
|
||||
private loadTextEditorViewState(input: WalkThroughInput) {
|
||||
const state = this.editorMemento.loadState(this.group, input);
|
||||
const state = this.editorMemento.loadEditorState(this.group, input);
|
||||
if (state) {
|
||||
this.scrollbar.setScrollPosition(state.viewState);
|
||||
}
|
||||
|
|
|
@ -290,7 +290,7 @@ export class ExtensionService extends Disposable implements IExtensionService {
|
|||
@IEnvironmentService private readonly _environmentService: IEnvironmentService,
|
||||
@ITelemetryService private readonly _telemetryService: ITelemetryService,
|
||||
@IExtensionEnablementService private readonly _extensionEnablementService: IExtensionEnablementService,
|
||||
@IStorageService private readonly storageService: IStorageService,
|
||||
@IStorageService private readonly _storageService: IStorageService,
|
||||
@IWindowService private readonly _windowService: IWindowService,
|
||||
@ILifecycleService lifecycleService: ILifecycleService,
|
||||
@IExtensionManagementService private extensionManagementService: IExtensionManagementService
|
||||
|
@ -686,7 +686,7 @@ export class ExtensionService extends Disposable implements IExtensionService {
|
|||
return TPromise.join(toDisable.map(e => this._extensionEnablementService.setEnablement(e, EnablementState.Disabled)));
|
||||
})
|
||||
.then(() => {
|
||||
this.storageService.store(BetterMergeDisabledNowKey, true, StorageScope.GLOBAL);
|
||||
this._storageService.store(BetterMergeDisabledNowKey, true, StorageScope.GLOBAL);
|
||||
return runtimeExtensions;
|
||||
});
|
||||
} else {
|
||||
|
|
|
@ -7,6 +7,7 @@ import * as nls from 'vs/nls';
|
|||
import * as types from 'vs/base/common/types';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { IWorkbenchThemeService, IColorTheme, ITokenColorCustomizations, IFileIconTheme, ExtensionData, VS_LIGHT_THEME, VS_DARK_THEME, VS_HC_THEME, COLOR_THEME_SETTING, ICON_THEME_SETTING, CUSTOM_WORKBENCH_COLORS_SETTING, CUSTOM_EDITOR_COLORS_SETTING, CUSTOM_EDITOR_SCOPE_COLORS_SETTING, DETECT_HC_SETTING, HC_THEME_ID } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import * as errors from 'vs/base/common/errors';
|
||||
|
@ -26,7 +27,6 @@ import { IWindowService } from 'vs/platform/windows/common/windows';
|
|||
import { removeClasses, addClasses } from 'vs/base/browser/dom';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
|
||||
// implementation
|
||||
|
||||
|
|
|
@ -206,54 +206,54 @@ suite('Workbench base editor', () => {
|
|||
const rawMemento = Object.create(null);
|
||||
let memento = new EditorMemento<TestViewState>('id', 'key', rawMemento, 3, editorGroupService);
|
||||
|
||||
let res = memento.loadState(testGroup0, URI.file('/A'));
|
||||
let res = memento.loadEditorState(testGroup0, URI.file('/A'));
|
||||
assert.ok(!res);
|
||||
|
||||
memento.saveState(testGroup0, URI.file('/A'), { line: 3 });
|
||||
res = memento.loadState(testGroup0, URI.file('/A'));
|
||||
memento.saveEditorState(testGroup0, URI.file('/A'), { line: 3 });
|
||||
res = memento.loadEditorState(testGroup0, URI.file('/A'));
|
||||
assert.ok(res);
|
||||
assert.equal(res.line, 3);
|
||||
|
||||
memento.saveState(testGroup1, URI.file('/A'), { line: 5 });
|
||||
res = memento.loadState(testGroup1, URI.file('/A'));
|
||||
memento.saveEditorState(testGroup1, URI.file('/A'), { line: 5 });
|
||||
res = memento.loadEditorState(testGroup1, URI.file('/A'));
|
||||
assert.ok(res);
|
||||
assert.equal(res.line, 5);
|
||||
|
||||
// Ensure capped at 3 elements
|
||||
memento.saveState(testGroup0, URI.file('/B'), { line: 1 });
|
||||
memento.saveState(testGroup0, URI.file('/C'), { line: 1 });
|
||||
memento.saveState(testGroup0, URI.file('/D'), { line: 1 });
|
||||
memento.saveState(testGroup0, URI.file('/E'), { line: 1 });
|
||||
memento.saveEditorState(testGroup0, URI.file('/B'), { line: 1 });
|
||||
memento.saveEditorState(testGroup0, URI.file('/C'), { line: 1 });
|
||||
memento.saveEditorState(testGroup0, URI.file('/D'), { line: 1 });
|
||||
memento.saveEditorState(testGroup0, URI.file('/E'), { line: 1 });
|
||||
|
||||
assert.ok(!memento.loadState(testGroup0, URI.file('/A')));
|
||||
assert.ok(!memento.loadState(testGroup0, URI.file('/B')));
|
||||
assert.ok(memento.loadState(testGroup0, URI.file('/C')));
|
||||
assert.ok(memento.loadState(testGroup0, URI.file('/D')));
|
||||
assert.ok(memento.loadState(testGroup0, URI.file('/E')));
|
||||
assert.ok(!memento.loadEditorState(testGroup0, URI.file('/A')));
|
||||
assert.ok(!memento.loadEditorState(testGroup0, URI.file('/B')));
|
||||
assert.ok(memento.loadEditorState(testGroup0, URI.file('/C')));
|
||||
assert.ok(memento.loadEditorState(testGroup0, URI.file('/D')));
|
||||
assert.ok(memento.loadEditorState(testGroup0, URI.file('/E')));
|
||||
|
||||
// Save at an unknown group
|
||||
memento.saveState(testGroup4, URI.file('/E'), { line: 1 });
|
||||
assert.ok(memento.loadState(testGroup4, URI.file('/E'))); // only gets removed when memento is saved
|
||||
memento.saveState(testGroup4, URI.file('/C'), { line: 1 });
|
||||
assert.ok(memento.loadState(testGroup4, URI.file('/C'))); // only gets removed when memento is saved
|
||||
memento.saveEditorState(testGroup4, URI.file('/E'), { line: 1 });
|
||||
assert.ok(memento.loadEditorState(testGroup4, URI.file('/E'))); // only gets removed when memento is saved
|
||||
memento.saveEditorState(testGroup4, URI.file('/C'), { line: 1 });
|
||||
assert.ok(memento.loadEditorState(testGroup4, URI.file('/C'))); // only gets removed when memento is saved
|
||||
|
||||
memento.save();
|
||||
memento.saveState();
|
||||
|
||||
memento = new EditorMemento('id', 'key', rawMemento, 3, editorGroupService);
|
||||
assert.ok(memento.loadState(testGroup0, URI.file('/C')));
|
||||
assert.ok(memento.loadState(testGroup0, URI.file('/D')));
|
||||
assert.ok(memento.loadState(testGroup0, URI.file('/E')));
|
||||
assert.ok(memento.loadEditorState(testGroup0, URI.file('/C')));
|
||||
assert.ok(memento.loadEditorState(testGroup0, URI.file('/D')));
|
||||
assert.ok(memento.loadEditorState(testGroup0, URI.file('/E')));
|
||||
|
||||
// Check on entries no longer there from invalid groups
|
||||
assert.ok(!memento.loadState(testGroup4, URI.file('/E')));
|
||||
assert.ok(!memento.loadState(testGroup4, URI.file('/C')));
|
||||
assert.ok(!memento.loadEditorState(testGroup4, URI.file('/E')));
|
||||
assert.ok(!memento.loadEditorState(testGroup4, URI.file('/C')));
|
||||
|
||||
memento.clearState(URI.file('/C'), testGroup4);
|
||||
memento.clearState(URI.file('/E'));
|
||||
memento.clearEditorState(URI.file('/C'), testGroup4);
|
||||
memento.clearEditorState(URI.file('/E'));
|
||||
|
||||
assert.ok(!memento.loadState(testGroup4, URI.file('/C')));
|
||||
assert.ok(memento.loadState(testGroup0, URI.file('/D')));
|
||||
assert.ok(!memento.loadState(testGroup0, URI.file('/E')));
|
||||
assert.ok(!memento.loadEditorState(testGroup4, URI.file('/C')));
|
||||
assert.ok(memento.loadEditorState(testGroup0, URI.file('/D')));
|
||||
assert.ok(!memento.loadEditorState(testGroup0, URI.file('/E')));
|
||||
});
|
||||
|
||||
test('EditoMemento - use with editor input', function () {
|
||||
|
@ -284,17 +284,17 @@ suite('Workbench base editor', () => {
|
|||
|
||||
const testInputA = new TestEditorInput(URI.file('/A'));
|
||||
|
||||
let res = memento.loadState(testGroup0, testInputA);
|
||||
let res = memento.loadEditorState(testGroup0, testInputA);
|
||||
assert.ok(!res);
|
||||
|
||||
memento.saveState(testGroup0, testInputA, { line: 3 });
|
||||
res = memento.loadState(testGroup0, testInputA);
|
||||
memento.saveEditorState(testGroup0, testInputA, { line: 3 });
|
||||
res = memento.loadEditorState(testGroup0, testInputA);
|
||||
assert.ok(res);
|
||||
assert.equal(res.line, 3);
|
||||
|
||||
// State removed when input gets disposed
|
||||
testInputA.dispose();
|
||||
res = memento.loadState(testGroup0, testInputA);
|
||||
res = memento.loadEditorState(testGroup0, testInputA);
|
||||
assert.ok(!res);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue