vscode#TextEditorDecorationType TypeScript Examples

The following examples show how to use vscode#TextEditorDecorationType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: decoration-utils.ts    From vscode-code-review with MIT License 7 votes vote down vote up
colorizedBackgroundDecoration = (
  selections: Range[],
  editor: TextEditor,
  color: string,
): TextEditorDecorationType => {
  const backgroundColorDefaultID = 'codereview.code.selection.background';
  const backgroundColorDefault = new ThemeColor(backgroundColorDefaultID);
  let backgroundColor: string | ThemeColor;
  if (color === backgroundColorDefaultID) {
    backgroundColor = backgroundColorDefault;
  } else if (isValidColorDefinition(color)) {
    backgroundColor = color;
  } else {
    console.log(`Invalid background color definition: ${color}`);
    backgroundColor = backgroundColorDefault;
  }

  const decoration = window.createTextEditorDecorationType({
    backgroundColor: backgroundColor,
  });
  editor.setDecorations(decoration, selections);

  return decoration;
}
Example #2
Source File: counterExamplesView.ts    From ide-vscode with MIT License 6 votes vote down vote up
private static createTextEditorDecoration(): TextEditorDecorationType {
    const customOptions = Configuration.get<IColorOptions>(ConfigurationConstants.CounterExamples.Color);
    return window.createTextEditorDecorationType({
      dark:{
        after: {
          backgroundColor: customOptions.backgroundColor ?? DefaultDarkBackgroundColor,
          color: customOptions.fontColor ?? DefaultDarkFontColor,
          margin: DefaultMargin
        }
      },
      light: {
        after: {
          backgroundColor: customOptions.backgroundColor ?? DefaultLightBackgroundColor,
          color: customOptions.fontColor ?? DefaultLightFontColor,
          margin: DefaultMargin
        }
      }
    });
  }
Example #3
Source File: verificationGutterStatusView.ts    From ide-vscode with MIT License 6 votes vote down vote up
/// Creation of an decoration type
  private static iconOf(context: ExtensionContext, path: string, grayMode: boolean): TextEditorDecorationType {
    const icon = context.asAbsolutePath(`images/${path}.png`);
    return window.createTextEditorDecorationType({
      isWholeLine: true,
      rangeBehavior: 1,
      gutterIconPath: icon,
      overviewRulerColor:
        grayMode ? (path === 'resolution-error' ? ScrollColor.Error : ScrollColor.Unknown)
          : path.startsWith('error-range')
            ? ScrollColor.ErrorRange
            : path.startsWith('error')
              ? ScrollColor.Error
              : path.startsWith('verified')
                ? ScrollColor.Verified
                : ScrollColor.Unknown
    });
  }
Example #4
Source File: verificationGutterStatusView.ts    From ide-vscode with MIT License 6 votes vote down vote up
/////////////////// Gutter rendering ///////////////////

  // For every decoration in the set of animated decorations,
  // sets all their ranges to empty except for the one corresponding to the animation frame.
  private animateIcon(editor: TextEditor, iconFrames: TextEditorDecorationType[], ranges: Range[]) {
    for(let i = 0; i < iconFrames.length; i++) {
      editor.setDecorations(iconFrames[i], this.animationFrame === i ? ranges : []);
    }
  }
