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 | /* * This file is released under the MIT license. * Copyright (c) 2017, 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 Import extends TreeItem { public iconPath = { light: path.join(__dirname, "..", "..", "..", "misc", "dependency-light.svg"), dark: path.join(__dirname, "..", "..", "..", "misc", "dependency-dark.svg"), }; public contextValue = "grammar-dependency"; public constructor( public readonly label: string, public readonly collapsibleState: TreeItemCollapsibleState, command?: Command, ) { super(label, collapsibleState); this.command = command; } } export class ImportsProvider extends AntlrTreeDataProvider<Import> { public getChildren(element?: Import): ProviderResult<Import[]> { Iif (!element) { let dependencies; Iif (this.currentFile) { dependencies = this.backend.getDependencies(this.currentFile); } Iif (dependencies) { const imports: Import[] = []; for (const dep of dependencies) { imports.push(new Import(path.basename(dep), TreeItemCollapsibleState.None, { title: "<unused>", command: "antlr.openGrammar", arguments: [dep], })); } return new Promise((resolve) => { resolve(imports); }); } } return new Promise((resolve) => { resolve([]); }); } } |