本文整理匯總了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);
}