From 181237bb3abead2a4b6bba3ce6a69be73eeecd1b Mon Sep 17 00:00:00 2001 From: Mohammad Kurjieh Date: Tue, 16 Mar 2021 01:43:01 +0200 Subject: [PATCH] Version 0.0.7 initial commit * Added Compile All. * Generated files are moved to ./build * Minor ts types improvements --- .gitignore | 1 + .vscode/settings.json | 7 + CHANGELOG.md | 6 + LICENSE | 1 + README.md | 21 +- images/icon.png | Bin 4694 -> 7653 bytes package-lock.json | 14 +- package.json | 68 ++-- src/commands.ts | 308 +++++++++++------- src/consts.ts | 4 + src/extension.ts | 24 +- ...ge.json => verilog_runner.tmLanguage.json} | 0 12 files changed, 299 insertions(+), 155 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 src/consts.ts rename syntaxes/{verilog.tmLanguage.json => verilog_runner.tmLanguage.json} (100%) diff --git a/.gitignore b/.gitignore index 8b3ca3c..98b5d9c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules .vsix out +*.vsix diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..f3000d0 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "workbench.colorCustomizations": { + "[Material Theme Darker]": { + "statusBar.debuggingBackground": "#212121" + } + } +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index e271300..00ac93e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Verilog Change Log +### [0.0.6] 2021-03-16 + +* Added Compile All. +* Generated files are moved to ./build +* Minor ts types improvements + ## [0.0.6] 2019-06-25 * Remove redundant code. diff --git a/LICENSE b/LICENSE index 254739d..ae48d59 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,7 @@ MIT License Copyright (c) 2017 leafvmaple +Copyright (c) 2021 Mohammad Kurjieh Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index bb52d79..16d2836 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,19 @@ +# A Fork Of This [Extension](https://github.com/leafvmaple/vscode-verilog) + +## Major new Features: +* Compile all verilog files in a directory +* Output moved to ./build + +
+
+ # Verilog Language README The Visual Studio Code extenstion for Verilog HDL Language support. ## Installation -Install it from [VS Code Marketplace](https://marketplace.visualstudio.com/items/itemName=leafvmaple.verilog) +Install it from [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=MohammadKurjieh.verilogrunner) ## Run Code @@ -20,12 +29,22 @@ Install it from [VS Code Marketplace](https://marketplace.visualstudio.com/items Use Icarus Verilog to run the current code. +* **Compile all Verilog HDL Files in a directory** + + Use Icarus Verilog to all the files in the directory. + * **Stop Running** Stop Running Code. ## Release Notes +### Version 0.0.7 + +* Added Compile All. +* Generated files are moved to ./build +* Minor ts types improvements + ### Version 0.0.6 * Remove redundant code. diff --git a/images/icon.png b/images/icon.png index 8a26feb6cfa23e6a835781c5aade1f8f10c3ad0e..9ee4adcd705b20f0036e82ea718f207c6f3251ce 100644 GIT binary patch literal 7653 zcmcIp2{_bk*C&-0MM)uzwJ43*_rX*4A}yA*s4kBB99`>vH+eJ?B2l@0{~HXU3_mTPzkWP+cG;CAG-P z(sa9&l=L#m@4Q*yguc|-0Q{NHv2@}|Ni9^A{7Oq*xTq{8wSdXA+sWT)V@;&8Jq#!` zwhP@r;K2dXQc`4N0f$0$qw_Uf=&nqbq1M2?A}tLj%}~n`V*|J0n9vU}E&aIk9e!Kv zsD5r#0!_=j0n6A;MrjK0XFMC<8Xv6^0-X2rxJjhD1Vv1eE8?;!^}r7EgOxgDIUy$8V04@n>N{~jKk>hxA-KUJxs4%)a z-Gk2J^MEX3MwWAc&1drtu>VB$%-er30HC$8nX&OxUpzc!Oz`+--XM(cfc#XNXXneI z!?x3TY%eaAZsrZ#)Sixp$KOu>7oPv%IuM__%psa^=@dSjYsY50PiJ}Sbi5i!gaJ}R z&ymTZv3+=JCDy)Qpqo>@Fqt$W6@jDSXc!6< zgT&LIcoZ4|rQi`%C;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dD4WIR9D8=ZtO5Yw|)~>plp}Fp!Nyn^QhjV1Nw-7KIM<_}|>c-&` zk4zg7CLa3A8$RtGMNCZlNWvqHH5;+_R|gDkvKysafB37UXIw9O&o33fiGX!lRh4{H z9wX=ce;Wmyx1Yy#(JwC#vmn*Fr&WH19Y`(JSKG1C-+STs;;@5AE*Yd)feY;*{N4W? zMX^@QNV^XkLb~i-?8|TEUM;E>h%jhcvA1hR2m~yrRg#4hJYo?^bQbC9O25(eUfc+u zTe9^ct7;Qh%3S`wAKa=y4N3`@=aC?A<7qn2Lt8W+MmpaXu}4k6(jK;u;P8*gWr`nQ z>W;sPYcq7do}{#FZVDAd`;@kz_@v(px(pYztj*`&Q} zcaW3ZAmN1UE#+l;+_$$LBtSmSJ?);rIhk_eSuw}H^(_ZX$vTVqE(~gJM~>W2vy5CX ztQTil{1%~tAu;LLd^RbIeq{4%sJGJUV3$BSUO&pX&fyN{)T-zKZ2vT!@3qthi2an% z=bn%QLhUh{LDFEzR|@(~4Ob{g@aocvlq2Lf(PdL^A!h%8) z{6a$fLc;n&f)F8bh@c>!pd{8x5$jg`AAyUT9n#+KuRw%fP=a4rTwhoSA|eVA5&o|r z@%;=xRsj85!OP7ag0De+OC5eF=C_x~eCNIMh)OYl$9ZDI+ge-Tim z3moO=4hR0z6WHC=L9W{HZ#Vz01l7k@l?`v)W3T;P9C!PCtR1@=Os{xcDP!@T^Ewr;Khu5c9C w*3Ok5>EiIei?*&{FHc*rkdUyj$bYS{m;kod)k&d#Y$-rZSyQQ8(K_sZ00KqMVgLXD diff --git a/package-lock.json b/package-lock.json index 0077673..bea5940 100644 --- a/package-lock.json +++ b/package-lock.json @@ -338,12 +338,12 @@ } }, "https-proxy-agent": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz", - "integrity": "sha512-HPCTS1LW51bcyMYbxUIOO4HEOlQ1/1qRaFWcyxvwaqUS9TY88aoEuHUY33kuAh1YhVVaDQhLZsnPd+XNARWZlQ==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz", + "integrity": "sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==", "dev": true, "requires": { - "agent-base": "^4.1.0", + "agent-base": "^4.3.0", "debug": "^3.1.0" } }, @@ -661,9 +661,9 @@ } }, "tree-kill": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.0.tgz", - "integrity": "sha512-DlX6dR0lOIRDFxI0mjL9IYg6OTncLm/Zt+JiBhE5OlFcAR8yc9S7FFXU9so0oda47frdM/JFsk7UjNt9vscKcg==" + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==" }, "tunnel-agent": { "version": "0.6.0", diff --git a/package.json b/package.json index 5a19ec6..ab67c66 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { - "name": "verilog", - "displayName": "Verilog HDL", + "name": "verilogrunner", + "displayName": "Verilog Compiler & Runner", "description": "Verilog HDL Language Support for Visual Studio Code.", - "version": "0.0.6", - "publisher": "leafvmaple", + "version": "0.0.7", + "publisher": "mohammadkurjieh", "icon": "images/icon.png", "engines": { "vscode": "^1.17.0" @@ -14,57 +14,74 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/leafvmaple/vscode-verilog" + "url": "https://github.com/MohammadKurjieh/vscode-verilog" }, "activationEvents": [ - "onCommand:verilog.run", - "onCommand:verilog.stop" + "onCommand:verilogrunner.run", + "onCommand:verilogrunner.compileAll", + "onCommand:verilogrunner.stop" ], "main": "./out/extension", "contributes": { "commands": [ { - "command": "verilog.run", - "title": "Verilog: Run Verilog HDL Code", - "icon": "images/icon.png" + "command": "verilogrunner.run", + "title": "Verilog: Compile & Run", + "icon": "$(notebook-execute)" }, { - "command": "verilog.stop", + "command": "verilogrunner.compileAll", + "title": "Verilog: Compile All Files", + "icon": "$(notebook-kernel-select)" + }, + { + "command": "verilogrunner.stop", "title": "Verilog: Stop Running" } ], "menus": { "editor/title": [ { - "when": "resourceLangId == verilog && config.verilog.showRunIconInEditorTitleMenu", - "command": "verilog.run", + "when": "resourceLangId == verilog && config.verilogrunner.showRunIconInEditorTitleMenu", + "command": "verilogrunner.run", + "group": "navigation" + }, + { + "when": "resourceLangId == verilog && config.verilogrunner.showRunIconInEditorTitleMenu", + "command": "verilogrunner.compileAll", "group": "navigation" } ] }, "configuration": { "type": "object", - "title": "Verilog configuration", + "title": "Verilog Runner configuration", "properties": { - "verilog.showRunIconInEditorTitleMenu": { + "verilogrunner.showRunIconInEditorTitleMenu": { "type": "boolean", "default": true, - "description": "Whether to show 'Run Verilog HDL' icon in editor title menu.", + "description": "Whether to show 'Run Verilog' icon in editor title menu.", "scope": "resource" }, - "verilog.runInTerminal": { + "verilogrunner.openVCD": { + "type": "boolean", + "default": true, + "description": "(DEV) Whether to open the vcd file in editor when done.", + "scope": "resource" + }, + "verilogrunner.runInTerminal": { "type": "boolean", "default": false, "description": "Whether to run code in Integrated Terminal.", "scope": "resource" }, - "verilog.clearPreviousOutput": { + "verilogrunner.clearPreviousOutput": { "type": "boolean", - "default": false, + "default": true, "description": "Whether to clear previous output before each run.", "scope": "resource" }, - "verilog.preserveFocus": { + "verilogrunner.preserveFocus": { "type": "boolean", "default": true, "description": "Whether to preserve focus on code editor after code run is triggered.", @@ -81,7 +98,8 @@ ], "extensions": [ ".v", - ".vh" + ".vh", + ".sv" ], "configuration": "./language-configuration.json" } @@ -90,7 +108,7 @@ { "language": "verilog", "scopeName": "source.verilog", - "path": "./syntaxes/verilog.tmLanguage.json" + "path": "./syntaxes/verilog_runner.tmLanguage.json" } ], "snippets": [ @@ -107,8 +125,8 @@ "postinstall": "node ./node_modules/vscode/bin/install" }, "dependencies": { - "tree-kill": "^1.1.0", - "iconv-lite": "^0.4.24" + "iconv-lite": "^0.4.24", + "tree-kill": "^1.2.2" }, "devDependencies": { "@types/mocha": "^2.2.42", @@ -116,4 +134,4 @@ "typescript": "^2.6.1", "vscode": "^1.1.34" } -} +} \ No newline at end of file diff --git a/src/commands.ts b/src/commands.ts index bb57586..7e84a83 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -1,134 +1,216 @@ "use strict"; import { basename, dirname } from "path"; import * as vscode from "vscode"; +import { AvailableCommands } from './consts'; +import fs = require('fs'); export class Commands implements vscode.Disposable { - private LANGUAGE_NAME = "Verilog"; - private EXTENTSION_NAME = "verilog"; - private COMPILE_COMMANDS = "iverilog -o {fileName}.out {fileName}"; - private EXECUTE_COMMANDS = "vvp {fileName}.out"; - - private outputChannel: vscode.OutputChannel; - private terminal: vscode.Terminal; - private config: vscode.WorkspaceConfiguration; - private document: vscode.TextDocument; - private cwd: string; - private isRunning: boolean; - private isCompiling: boolean; - private isSuccess: boolean; - private compileProcess; - private executeProcess; - - constructor() { - this.outputChannel = vscode.window.createOutputChannel(this.LANGUAGE_NAME); - this.terminal = vscode.window.createTerminal(this.LANGUAGE_NAME); + private LANGUAGE_NAME = "Verilog"; + private EXTENTSION_NAME = "verilogrunner"; + private COMPILE_COMMANDS = "iverilog -o build/{fileName}.out {fileName}"; + private RUN_COMMANDS = "vvp {fileName}.out"; + + private outputChannel: vscode.OutputChannel; + private terminal: vscode.Terminal; + private config: vscode.WorkspaceConfiguration; + private document: vscode.TextDocument; + private cwd: string; + private isRunning: boolean; + private isCompiling: boolean; + private isSuccess: boolean; + private compileProcess; + private executeProcess; + + constructor() { + this.outputChannel = vscode.window.createOutputChannel(this.LANGUAGE_NAME); + this.terminal = vscode.window.createTerminal(this.LANGUAGE_NAME); + } + + public async executeCommand(fileUri: vscode.Uri, command: AvailableCommands) { + if (this.isRunning) { + vscode.window.showInformationMessage("Code is already running!"); + return; } - public async executeCommand(fileUri: vscode.Uri) { - if (this.isRunning) { - vscode.window.showInformationMessage("Code is already running!"); - return; - } + const editor = vscode.window.activeTextEditor; + if (fileUri && editor && fileUri.fsPath !== editor.document.uri.fsPath) { + this.document = await vscode.workspace.openTextDocument(fileUri); + } else if (editor) { + this.document = editor.document; + } else { + vscode.window.showInformationMessage("No code found or selected."); + return; + } - const editor = vscode.window.activeTextEditor; - if (fileUri && editor && fileUri.fsPath !== editor.document.uri.fsPath) { - this.document = await vscode.workspace.openTextDocument(fileUri); - } else if (editor) { - this.document = editor.document; - } else { - vscode.window.showInformationMessage("No code found or selected."); - return; - } + const fileName = basename(this.document.fileName); + this.cwd = dirname(this.document.fileName); + this.config = vscode.workspace.getConfiguration(this.EXTENTSION_NAME); + const runInTerminal = this.config.get("runInTerminal"); + const clearPreviousOutput = this.config.get("clearPreviousOutput"); + const preserveFocus = this.config.get("preserveFocus"); + const openVCD = this.config.get("openVCD"); - const fileName = basename(this.document.fileName); - this.cwd = dirname(this.document.fileName); - this.config = vscode.workspace.getConfiguration(this.EXTENTSION_NAME); - const runInTerminal = this.config.get("runInTerminal"); - const clearPreviousOutput = this.config.get("clearPreviousOutput"); - const preserveFocus = this.config.get("preserveFocus"); + if (command === AvailableCommands.runFile) { + this.runFile(runInTerminal, fileName, clearPreviousOutput, preserveFocus, openVCD); + } else if (AvailableCommands.compileAll) { + this.compileAll(runInTerminal, this.cwd, clearPreviousOutput, preserveFocus) + } + } + + public runFile(runInTerminal: boolean, fileName: string, clearPreviousOutput: boolean, preserveFocus: boolean, openVCD: boolean): void { + if (runInTerminal) { + this.executeRunInTerminal(fileName, clearPreviousOutput, preserveFocus); + } else { + this.executeRunInOutputChannel(fileName, clearPreviousOutput, preserveFocus, openVCD); + } + } + + public async compileAll(runInTerminal: boolean, directory: string, clearPreviousOutput: boolean, preserveFocus: boolean): Promise { + if (clearPreviousOutput) { + if (runInTerminal) { + vscode.commands.executeCommand("workbench.action.terminal.clear"); + } else { + this.outputChannel.clear(); + } + } + this.outputChannel.appendLine(`[Compiling Started]`); + this.outputChannel.appendLine(""); + const startTime = new Date(); + + for (const file of fs.readdirSync(directory)) { + if (file.match(/^(.*)+(.v|.vh|.sv)$/)) { if (runInTerminal) { - this.executeCommandInTerminal(fileName, clearPreviousOutput, preserveFocus); + this.executeCompileInTerminal(file, false, preserveFocus); } else { - this.executeCommandInOutputChannel(fileName, clearPreviousOutput, preserveFocus); + await this.executeCompileInOutputChannel(file, false, preserveFocus, true); } - } + } + }; + const endTime = new Date(); + const elapsedTime = (endTime.getTime() - startTime.getTime()) / 1000; + this.outputChannel.appendLine(`[Done] Compiling Done in ${elapsedTime} seconds`); + this.outputChannel.appendLine(""); + } - public executeCommandInTerminal(fileName: string, clearPreviousOutput, preserveFocus): void { - if (clearPreviousOutput) { - vscode.commands.executeCommand("workbench.action.terminal.clear"); - } - this.terminal.show(preserveFocus); - this.terminal.sendText(`cd "${this.cwd}"`); - this.terminal.sendText(this.COMPILE_COMMANDS.replace(/{fileName}/g, fileName)); - this.terminal.sendText(this.EXECUTE_COMMANDS.replace(/{fileName}/g, fileName)); + public executeRunInTerminal(fileName: string, clearPreviousOutput: boolean, preserveFocus: boolean): void { + this.executeCompileInTerminal(fileName, clearPreviousOutput, preserveFocus); + this.terminal.sendText(`cd build`); + this.terminal.sendText(this.RUN_COMMANDS.replace(/{fileName}/g, fileName)); + } + + public executeCompileInTerminal(fileName: string, clearPreviousOutput: boolean, preserveFocus: boolean): void { + if (clearPreviousOutput) { + vscode.commands.executeCommand("workbench.action.terminal.clear"); } + this.terminal.show(preserveFocus); + this.terminal.sendText(`cd "${this.cwd}"`); + this.terminal.sendText(`mkdir build`); + this.terminal.sendText(this.COMPILE_COMMANDS.replace(/{fileName}/g, fileName)); + } + + public async executeRunInOutputChannel(fileName: string, clearPreviousOutput: boolean, preserveFocus: boolean, openVCD: boolean): Promise { + + await this.executeCompileInOutputChannel(fileName, clearPreviousOutput, preserveFocus); + + this.isRunning = true; + const exec = require("child_process").exec; + const startTime = new Date(); + this.outputChannel.appendLine(`[Run] ${basename(fileName)}`); + return new Promise((res, _rej) => { + + this.executeProcess = exec(this.RUN_COMMANDS.replace(/{fileName}/g, fileName), { cwd: this.cwd + '/build' }); + + this.executeProcess.stdout.on("data", (data: string) => { + this.outputChannel.append(this.indent(`${data}`)); + }); + + this.executeProcess.stderr.on("data", (data: string) => { + this.outputChannel.append(this.indent(`${data}`)); + }); + + this.executeProcess.on("close", (executeCode: string) => { + this.isRunning = false; + const endTime = new Date(); + const elapsedTime = (endTime.getTime() - startTime.getTime()) / 1000; + this.outputChannel.appendLine(`[Done] exit with code=${executeCode} in ${elapsedTime} seconds`); + this.outputChannel.appendLine(""); + // if (openVCD) { + // vscode.workspace.openTextDocument(this.cwd + `\\build\\${fileName.replace(/\.[^/.]+$/, "")}.vcd`).then(doc => { + // vscode.window.showTextDocument(doc); + // }); + // } + res(); + }); + }); + } + + public async executeCompileInOutputChannel(fileName: string, clearPreviousOutput: boolean, preserveFocus: boolean, bulk = false): Promise { + return new Promise((res, _rej) => { + const indent = bulk ? " " : ""; + if (clearPreviousOutput) { + this.outputChannel.clear(); + } + this.isRunning = true; + this.isCompiling = true; + this.isSuccess = true; + this.outputChannel.show(preserveFocus); + this.outputChannel.appendLine(`${indent}[Compile] ${basename(fileName)}`); + const exec = require("child_process").exec; + const startTime = new Date(); - public executeCommandInOutputChannel(fileName: string, clearPreviousOutput, preserveFocus): void { - if (clearPreviousOutput) { - this.outputChannel.clear(); + exec('mkdir build', { cwd: this.cwd }); + this.compileProcess = exec(this.COMPILE_COMMANDS.replace(/{fileName}/g, fileName), { cwd: this.cwd }); + + this.compileProcess.stdout.on("data", (data: string) => { + this.outputChannel.append(this.indent(`${data}`, bulk)); + if (data.match("I give up.")) { + this.isSuccess = false; } - this.isRunning = true; - this.isCompiling = true; - this.isSuccess = true; - this.outputChannel.show(preserveFocus); - this.outputChannel.appendLine(`[Running] ${basename(fileName)}`); - const exec = require("child_process").exec; - const startTime = new Date(); - this.compileProcess = exec(this.COMPILE_COMMANDS.replace(/{fileName}/g, fileName), { cwd: this.cwd }); - - this.compileProcess.stdout.on("data", (data) => { - this.outputChannel.append(data); - if (data.match("I give up.")) { - this.isSuccess = false; - } - }); - - this.compileProcess.stderr.on("data", (data) => { - this.outputChannel.append(data); - this.isSuccess = false; - }); - - this.compileProcess.on("close", (compileCode) => { - this.isCompiling = false; - - if (this.isSuccess) { - - this.executeProcess = exec(this.EXECUTE_COMMANDS.replace(/{fileName}/g, fileName), { cwd: this.cwd }); - this.executeProcess.stdout.on("data", (data) => { - this.outputChannel.append(data); - }); - this.executeProcess.stderr.on("data", (data) => { - this.outputChannel.append(data); - }); - this.executeProcess.on("close", (executeCode) => { - this.isRunning = false; - const endTime = new Date(); - const elapsedTime = (endTime.getTime() - startTime.getTime()) / 1000; - this.outputChannel.appendLine(`[Done] exit with code=${executeCode} in ${elapsedTime} seconds`); - this.outputChannel.appendLine(""); - }); - } else { - this.isRunning = false; - this.outputChannel.appendLine(`[Compile Failed]`); - this.outputChannel.appendLine(""); - } - }); - } + }); - public stopCommand() { - if (this.isRunning) { - this.isRunning = false; - const kill = require("tree-kill"); - if (this.isCompiling) { - this.isCompiling = false; - kill(this.compileProcess.pid); - } else { - kill(this.executeProcess.pid); - } + this.compileProcess.stderr.on("data", (data: string) => { + this.outputChannel.append(this.indent(`${data}`, bulk)); + this.isSuccess = false; + }); + + this.compileProcess.on("close", (compileCode: string) => { + this.isCompiling = false; + this.isRunning = false; + const endTime = new Date(); + const elapsedTime = (endTime.getTime() - startTime.getTime()) / 1000; + if (this.isSuccess) { + this.outputChannel.appendLine(`${indent}[Done] exit with code=${compileCode} in ${elapsedTime} seconds`); + this.outputChannel.appendLine(""); + res(); + } else { + this.outputChannel.appendLine(`${indent}[Error] exit with code=${compileCode} in ${elapsedTime} seconds`); + this.outputChannel.appendLine(""); + res(); } - } + }); + }); + } - public dispose() { - this.stopCommand(); + public stopCommand() { + if (this.isRunning) { + this.isRunning = false; + const kill = require("tree-kill"); + if (this.isCompiling) { + this.isCompiling = false; + kill(this.compileProcess.pid); + } else { + kill(this.executeProcess.pid); + } } + } + + public dispose() { + this.stopCommand(); + } + + public indent(string: string, bulk = false) { + var split = string.slice(0, -1).split('\n'); + split = split.map(l => (bulk ? ' ' : ' ') + l); + return split.join('\n'); + } } diff --git a/src/consts.ts b/src/consts.ts new file mode 100644 index 0000000..cf50ee5 --- /dev/null +++ b/src/consts.ts @@ -0,0 +1,4 @@ +export enum AvailableCommands { + runFile, + compileAll, +} \ No newline at end of file diff --git a/src/extension.ts b/src/extension.ts index 91f98cb..1c412ac 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -1,23 +1,29 @@ "use strict"; import * as vscode from "vscode"; import { Commands } from "./commands"; +import { AvailableCommands } from './consts'; const commands = new Commands(); export function activate(context: vscode.ExtensionContext) { - const run = vscode.commands.registerCommand("verilog.run", (fileUri: vscode.Uri) => { - commands.executeCommand(fileUri); - }); + const run = vscode.commands.registerCommand("verilogrunner.run", (fileUri: vscode.Uri) => { + commands.executeCommand(fileUri, AvailableCommands.runFile); + }); - const stop = vscode.commands.registerCommand("verilog.stop", () => { - commands.stopCommand(); - }); + const compileAll = vscode.commands.registerCommand("verilogrunner.compileAll", (fileUri: vscode.Uri) => { + commands.executeCommand(fileUri, AvailableCommands.compileAll); + }); - context.subscriptions.push(run); - context.subscriptions.push(commands); + const stop = vscode.commands.registerCommand("verilogrunner.stop", () => { + commands.stopCommand(); + }); + + context.subscriptions.push(run); + context.subscriptions.push(compileAll); + context.subscriptions.push(commands); } export function deactivate() { - commands.stopCommand(); + commands.stopCommand(); } diff --git a/syntaxes/verilog.tmLanguage.json b/syntaxes/verilog_runner.tmLanguage.json similarity index 100% rename from syntaxes/verilog.tmLanguage.json rename to syntaxes/verilog_runner.tmLanguage.json