提交 7915a1b6 编写于 作者: J Joao Moreno

fix bad layout on references widget on fresh workspaces

上级 4d718464
......@@ -98,7 +98,7 @@ export abstract class ReferencesController implements editorCommon.IEditorContri
}
}));
const storageKey = 'peekViewLayout';
const data = <LayoutData>JSON.parse(this._storageService.get(storageKey, StorageScope.GLOBAL, '{}'));
const data = LayoutData.fromJSON(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);
......
......@@ -157,9 +157,25 @@ class DecorationsManager implements IDisposable {
}
}
export interface LayoutData {
export class LayoutData {
ratio: number;
heightInLines: number;
static fromJSON(raw: string): LayoutData {
let ratio: number | undefined;
let heightInLines: number | undefined;
try {
const data = <LayoutData>JSON.parse(raw);
ratio = data.ratio;
heightInLines = data.heightInLines;
} catch {
//
}
return {
ratio: ratio || 0.7,
heightInLines: heightInLines || 18
};
}
}
export interface SelectionEvent {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册