vscode#ThemeIcon TypeScript Examples

The following examples show how to use vscode#ThemeIcon. 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: stripeStreamingView.ts    From vscode-stripe with MIT License 6 votes vote down vote up
private createItemWithCommand({
    label,
    command,
    iconId,
    iconFileName,
  }: {
    label: string;
    command?: string;
    iconId?: string;
    iconFileName?: string;
  }) {
    if (iconFileName) {
      return new StripeTreeItem(label, {
        commandString: command,
        iconPath: {
          light: path.resolve(__dirname, `../resources/icons/light/${iconFileName}.svg`),
          dark: path.resolve(__dirname, `../resources/icons/dark/${iconFileName}.svg`),
        },
      });
    } else {
      return new StripeTreeItem(label, {
        commandString: command,
        iconPath: iconId ? new ThemeIcon(iconId) : undefined,
      });
    }
  }
Example #2
Source File: HelpFeedbackTreeview.ts    From dendron with GNU Affero General Public License v3.0 6 votes vote down vote up
getTreeItem(element: MenuItem): TreeItem {
    let iconPath: vscode.ThemeIcon;

    switch (element) {
      case MenuItem.getStarted:
        iconPath = new ThemeIcon("star");
        break;

      case MenuItem.readDocs:
        iconPath = new ThemeIcon("book");
        break;

      case MenuItem.reviewIssues:
        iconPath = new ThemeIcon("issues");
        break;

      case MenuItem.reportIssue:
        iconPath = new ThemeIcon("comment");
        break;

      case MenuItem.joinCommunity:
        iconPath = new ThemeIcon("organization");
        break;

      case MenuItem.followUs:
        iconPath = new ThemeIcon("twitter");
        break;

      default:
        assertUnreachable(element);
    }

    return {
      label: element.toString(),
      collapsibleState: TreeItemCollapsibleState.None,
      iconPath,
    };
  }
Example #3
Source File: EngineNoteProvider.ts    From dendron with GNU Affero General Public License v3.0 6 votes vote down vote up
private createTreeNote(note: NoteProps) {
    const collapsibleState = _.isEmpty(note.children)
      ? TreeItemCollapsibleState.None
      : TreeItemCollapsibleState.Collapsed;

    const tn = new TreeNote({
      note,
      collapsibleState,
      labelType: this._labelType,
    });
    if (note.stub) {
      tn.iconPath = new ThemeIcon(ICONS.STUB);
    } else if (note.schema) {
      tn.iconPath = new ThemeIcon(ICONS.SCHEMA);
    }
    return tn;
  }
Example #4
Source File: ButtonTypes.ts    From dendron with GNU Affero General Public License v3.0 6 votes vote down vote up
constructor(opts: DendronBtnCons) {
    const { iconOff, iconOn, type, title, description, pressed } = opts;
    this.iconPathNormal = new vscode.ThemeIcon(iconOff);
    this.iconPathPressed = new vscode.ThemeIcon(iconOn);
    this.type = type;
    this.description = description;
    this._pressed = pressed || false;
    this.title = title;
    this.canToggle = _.isUndefined(opts.canToggle) ? true : opts.canToggle;
    this.opts = opts;
  }
Example #5
Source File: stripeHelpView.ts    From vscode-stripe with MIT License 6 votes vote down vote up
buildTree(): Promise<StripeTreeItem[]> {
    const items = [];

    const docsItem = new StripeTreeItem('Read documentation', {
      commandString: 'openDocs',
      iconPath: new ThemeIcon('book'),
    });
    items.push(docsItem);

    const reportItem = new StripeTreeItem('Report issue', {
      commandString: 'openReportIssue',
      iconPath: new ThemeIcon('report'),
    });
    items.push(reportItem);

    const feedbackItem = new StripeTreeItem('Rate and provide feedback', {
      commandString: 'openSurvey',
      iconPath: new ThemeIcon('feedback'),
    });
    items.push(feedbackItem);

    const webhooksDebugItem = new StripeTreeItem('Configure debugging', {
      commandString: 'openWebhooksDebugConfigure',
      iconPath: new ThemeIcon('settings-gear'),
    });

    items.push(webhooksDebugItem);

    return Promise.resolve(items);
  }
