本文整理汇总了TypeScript中vscode.TextEditor.setDecorations方法的典型用法代码示例。如果您正苦于以下问题:TypeScript TextEditor.setDecorations方法的具体用法?TypeScript TextEditor.setDecorations怎么用?TypeScript TextEditor.setDecorations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vscode.TextEditor
的用法示例。
在下文中一共展示了TextEditor.setDecorations方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: clear
clear() {
this.status = undefined;
if (this.editor === undefined) return;
if (this.decoration !== undefined) {
try {
this.editor.setDecorations(this.decoration, []);
}
catch {}
}
if (this.additionalDecorations !== undefined && this.additionalDecorations.length > 0) {
for (const d of this.additionalDecorations) {
try {
this.editor.setDecorations(d.decoration, []);
}
catch {}
}
this.additionalDecorations = undefined;
}
if (this.highlightDecoration !== undefined) {
try {
this.editor.setDecorations(this.highlightDecoration, []);
}
catch {}
}
}
示例2: restore
async restore(editor: TextEditor) {
// If the editor isn't disposed then we don't need to do anything
// Explicitly check for `false`
if ((this.editor as any)._disposed === false) return;
this.status = AnnotationStatus.Computing;
if (editor === window.activeTextEditor) {
await setCommandContext(CommandContext.AnnotationStatus, this.status);
}
this.editor = editor;
this.correlationKey = AnnotationProviderBase.getCorrelationKey(editor);
this.document = editor.document;
if (this.decorations !== undefined && this.decorations.length) {
this.editor.setDecorations(this.decoration, this.decorations);
if (this.additionalDecorations !== undefined && this.additionalDecorations.length) {
for (const d of this.additionalDecorations) {
this.editor.setDecorations(d.decoration, d.ranges);
}
}
}
this.status = AnnotationStatus.Computed;
if (editor === window.activeTextEditor) {
await setCommandContext(CommandContext.AnnotationStatus, this.status);
}
}
示例3: update_editor
export function update_editor(editor: TextEditor)
{
if (editor) {
const decorations = document_decorations.get(editor.document.uri.toString())
if (decorations) {
for (const [typ, content] of decorations) {
editor.setDecorations(types.get(typ), content)
}
}
}
}
示例4:
this.sets.forEach(set => textEditor.setDecorations(set.decorationType, set.ranges));
示例5: unsetDecorations
unsetDecorations(decorationType: TextEditorDecorationType) {
this.editor.setDecorations(decorationType, []);
}
示例6: setDecorations
setDecorations(decorationType: TextEditorDecorationType, ranges: FlatRange[]) {
const vsRanges = ranges.map(range => this.getRange(range));
this.editor.setDecorations(decorationType, vsRanges);
}