mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-27 13:40:25 +00:00
Remove markdown code block font family option
For #206228 Always use the configuration service to look up the editor defaults instead of requiring it from each caller
This commit is contained in:
@@ -10,8 +10,6 @@ import * as dom from '../../../../base/browser/dom.js';
|
||||
import { IKeybindingService } from '../../../../platform/keybinding/common/keybinding.js';
|
||||
import { KeyCode } from '../../../../base/common/keyCodes.js';
|
||||
import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
|
||||
import { IEditorOptions } from '../../../common/config/editorOptions.js';
|
||||
import { EDITOR_FONT_DEFAULTS } from '../../../common/config/fontInfo.js';
|
||||
import { HoverAction, HoverPosition, HoverWidget as BaseHoverWidget, getHoverAccessibleViewHint } from '../../../../base/browser/ui/hover/hoverWidget.js';
|
||||
import { Widget } from '../../../../base/browser/ui/widget.js';
|
||||
import { AnchorPosition } from '../../../../base/browser/ui/contextview/contextview.js';
|
||||
@@ -167,10 +165,7 @@ export class HoverWidget extends Widget implements IHoverWidget {
|
||||
|
||||
} else {
|
||||
const markdown = options.content;
|
||||
const mdRenderer = this._instantiationService.createInstance(
|
||||
MarkdownRenderer,
|
||||
{ codeBlockFontFamily: this._configurationService.getValue<IEditorOptions>('editor').fontFamily || EDITOR_FONT_DEFAULTS.fontFamily }
|
||||
);
|
||||
const mdRenderer = this._instantiationService.createInstance(MarkdownRenderer, {});
|
||||
|
||||
const { element, dispose } = mdRenderer.render(markdown, {
|
||||
actionHandler: (content) => this._linkHandler(content),
|
||||
|
||||
@@ -8,8 +8,10 @@ import { createTrustedTypesPolicy } from '../../../../../base/browser/trustedTyp
|
||||
import { onUnexpectedError } from '../../../../../base/common/errors.js';
|
||||
import { IMarkdownString, MarkdownStringTrustedOptions } from '../../../../../base/common/htmlContent.js';
|
||||
import { IDisposable } from '../../../../../base/common/lifecycle.js';
|
||||
import { IConfigurationService } from '../../../../../platform/configuration/common/configuration.js';
|
||||
import { IOpenerService } from '../../../../../platform/opener/common/opener.js';
|
||||
import { EditorOption } from '../../../../common/config/editorOptions.js';
|
||||
import { EditorOption, IEditorOptions } from '../../../../common/config/editorOptions.js';
|
||||
import { EDITOR_FONT_DEFAULTS } from '../../../../common/config/fontInfo.js';
|
||||
import { ILanguageService } from '../../../../common/languages/language.js';
|
||||
import { PLAINTEXT_LANGUAGE_ID } from '../../../../common/languages/modesRegistry.js';
|
||||
import { tokenizeToString } from '../../../../common/languages/textToHtmlTokenizer.js';
|
||||
@@ -23,7 +25,6 @@ export interface IMarkdownRenderResult extends IDisposable {
|
||||
|
||||
export interface IMarkdownRendererOptions {
|
||||
readonly editor?: ICodeEditor;
|
||||
readonly codeBlockFontFamily?: string;
|
||||
readonly codeBlockFontSize?: string;
|
||||
}
|
||||
|
||||
@@ -41,6 +42,7 @@ export class MarkdownRenderer {
|
||||
|
||||
constructor(
|
||||
private readonly _options: IMarkdownRendererOptions,
|
||||
@IConfigurationService private readonly _configurationService: IConfigurationService,
|
||||
@ILanguageService private readonly _languageService: ILanguageService,
|
||||
@IOpenerService private readonly _openerService: IOpenerService,
|
||||
) { }
|
||||
@@ -78,8 +80,8 @@ export class MarkdownRenderer {
|
||||
if (this._options.editor) {
|
||||
const fontInfo = this._options.editor.getOption(EditorOption.fontInfo);
|
||||
applyFontInfo(element, fontInfo);
|
||||
} else if (this._options.codeBlockFontFamily) {
|
||||
element.style.fontFamily = this._options.codeBlockFontFamily;
|
||||
} else {
|
||||
element.style.fontFamily = this._configurationService.getValue<IEditorOptions>('editor').fontFamily || EDITOR_FONT_DEFAULTS.fontFamily;
|
||||
}
|
||||
|
||||
if (this._options.codeBlockFontSize !== undefined) {
|
||||
|
||||
@@ -18,8 +18,7 @@ import { IColorTheme, IThemeService } from '../../../../platform/theme/common/th
|
||||
import { CommentGlyphWidget } from './commentGlyphWidget.js';
|
||||
import { ICommentService } from './commentService.js';
|
||||
import { ICommentThreadWidget } from '../common/commentThreadWidget.js';
|
||||
import { EditorOption, IEditorOptions } from '../../../../editor/common/config/editorOptions.js';
|
||||
import { EDITOR_FONT_DEFAULTS } from '../../../../editor/common/config/fontInfo.js';
|
||||
import { EditorOption } from '../../../../editor/common/config/editorOptions.js';
|
||||
import { ServiceCollection } from '../../../../platform/instantiation/common/serviceCollection.js';
|
||||
import { CommentThreadWidget } from './commentThreadWidget.js';
|
||||
import { ICellRange } from '../../notebook/common/notebookRange.js';
|
||||
@@ -273,7 +272,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
|
||||
this._commentThread as unknown as languages.CommentThread<IRange | ICellRange>,
|
||||
this._pendingComment,
|
||||
this._pendingEdits,
|
||||
{ editor: this.editor, codeBlockFontSize: '', codeBlockFontFamily: this.configurationService.getValue<IEditorOptions>('editor').fontFamily || EDITOR_FONT_DEFAULTS.fontFamily },
|
||||
{ editor: this.editor, codeBlockFontSize: '' },
|
||||
this._commentOptions,
|
||||
{
|
||||
actionRunner: async () => {
|
||||
|
||||
@@ -5,10 +5,7 @@
|
||||
|
||||
import { coalesce } from '../../../../../../base/common/arrays.js';
|
||||
import { DisposableMap, DisposableStore } from '../../../../../../base/common/lifecycle.js';
|
||||
import { IEditorOptions } from '../../../../../../editor/common/config/editorOptions.js';
|
||||
import { EDITOR_FONT_DEFAULTS } from '../../../../../../editor/common/config/fontInfo.js';
|
||||
import * as languages from '../../../../../../editor/common/languages.js';
|
||||
import { IConfigurationService } from '../../../../../../platform/configuration/common/configuration.js';
|
||||
import { IContextKeyService } from '../../../../../../platform/contextkey/common/contextkey.js';
|
||||
import { IInstantiationService } from '../../../../../../platform/instantiation/common/instantiation.js';
|
||||
import { IThemeService } from '../../../../../../platform/theme/common/themeService.js';
|
||||
@@ -29,7 +26,6 @@ export class CellComments extends CellContentPart {
|
||||
@IContextKeyService private readonly contextKeyService: IContextKeyService,
|
||||
@IThemeService private readonly themeService: IThemeService,
|
||||
@ICommentService private readonly commentService: ICommentService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
@IInstantiationService private readonly instantiationService: IInstantiationService
|
||||
) {
|
||||
super();
|
||||
@@ -65,9 +61,7 @@ export class CellComments extends CellContentPart {
|
||||
commentThread,
|
||||
undefined,
|
||||
undefined,
|
||||
{
|
||||
codeBlockFontFamily: this.configurationService.getValue<IEditorOptions>('editor').fontFamily || EDITOR_FONT_DEFAULTS.fontFamily
|
||||
},
|
||||
{},
|
||||
undefined,
|
||||
{
|
||||
actionRunner: () => {
|
||||
|
||||
Reference in New Issue
Block a user