Example #6
Source File: stripeQuickLinksView.ts    From vscode-stripe with MIT License 6 votes vote down vote up
buildTree(): Promise<StripeTreeItem[]> {
    const items = [];

    const apiKeysItem = new StripeTreeItem('Open API keys page', {
      commandString: 'openDashboardApikeys',
      iconPath: new ThemeIcon('link-external'),
    });

    items.push(apiKeysItem);

    const eventsItem = new StripeTreeItem('Open events page', {
      commandString: 'openDashboardEvents',
      iconPath: new ThemeIcon('link-external'),
    });

    items.push(eventsItem);

    const logItem = new StripeTreeItem('Open API logs page', {
      commandString: 'openDashboardLogs',
      iconPath: new ThemeIcon('link-external'),
    });

    items.push(logItem);

    const webhooksItem = new StripeTreeItem('Open webhooks page', {
      commandString: 'openDashboardWebhooks',
      iconPath: new ThemeIcon('link-external'),
    });

    items.push(webhooksItem);

    return Promise.resolve(items);
  }
Example #7
Source File: buttons.ts    From dendron with GNU Affero General Public License v3.0 6 votes vote down vote up
constructor(opts: DoctorBtnConstructorOpts) {
    const { iconOff, iconOn, type, title, pressed } = opts;
    this.iconPathNormal = new ThemeIcon(iconOff);
    this.iconPathPressed = new ThemeIcon(iconOn);
    this.type = type;
    this.pressed = pressed || false;
    this.title = title;

    // TODO: examine whether this is the behavior we actually want since
    // ths expression (opts.canToggle || true) will always return true
    // (as long as 'opts' is not undefined). Secondly 'this.canToggle'
    // does not appear to be used.
    this.canToggle = opts.canToggle || true;
    this.opts = opts;
  }
Example #8
Source File: export-factory.ts    From vscode-code-review with MIT License 6 votes vote down vote up
private getIcon(prio: number, priv: number): { light: string; dark: string } | ThemeIcon {
    switch (priv) {
      default: {
        // Public comments
        let icon = '';
        switch (prio) {
          case 3:
            icon = 'red.svg';
            break;
          case 2:
            icon = 'yellow.svg';
            break;
          case 1:
            icon = 'green.svg';
            break;
          default:
            icon = 'unset.svg';
            break;
        }

        const iPath = this.context.asAbsolutePath(path.join('dist', icon));
        return { light: iPath, dark: iPath };
      }

      case 1: {
        return new ThemeIcon(this.privateCommentIcon, themeColorForPriority(prio));
      }
    }
  }
Example #9
Source File: stripeSamplesView.ts    From vscode-stripe with MIT License 6 votes vote down vote up
buildTree(): Promise<StripeTreeItem[]> {
    const items = [];

    const samplesItem = new StripeTreeItem('Start with a Stripe Sample', {
      commandString: 'createStripeSample',
      iconPath: new ThemeIcon('repo-clone'),
      tooltip: 'Clone a sample integration built by Stripe',
      contextValue: 'samplesItem',
    });

    items.push(samplesItem);

    return Promise.resolve(items);
  }
Example #10
Source File: stripeWebhooksView.ts    From vscode-stripe with MIT License 6 votes vote down vote up
buildTree(): Promise<StripeTreeItem[]> {
    const items = [];

    const createEndpoint = new StripeTreeItem('Create a new webhook endpoint', {
      commandString: 'createWebhookEndpoint',
      iconPath: new ThemeIcon('add'),
      tooltip: 'Create a new webhook endpoint',
      contextValue: 'createWebhookEndpoint',
    });
    items.push(createEndpoint);

    if (this.endpointItems.length > 0) {
      const endpointsRootItem = new StripeTreeItem('All webhook endpoints');
      endpointsRootItem.children = this.endpointItems;
      endpointsRootItem.makeCollapsible();
      items.push(endpointsRootItem);
    }

    return Promise.resolve(items);
  }
