import * as vscode from 'vscode' ; import Consts from '../../consts' ; import TagItem from '../items/tag' ; import Line from './line' ; const SPECIAL_TAGS = Consts . tags . names . map ( ( name , index ) => vscode . window . createTextEditorDecorationType ( { backgroundColor : Consts . colors . tags . background [ index ] , color : Consts . colors . tags . foreground [ index ] , borderRadius : '2px' , rangeBehavior : vscode . DecorationRangeBehavior . ClosedClosed , dark : { backgroundColor : Consts . colors . dark . tags . background [ index ] , color : Consts . colors . dark . tags . foreground [ index ] } , light : { backgroundColor : Consts . colors . light . tags . background [ index ] , color : Consts . colors . light . tags . foreground [ index ] } } ) ) ; const TAG = vscode . window . createTextEditorDecorationType ( { color : Consts . colors . tag , rangeBehavior : vscode . DecorationRangeBehavior . ClosedClosed , dark : { color : Consts . colors . dark . tag } , light : { color : Consts . colors . light . tag } } ) ; class Tag extends Line { TYPES = [ ... SPECIAL_TAGS , TAG ] ; getItemRanges ( tag ) { return this . TYPES . map ( ( type , index ) => tag . match [ index + 1 ] && tag . range ) ; } } export default Tag ;