vulnerability_item.ts 453 字节
Newer Older
T
Tomas Vik 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
import { TreeItem, Uri } from 'vscode';
import * as vscode from 'vscode';

export class VulnerabilityItem extends TreeItem {
  constructor(v: RestVulnerability) {
    super(`[${v.severity}] - ${v.name}`);
    const arg = v.location
      ? Uri.file(`${vscode.workspace.rootPath}/${v.location.file}`)
      : Uri.parse(v.web_url);
    this.command = {
      title: 'Open Vulnerability',
      command: 'vscode.open',
      arguments: [arg],
    };
  }
}