Example #11
Source File: multiStepInput.ts    From cloudmusic-vscode with MIT License 6 votes vote down vote up
pickButtons: {
  forward: QuickInputButton;
  previous: QuickInputButton;
  next: QuickInputButton;
  close: QuickInputButton;
} = {
  forward: {
    iconPath: new ThemeIcon("arrow-right"),
    tooltip: i18n.word.forward,
  },
  previous: {
    iconPath: new ThemeIcon("arrow-up"),
    tooltip: i18n.word.previousPage,
  },
  next: {
    iconPath: new ThemeIcon("arrow-down"),
    tooltip: i18n.word.nextPage,
  },
  close: {
    iconPath: new ThemeIcon("close"),
    tooltip: i18n.word.close,
  },
}
Example #12
Source File: taskProvider.ts    From vscode-todo-md with MIT License 6 votes vote down vote up
constructor(
		readonly label: string,
		readonly task: TheTask,
		readonly command: Command,
	) {
		super(label);
		if (task.links.length) {
			this.contextValue = 'link';
		}
		if (task.subtasks.length) {
			if (task.isCollapsed) {
				this.collapsibleState = TreeItemCollapsibleState.Collapsed;
			} else {
				this.collapsibleState = TreeItemCollapsibleState.Expanded;
			}
		}

		if (task.done) {
			this.iconPath = new ThemeIcon('pass', new ThemeColor('todomd.treeViewCompletedTaskIcon'));
		} else {
			// this.iconPath = new ThemeIcon('circle-large-outline');// TODO: maybe
		}
	}
Example #13
Source File: ButtonTypes.ts    From dendron with GNU Affero General Public License v3.0 5 votes vote down vote up
public iconPathNormal: ThemeIcon;
Example #14
Source File: setDueDate.ts    From vscode-todo-md with MIT License 5 votes vote down vote up
/**
 * Open vscode input box that aids in creating of due date.
 */
export function openSetDueDateInputbox(document: TextDocument, lineNumbers: number[]) {
	const inputBox = window.createInputBox();
	let value: string | undefined = '+0';
	inputBox.value = value;
	inputBox.title = 'Set due date';
	const docsButtonName = 'Documentation';
	inputBox.onDidTriggerButton(e => {
		if (e.tooltip === docsButtonName) {
			followLink('https://github.com/usernamehw/vscode-todo-md/blob/master/docs/docs.md#set-due-date-helper-function-todomdsetduedate');
		}
	});
	inputBox.buttons = [{
		iconPath: new ThemeIcon('question'),
		tooltip: docsButtonName,
	}];
	inputBox.prompt = inputOffset(new DueDate(helpCreateDueDate(value)!).closestDueDateInTheFuture);
	inputBox.show();

	inputBox.onDidChangeValue((e: string) => {
		value = e;
		const newDueDate = helpCreateDueDate(value);
		if (!newDueDate) {
			inputBox.prompt = inputOffset('❌ Invalid');
			return;
		}
		inputBox.prompt = inputOffset(new DueDate(newDueDate).closestDueDateInTheFuture);
	});

	inputBox.onDidAccept(async () => {
		if (!value) {
			return;
		}
		const newDueDate = helpCreateDueDate(value);

		if (newDueDate) {
			const edit = new WorkspaceEdit();
			for (const line of lineNumbers) {
				setDueDateWorkspaceEdit(edit, document, line, newDueDate);
			}
			await applyEdit(edit, document);
			inputBox.hide();
			inputBox.dispose();
			updateEverything();
		}
	});
}
Example #15
Source File: DecorableNode.ts    From al-objid with MIT License 5 votes vote down vote up
protected abstract readonly _iconPath: string | Uri | { light: string | Uri; dark: string | Uri } | ThemeIcon;
Example #16
Source File: RootNode.ts    From al-objid with MIT License 5 votes vote down vote up
protected readonly _iconPath = ThemeIcon.Folder;
Example #17
Source File: ObjectTypeConsumptionNode.ts    From al-objid with MIT License 5 votes vote down vote up
protected _iconPath: string | Uri | { light: string | Uri; dark: string | Uri } | ThemeIcon;
Example #18
Source File: RangeNode.ts    From al-objid with MIT License 5 votes vote down vote up
protected override _iconPath: string | Uri | { light: string | Uri; dark: string | Uri } | ThemeIcon =
        NinjaIcon["arrow-both"];
