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

sqlite - fix close boolean flag

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