Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | /* * This file is released under the MIT license. * Copyright (c) 2018, 2022, Mike Lischke * * See LICENSE file for more info. */ /* eslint-disable max-classes-per-file */ import * as path from "path"; import { TreeItem, TreeItemCollapsibleState, Command, ProviderResult } from "vscode"; import { AntlrTreeDataProvider } from "./AntlrTreeDataProvider"; export class ChannelEntry extends TreeItem { public iconPath = { light: path.join(__dirname, "..", "..", "..", "misc", "channel-light.svg"), dark: path.join(__dirname, "..", "..", "..", "misc", "channel-dark.svg"), }; public contextValue = "channels"; public constructor( public readonly label: string, public readonly collapsibleState: TreeItemCollapsibleState, command?: Command, ) { super(label, collapsibleState); this.command = command; } } export class ChannelsProvider extends AntlrTreeDataProvider<ChannelEntry> { public getChildren(element?: ChannelEntry): ProviderResult<ChannelEntry[]> { Iif (!element) { let channels; Iif (this.currentFile) { channels = this.backend.getChannels(this.currentFile); } Iif (channels) { const list: ChannelEntry[] = []; for (const channel of channels) { Iif (!channel || channel === "null") { continue; } list.push(new ChannelEntry(channel, TreeItemCollapsibleState.None, { title: "<unused>", command: "", arguments: [], })); } return new Promise((resolve) => { resolve(list); }); } } return new Promise((resolve) => { resolve([]); }); } } |