import * as vscode from 'vscode' ; import { Substitution , UglyRevelation , LanguageEntry , PrettyCursor , PrettyStyleProperties , PrettyStyle , assignStyleProperties , HideTextMethod } from './configuration' ; export function makePrettyDecoration_fontSize_hack ( prettySubst ) { const showAttachmentStyling = '' ; let styling = { after : { } , dark : { after : { } } , light : { after : { } } , rangeBehavior : vscode . DecorationRangeBehavior . ClosedClosed , } ; if ( prettySubst . style ) { assignStyleProperties ( styling . after , prettySubst . style ) ; if ( prettySubst . style . dark ) assignStyleProperties ( styling . dark . after , prettySubst . style . dark ) ; if ( prettySubst . style . light ) assignStyleProperties ( styling . light . after , prettySubst . style . light ) ; } styling . after . contentText = prettySubst . pretty ; styling . after . textDecoration = ( styling . after . textDecoration || 'none' ) + showAttachmentStyling ; if ( styling . light . after . textDecoration ) styling . light . after . textDecoration = styling . light . after . textDecoration + showAttachmentStyling ; if ( styling . dark . after . textDecoration ) styling . dark . after . textDecoration = styling . dark . after . textDecoration + showAttachmentStyling ; return vscode . window . createTextEditorDecorationType ( styling ) ; } export function makePrettyDecoration_letterSpacing_hack ( prettySubst ) { const showAttachmentStyling = '; letter-spacing: normal; visibility: visible' ; let styling = { after : { } , dark : { after : { } } , light : { after : { } } , rangeBehavior : vscode . DecorationRangeBehavior . ClosedClosed , } ; if ( prettySubst . style ) { assignStyleProperties ( styling . after , prettySubst . style ) ; if ( prettySubst . style . dark ) assignStyleProperties ( styling . dark . after , prettySubst . style . dark ) ; if ( prettySubst . style . light ) assignStyleProperties ( styling . light . after , prettySubst . style . light ) ; } styling . after . contentText = prettySubst . pretty ; styling . after . textDecoration = ( styling . after . textDecoration || 'none' ) + showAttachmentStyling ; if ( styling . light . after . textDecoration ) styling . light . after . textDecoration = styling . light . after . textDecoration + showAttachmentStyling ; if ( styling . dark . after . textDecoration ) styling . dark . after . textDecoration = styling . dark . after . textDecoration + showAttachmentStyling ; return vscode . window . createTextEditorDecorationType ( styling ) ; } export function makePrettyDecoration_noPretty ( prettySubst ) { const showAttachmentStyling = '' ; let styling = { dark : { } , light : { } , rangeBehavior : vscode . DecorationRangeBehavior . ClosedClosed , } ; if ( prettySubst . style ) { assignStyleProperties ( styling , prettySubst . style ) ; if ( prettySubst . style . dark ) assignStyleProperties ( styling . dark , prettySubst . style . dark ) ; if ( prettySubst . style . light ) assignStyleProperties ( styling . light , prettySubst . style . light ) ; } return vscode . window . createTextEditorDecorationType ( styling ) ; } export function makePrettyDecoration_noHide ( prettySubst ) { const showAttachmentStyling = '' ; let styling = { after : { } , dark : { after : { } } , light : { after : { } } , rangeBehavior : vscode . DecorationRangeBehavior . ClosedClosed , } ; if ( prettySubst . style ) { assignStyleProperties ( styling . after , prettySubst . style ) ; if ( prettySubst . style . dark ) assignStyleProperties ( styling . dark . after , prettySubst . style . dark ) ; if ( prettySubst . style . light ) assignStyleProperties ( styling . light . after , prettySubst . style . light ) ; } styling . after . contentText = prettySubst . pretty ; styling . after . textDecoration = ( styling . after . textDecoration || 'none' ) + showAttachmentStyling ; if ( styling . light . after . textDecoration ) styling . light . after . textDecoration = styling . light . after . textDecoration + showAttachmentStyling ; if ( styling . dark . after . textDecoration ) styling . dark . after . textDecoration = styling . dark . after . textDecoration + showAttachmentStyling ; return vscode . window . createTextEditorDecorationType ( styling ) ; } export function makeDecorations_fontSize_hack ( ) { return { uglyDecoration : vscode . window . createTextEditorDecorationType ( { textDecoration : 'none; font-size: 0.001em' , rangeBehavior : vscode . DecorationRangeBehavior . ClosedClosed , } ) , revealedUglyDecoration : vscode . window . createTextEditorDecorationType ( { textDecoration : 'none; font-size: inherit !important' , rangeBehavior : vscode . DecorationRangeBehavior . ClosedClosed , after : { textDecoration : 'none; font-size: 0pt' , } } ) , boxedSymbolDecoration : { rangeBehavior : vscode . DecorationRangeBehavior . ClosedClosed , after : { border : '0.1em solid' , margin : '-0em -0.05em -0em -0.1em' , } } , } ; } export function makeDecorations_letterSpacing_hack ( ) { return { uglyDecoration : vscode . window . createTextEditorDecorationType ( { letterSpacing : "-0.55em; font-size: 0.1em; visibility: hidden" , rangeBehavior : vscode . DecorationRangeBehavior . ClosedClosed , } ) , revealedUglyDecoration : vscode . window . createTextEditorDecorationType ( { letterSpacing : "normal !important; font-size: inherit !important; visibility: visible !important" , rangeBehavior : vscode . DecorationRangeBehavior . ClosedClosed , after : { textDecoration : 'none !important; font-size: 0.1pt !important; visibility: hidden' , } } ) , boxedSymbolDecoration : { rangeBehavior : vscode . DecorationRangeBehavior . ClosedClosed , after : { border : '0.1em solid' , margin : '-0em -0.05em -0em -0.1em' , } } , } ; } export function makeDecorations_none ( ) { return { uglyDecoration : vscode . window . createTextEditorDecorationType ( { rangeBehavior : vscode . DecorationRangeBehavior . ClosedClosed , } ) , revealedUglyDecoration : vscode . window . createTextEditorDecorationType ( { textDecoration : 'none; font-size: inherit !important' , rangeBehavior : vscode . DecorationRangeBehavior . ClosedClosed , after : { textDecoration : 'none; font-size: 0pt' , } } ) , boxedSymbolDecoration : { rangeBehavior : vscode . DecorationRangeBehavior . ClosedClosed , after : { border : '0.1em solid' , margin : '-0em -0.05em -0em -0.1em' , } } , } ; }