提交 0a6a94a1 编写于 作者: J Johannes Rieken

ref - apply editor font to reference search tree

上级 455a4e65
......@@ -385,8 +385,9 @@ class OneReferenceTemplate {
readonly before: HTMLSpanElement;
readonly inside: HTMLSpanElement;
readonly after: HTMLSpanElement;
readonly dispose: () => void;
constructor(container: HTMLElement) {
constructor(container: HTMLElement, editor: ICodeEditor) {
const parent = document.createElement('div');
this.before = document.createElement('span');
this.inside = document.createElement('span');
......@@ -397,6 +398,14 @@ class OneReferenceTemplate {
parent.appendChild(this.inside);
parent.appendChild(this.after);
container.appendChild(parent);
function applyFontInfo() {
container.style.fontFamily = editor.getConfiguration().fontInfo.fontFamily;
}
applyFontInfo();
const reg = editor.onDidChangeConfiguration(e => e.fontInfo && applyFontInfo());
this.dispose = () => reg.dispose();
}
set(element: OneReference): void {
......@@ -415,9 +424,10 @@ class Renderer implements tree.IRenderer {
};
constructor(
private _editor: ICodeEditor,
@IWorkspaceContextService private _contextService: IWorkspaceContextService,
@IThemeService private _themeService: IThemeService,
@optional(IEnvironmentService) private _environmentService: IEnvironmentService
@optional(IEnvironmentService) private _environmentService: IEnvironmentService,
) {
//
}
......@@ -439,7 +449,7 @@ class Renderer implements tree.IRenderer {
if (templateId === Renderer._ids.FileReferences) {
return new FileReferencesTemplate(container, this._contextService, this._environmentService, this._themeService);
} else if (templateId === Renderer._ids.OneReference) {
return new OneReferenceTemplate(container);
return new OneReferenceTemplate(container, this._editor);
}
throw templateId;
}
......@@ -455,9 +465,7 @@ class Renderer implements tree.IRenderer {
}
disposeTemplate(tree: tree.ITree, templateId: string, templateData: any): void {
if (templateData instanceof FileReferencesTemplate) {
templateData.dispose();
}
templateData.dispose();
}
}
......@@ -680,7 +688,7 @@ export class ReferenceWidget extends PeekViewWidget {
container.div({ 'class': 'ref-tree inline' }, (div: Builder) => {
var config = <tree.ITreeConfiguration>{
dataSource: this._instantiationService.createInstance(DataSource),
renderer: this._instantiationService.createInstance(Renderer),
renderer: this._instantiationService.createInstance(Renderer, this.editor),
controller: new Controller(),
// TODO@{Joh,Ben} make this work with the embedded tree
// accessibilityProvider: new AriaProvider()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册