Example #5
Source File: windowDecorations.ts    From dendron with GNU Affero General Public License v3.0 6 votes vote down vote up
EDITOR_DECORATION_TYPES: {
  [key in keyof typeof DECORATION_TYPES]: TextEditorDecorationType;
} = {
  timestamp: window.createTextEditorDecorationType({}),
  blockAnchor: window.createTextEditorDecorationType({
    opacity: "40%",
    rangeBehavior: DecorationRangeBehavior.ClosedOpen,
  }),
  /** Decoration for wikilinks that point to valid notes. */
  wikiLink: window.createTextEditorDecorationType({
    color: new ThemeColor("editorLink.activeForeground"),
    rangeBehavior: DecorationRangeBehavior.ClosedClosed,
  }),
  /** Decoration for wikilinks that do *not* point to valid notes (e.g. broken). */
  brokenWikilink: window.createTextEditorDecorationType({
    color: new ThemeColor("editorWarning.foreground"),
    backgroundColor: new ThemeColor("editorWarning.background"),
    rangeBehavior: DecorationRangeBehavior.ClosedClosed,
  }),
  /** Decoration for the alias part of wikilinks. */
  alias: window.createTextEditorDecorationType({
    fontStyle: "italic",
  }),
  taskNote: window.createTextEditorDecorationType({
    rangeBehavior: DecorationRangeBehavior.ClosedClosed,
  }),
}
Example #6
Source File: extension.ts    From vscode-todo-md with MIT License 5 votes vote down vote up
static priorityEDecorationType: TextEditorDecorationType;
Example #7
Source File: extension.ts    From vscode-todo-md with MIT License 5 votes vote down vote up
static priorityBDecorationType: TextEditorDecorationType;
Example #8
Source File: extension.ts    From vscode-todo-md with MIT License 5 votes vote down vote up
static priorityFDecorationType: TextEditorDecorationType;
Example #9
Source File: extension.ts    From vscode-todo-md with MIT License 5 votes vote down vote up
static tagsDecorationType: TextEditorDecorationType;
Example #10
Source File: extension.ts    From vscode-todo-md with MIT License 5 votes vote down vote up
static tagWithDelimiterDecorationType: TextEditorDecorationType;
Example #11
Source File: extension.ts    From vscode-todo-md with MIT License 5 votes vote down vote up
static tagsDelimiterDecorationType: TextEditorDecorationType;
Example #12
Source File: extension.ts    From vscode-todo-md with MIT License 5 votes vote down vote up
static specialTagDecorationType: TextEditorDecorationType;
Example #13
Source File: extension.ts    From vscode-todo-md with MIT License 5 votes vote down vote up
static projectDecorationType: TextEditorDecorationType;
Example #14
Source File: extension.ts    From vscode-todo-md with MIT License 5 votes vote down vote up
static contextDecorationType: TextEditorDecorationType;
Example #15
Source File: extension.ts    From vscode-todo-md with MIT License 5 votes vote down vote up
static notDueDecorationType: TextEditorDecorationType;
Example #16
Source File: extension.ts    From vscode-todo-md with MIT License 5 votes vote down vote up
static dueDecorationType: TextEditorDecorationType;
Example #17
Source File: extension.ts    From vscode-todo-md with MIT License 5 votes vote down vote up
static overdueDecorationType: TextEditorDecorationType;
Example #18
Source File: extension.ts    From vscode-todo-md with MIT License 5 votes vote down vote up
static invalidDueDateDecorationType: TextEditorDecorationType;
Example #19
Source File: extension.ts    From vscode-todo-md with MIT License 5 votes vote down vote up
static closestDueDateDecorationType: TextEditorDecorationType;
Example #20
Source File: extension.ts    From vscode-todo-md with MIT License 5 votes vote down vote up
static nestedTasksCountDecorationType: TextEditorDecorationType;
Example #21
Source File: extension.ts    From vscode-todo-md with MIT License 5 votes vote down vote up
static nestedTasksPieDecorationType: TextEditorDecorationType;
Example #22
Source File: extension.ts    From vscode-todo-md with MIT License 5 votes vote down vote up
static priorityDDecorationType: TextEditorDecorationType;
Example #23
Source File: extension.ts    From vscode-todo-md with MIT License 5 votes vote down vote up
static priorityCDecorationType: TextEditorDecorationType;
Example #24
Source File: coverage.ts    From gnucobol-debug with GNU General Public License v3.0 5 votes vote down vote up
readonly RED: TextEditorDecorationType = window.createTextEditorDecorationType({
        isWholeLine: true,
        rangeBehavior: DecorationRangeBehavior.ClosedClosed,
        outline: 'none',
        backgroundColor: 'rgba(255, 20, 20, 0.2)',
        overviewRulerColor: new ThemeColor('editorOverviewRuler.errorForeground'),
        overviewRulerLane: OverviewRulerLane.Center
    });
Example #25
Source File: extension.ts    From vscode-todo-md with MIT License 5 votes vote down vote up
static priorityADecorationType: TextEditorDecorationType;
Example #26
Source File: extension.ts    From vscode-todo-md with MIT License 5 votes vote down vote up
static commentDecorationType: TextEditorDecorationType;
Example #27
Source File: extension.ts    From vscode-todo-md with MIT License 5 votes vote down vote up
static completedTaskDecorationType: TextEditorDecorationType;
Example #28
Source File: taskgutter.ts    From vscode-lean4 with Apache License 2.0 5 votes vote down vote up
private decorations: Map<LeanFileProgressKind, [TextEditorDecorationType, string]> = new Map<LeanFileProgressKind, [TextEditorDecorationType, string]>();
Example #29
Source File: taskgutter.ts    From vscode-lean4 with Apache License 2.0 5 votes vote down vote up
constructor(private uri: string, private decorations: Map<LeanFileProgressKind, [TextEditorDecorationType, string]>, private processed: LeanFileProgressProcessingInfo[]) {
        this.schedule(100)
        this.processed = []
    }