const types = new Map<string, TextEditorDecorationType>()
export function setup(context: ExtensionContext)
{ function decoration(options: DecorationRenderOptions): TextEditorDecorationType
{ const typ = window.createTextEditorDecorationType(options)
context.subscriptions.push(typ) return typ
}
types.forEach(typ =>
{ for (const editor of window.visibleTextEditors) {
editor.setDecorations(typ, [])
} const i = context.subscriptions.indexOf(typ) if (i >= 0) context.subscriptions.splice(i, 1)
typ.dispose()
})
types.clear()
/* init */
for (const color of background_colors) {
types.set("background_" + color, background(color))
} for (const color of foreground_colors) {
types.set("foreground_" + color, background(color)) // approximation
} for (const color of dotted_colors) {
types.set("dotted_" + color, bottom_border("2px", "dotted", color))
} for (const color of text_colors) {
types.set("text_" + color, text_color(color))
} for (const color of text_overview_colors) {
types.set("text_overview_" + color, text_overview_color(color))
}
types.set("spell_checker", bottom_border("1px", "solid", "spell_checker"))
/* update editors */
for (const editor of window.visibleTextEditors) {
update_editor(editor)
}
}
/* decoration for document node */
type Content = Range[] | DecorationOptions[] const document_decorations = new Map<string, Map<string, Content>>()
export function close_document(document: TextDocument)
{
document_decorations.delete(document.uri.toString())
}
export function apply_decoration(decorations: Document_Decorations)
{ const uri = Uri.parse(decorations.uri)
for (const decoration of decorations.entries) { const typ = types.get(decoration.type) if (typ) { const content: DecorationOptions[] = decoration.content.map(opt =>
{ const r = opt.range return {
range: new Range(r[0], r[1], r[2], r[3]),
hoverMessage: opt.hover_message
}
})
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.