提交 982051a3 编写于 作者: B Benjamin Pasero

sqlite - fix close boolean flag

上级 0c5a3da3
......@@ -11,7 +11,7 @@ import { IPosition } from 'vs/editor/common/core/position';
import { RunOnceScheduler } from 'vs/base/common/async';
import { CompletionItemKind, completionKindFromLegacyString } from 'vs/editor/common/modes';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { IDisposable } from 'vs/base/common/lifecycle';
import { Disposable } from 'vs/base/common/lifecycle';
export abstract class Memory {
......@@ -194,26 +194,24 @@ export class PrefixMemory extends Memory {
export type MemMode = 'first' | 'recentlyUsed' | 'recentlyUsedByPrefix';
export class SuggestMemories {
export class SuggestMemories extends Disposable {
private readonly _storagePrefix = 'suggest/memories';
private _mode: MemMode;
private _strategy: Memory;
private readonly _persistSoon: RunOnceScheduler;
private readonly _listener: IDisposable;
constructor(
editor: ICodeEditor,
@IStorageService private readonly _storageService: IStorageService,
) {
this._persistSoon = new RunOnceScheduler(() => this._flush(), 3000);
this._setMode(editor.getConfiguration().contribInfo.suggestSelection);
this._listener = editor.onDidChangeConfiguration(e => e.contribInfo && this._setMode(editor.getConfiguration().contribInfo.suggestSelection));
}
super();
dispose(): void {
this._listener.dispose();
this._persistSoon = this._register(new RunOnceScheduler(() => this._flush(), 3000));
this._setMode(editor.getConfiguration().contribInfo.suggestSelection);
this._register(editor.onDidChangeConfiguration(e => e.contribInfo && this._setMode(editor.getConfiguration().contribInfo.suggestSelection)));
this._register(_storageService.onWillClose(() => this._flush()));
}
private _setMode(mode: MemMode): void {
......
......@@ -189,9 +189,11 @@ export class DelegatingStorageService extends Disposable implements IStorageServ
}
close(reason: ShutdownReason): Promise<void> {
const promise = this.storageService.close(reason);
this.closed = true;
return this.storageService.close(reason);
return promise;
}
private convertScope(scope: StorageScope): StorageLegacyScope {
......
......@@ -1132,7 +1132,7 @@ export class Workbench extends Disposable implements IPartService {
// Restore sidebar if we are being shutdown as a matter of a reload
if (reason === ShutdownReason.RELOAD) {
this.storageService.store(Workbench.sidebarRestoreStorageKey, 'true', StorageScope.WORKSPACE);
this.storageService.store(Workbench.sidebarRestoreStorageKey, true, StorageScope.WORKSPACE);
}
// Preserve zen mode only on reload. Real quit gets out of zen mode so novice users do not get stuck in zen mode.
......@@ -1335,8 +1335,7 @@ export class Workbench extends Disposable implements IPartService {
this.shouldCenterLayout = active;
let smartActive = active;
if (this.editorPart.groups.length > 1 && this.configurationService.getValue('workbench.editor.centeredLayoutAutoResize')) {
// Respect the auto resize setting - do not go into centered layout if there is more than 1 group.
smartActive = false;
smartActive = false; // Respect the auto resize setting - do not go into centered layout if there is more than 1 group.
}
// Enter Centered Editor Layout
......
......@@ -64,7 +64,6 @@ const $ = dom.$;
export class SearchView extends Viewlet implements IViewlet, IPanel {
private static readonly MAX_TEXT_RESULTS = 10000;
private static readonly SHOW_REPLACE_STORAGE_KEY = 'vs.search.show.replace';
private static readonly WIDE_CLASS_NAME = 'wide';
private static readonly WIDE_VIEW_SIZE = 600;
......@@ -120,7 +119,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
@IProgressService private progressService: IProgressService,
@INotificationService private notificationService: INotificationService,
@IDialogService private dialogService: IDialogService,
@IStorageService private storageService: IStorageService,
@IStorageService storageService: IStorageService,
@IContextViewService private contextViewService: IContextViewService,
@IInstantiationService private instantiationService: IInstantiationService,
@IConfigurationService configurationService: IConfigurationService,
......@@ -310,6 +309,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
const history = this.searchHistoryService.load();
let searchHistory = history.search || this.viewletState['query.searchHistory'] || [];
let replaceHistory = history.replace || this.viewletState['query.replaceHistory'] || [];
let showReplace = typeof this.viewletState['view.showReplace'] === 'boolean' ? this.viewletState['view.showReplace'] : true;
this.searchWidget = this._register(this.instantiationService.createInstance(SearchWidget, container, <ISearchWidgetOptions>{
value: contentPattern,
......@@ -320,7 +320,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
replaceHistory: replaceHistory
}));
if (this.storageService.getBoolean(SearchView.SHOW_REPLACE_STORAGE_KEY, StorageScope.WORKSPACE, true)) {
if (showReplace) {
this.searchWidget.toggleReplace(true);
}
......@@ -367,13 +367,6 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
private onReplaceToggled(): void {
this.layout(this.size);
const isReplaceShown = this.searchAndReplaceWidget.isReplaceShown();
if (!isReplaceShown) {
this.storageService.store(SearchView.SHOW_REPLACE_STORAGE_KEY, false, StorageScope.WORKSPACE);
} else {
this.storageService.remove(SearchView.SHOW_REPLACE_STORAGE_KEY, StorageScope.WORKSPACE);
}
}
private onSearchResultsChanged(event?: IChangeEvent): TPromise<any> {
......@@ -1522,6 +1515,9 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
this.viewletState['query.folderIncludes'] = patternIncludes;
this.viewletState['query.useExcludesAndIgnoreFiles'] = useExcludesAndIgnoreFiles;
const isReplaceShown = this.searchAndReplaceWidget.isReplaceShown();
this.viewletState['view.showReplace'] = isReplaceShown;
const searchHistory = this.searchWidget.getSearchHistory();
const replaceHistory = this.searchWidget.getReplaceHistory();
const patternExcludesHistory = this.inputPatternExcludes.getHistory();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册