Example #19
Source File: BacklinksTreeDataProvider.ts    From dendron with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
   * Takes found references corresponding to a single note and turn them into
   * TreeItems
   * @param refs list of found references (for a single note)
   * @param fsPath fsPath of current note
   * @param parent parent backlink of these refs.
   * @returns list of TreeItems of found references
   */
  private getAllBacklinksInNoteFromRefs = (
    refs: FoundRefT[],
    fsPath: string,
    parent: Backlink
  ) => {
    return refs.map((ref) => {
      const lineNum = ref.location.range.start.line;
      const backlink = Backlink.createRefLevelBacklink(ref);

      backlink.iconPath = ref.isCandidate
        ? new ThemeIcon(ICONS.LINK_CANDIDATE)
        : new ThemeIcon(ICONS.WIKILINK);
      backlink.parentBacklink = parent;
      backlink.description = `on line ${lineNum + 1}`;

      backlink.command = {
        command: DENDRON_COMMANDS.GOTO_BACKLINK.key,
        arguments: [
          ref.location.uri,
          { selection: ref.location.range },
          ref.isCandidate ?? false,
        ],
        title: "Open File",
      };
      if (ref.isCandidate) {
        backlink.command = {
          command: "dendron.convertCandidateLink",
          title: "Convert Candidate Link",
          arguments: [
            { location: ref.location, text: path.parse(fsPath).name },
          ],
        };
      }
      return backlink;
    });
  };
Example #20
Source File: ButtonTypes.ts    From dendron with GNU Affero General Public License v3.0 5 votes vote down vote up
public iconPathPressed: ThemeIcon;
Example #21
Source File: local.ts    From cloudmusic-vscode with MIT License 5 votes vote down vote up
override readonly iconPath = new ThemeIcon("file-directory");
Example #22
Source File: buttons.ts    From dendron with GNU Affero General Public License v3.0 5 votes vote down vote up
public iconPathPressed: ThemeIcon;
Example #23
Source File: buttons.ts    From dendron with GNU Affero General Public License v3.0 5 votes vote down vote up
public iconPathNormal: ThemeIcon;
Example #24
Source File: extension.ts    From vscode-file-browser with GNU Lesser General Public License v3.0 5 votes vote down vote up
stepInButton: QuickInputButton = {
        iconPath: new ThemeIcon("arrow-right"),
        tooltip: "Step into folder",
    };
Example #25
Source File: extension.ts    From vscode-file-browser with GNU Lesser General Public License v3.0 5 votes vote down vote up
stepOutButton: QuickInputButton = {
        iconPath: new ThemeIcon("arrow-left"),
        tooltip: "Step out of folder",
    };
Example #26
Source File: extension.ts    From vscode-file-browser with GNU Lesser General Public License v3.0 5 votes vote down vote up
actionsButton: QuickInputButton = {
        iconPath: new ThemeIcon("ellipsis"),
        tooltip: "Actions on selected file",
    };
Example #27
Source File: user.ts    From cloudmusic-vscode with MIT License 5 votes vote down vote up
override readonly iconPath = new ThemeIcon("account");
Example #28
Source File: radio.ts    From cloudmusic-vscode with MIT License 5 votes vote down vote up
override readonly iconPath = new ThemeIcon("radio-tower");
Example #29
Source File: radio.ts    From cloudmusic-vscode with MIT License 5 votes vote down vote up
override readonly iconPath = new ThemeIcon("rss");