Path: blob/main/src/vs/editor/browser/viewParts/viewLines/viewLineOptions.ts
3296 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import type { ColorScheme } from '../../../../platform/theme/common/theme.js';6import type { IEditorConfiguration } from '../../../common/config/editorConfiguration.js';7import { EditorOption } from '../../../common/config/editorOptions.js';89export class ViewLineOptions {10public readonly themeType: ColorScheme;11public readonly renderWhitespace: 'none' | 'boundary' | 'selection' | 'trailing' | 'all';12public readonly experimentalWhitespaceRendering: 'svg' | 'font' | 'off';13public readonly renderControlCharacters: boolean;14public readonly spaceWidth: number;15public readonly middotWidth: number;16public readonly wsmiddotWidth: number;17public readonly useMonospaceOptimizations: boolean;18public readonly canUseHalfwidthRightwardsArrow: boolean;19public readonly lineHeight: number;20public readonly stopRenderingLineAfter: number;21public readonly fontLigatures: string;22public readonly verticalScrollbarSize: number;23public readonly useGpu: boolean;2425constructor(config: IEditorConfiguration, themeType: ColorScheme) {26this.themeType = themeType;27const options = config.options;28const fontInfo = options.get(EditorOption.fontInfo);29this.renderWhitespace = options.get(EditorOption.renderWhitespace);30this.experimentalWhitespaceRendering = options.get(EditorOption.experimentalWhitespaceRendering);31this.renderControlCharacters = options.get(EditorOption.renderControlCharacters);32this.spaceWidth = fontInfo.spaceWidth;33this.middotWidth = fontInfo.middotWidth;34this.wsmiddotWidth = fontInfo.wsmiddotWidth;35this.useMonospaceOptimizations = (36fontInfo.isMonospace37&& !options.get(EditorOption.disableMonospaceOptimizations)38);39this.canUseHalfwidthRightwardsArrow = fontInfo.canUseHalfwidthRightwardsArrow;40this.lineHeight = options.get(EditorOption.lineHeight);41this.stopRenderingLineAfter = options.get(EditorOption.stopRenderingLineAfter);42this.fontLigatures = options.get(EditorOption.fontLigatures);43this.verticalScrollbarSize = options.get(EditorOption.scrollbar).verticalScrollbarSize;44this.useGpu = options.get(EditorOption.experimentalGpuAcceleration) === 'on';45}4647public equals(other: ViewLineOptions): boolean {48return (49this.themeType === other.themeType50&& this.renderWhitespace === other.renderWhitespace51&& this.experimentalWhitespaceRendering === other.experimentalWhitespaceRendering52&& this.renderControlCharacters === other.renderControlCharacters53&& this.spaceWidth === other.spaceWidth54&& this.middotWidth === other.middotWidth55&& this.wsmiddotWidth === other.wsmiddotWidth56&& this.useMonospaceOptimizations === other.useMonospaceOptimizations57&& this.canUseHalfwidthRightwardsArrow === other.canUseHalfwidthRightwardsArrow58&& this.lineHeight === other.lineHeight59&& this.stopRenderingLineAfter === other.stopRenderingLineAfter60&& this.fontLigatures === other.fontLigatures61&& this.verticalScrollbarSize === other.verticalScrollbarSize62&& this.useGpu === other.useGpu63);64}65}666768