Skip to content

Commit

Permalink
fix suggest widget in standalone editor
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomoreno committed Nov 15, 2018
1 parent e9d7d33 commit 2e30d00
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/vs/editor/contrib/suggest/suggestWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,9 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<IComp
private detailsFocusBorderColor: string;
private detailsBorderColor: string;

private storageServiceAvailable: boolean = true;
private expandSuggestionDocs: boolean = false;

private firstFocusInCurrentList: boolean = false;

constructor(
Expand All @@ -458,6 +461,13 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<IComp
this.focusedItem = null;
this.storageService = storageService;

// :facepalm:
this.storageService.store('___suggest___', true, StorageScope.GLOBAL);
if (!this.storageService.get('___suggest___', StorageScope.GLOBAL)) {
this.storageServiceAvailable = false;
}
this.storageService.remove('___suggest___', StorageScope.GLOBAL);

this.element = $('.editor-widget.suggest-widget');
if (!this.editor.getConfiguration().contribInfo.iconsInSuggestions) {
addClass(this.element, 'no-icons');
Expand Down Expand Up @@ -1083,11 +1093,19 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<IComp
}

private expandDocsSettingFromStorage(): boolean {
return this.storageService.getBoolean('expandSuggestionDocs', StorageScope.GLOBAL, expandSuggestionDocsByDefault);
if (this.storageServiceAvailable) {
return this.storageService.getBoolean('expandSuggestionDocs', StorageScope.GLOBAL, expandSuggestionDocsByDefault);
} else {
return this.expandSuggestionDocs;
}
}

private updateExpandDocsSetting(value: boolean) {
this.storageService.store('expandSuggestionDocs', value, StorageScope.GLOBAL);
if (this.storageServiceAvailable) {
this.storageService.store('expandSuggestionDocs', value, StorageScope.GLOBAL);
} else {
this.expandSuggestionDocs = value;
}
}

dispose(): void {
Expand Down

0 comments on commit 2e30d00

Please sign in to comment.