diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a5b92b1..29fece3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,41 +4,46 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)\ +## UNRELEASED + +### Changed +- Better logging for ctags exection errors + ## [1.15.0] - 2024-08-26 -## Added +### Added - Pass arguments to lsp [#446][https://github.com/mshr-h/vscode-verilog-hdl-support/issues/446] -## Fixed +### Fixed - Fix #479 by add parameters back into Module instantiation [#496](https://github.com/mshr-h/vscode-verilog-hdl-support/pull/496) ## [1.14.3] - 2024-07-30 -## Added +### Added - Verilator linter stderr passthrough [#489](https://github.com/mshr-h/vscode-verilog-hdl-support/issues/489) - When linting using Verilator, all detected problems are highlighted (By default it's just current file and it's dependencies. Verilator launch config can be adjusted in linting settings) -## Fixed +### Fixed - Imroved regex matcher for Verilator output - Verilator output blocks are correctly tagged with `[error]` or `[warning]` ## [1.14.2] - 2024-07-24 -## Fixed +### Fixed - Show error log when verilator cannot be executed [#489](https://github.com/mshr-h/vscode-verilog-hdl-support/issues/489) ## [1.14.1] - 2024-04-19 -## Added +### Added - Enable verible-verilog-ls for Verilog filetype ## [1.14.0] - 2024-04-19 -## Changed +### Changed - Update SystemVerilog syntax highlighting diff --git a/src/ctags.ts b/src/ctags.ts index 24a2ed08..695206e1 100644 --- a/src/ctags.ts +++ b/src/ctags.ts @@ -1,8 +1,9 @@ // SPDX-License-Identifier: MIT import * as vscode from 'vscode'; -import * as child_process from 'child_process'; +import {exec as execNonPromise} from 'child_process'; +import * as util from 'util'; import { Logger } from './logger'; -import { text } from 'stream/consumers'; +const exec = util.promisify(execNonPromise); // Internal representation of a symbol export class Symbol { @@ -169,11 +170,21 @@ export class Ctags { if (binPath !== 'none') { let command: string = binPath + ' -f - --fields=+K --sort=no --excmd=n --fields-SystemVerilog=+{parameter} "' + filepath + '"'; this.logger.info('Executing Command: ' + command); - return new Promise((resolve, _reject) => { - child_process.exec(command, (_error: Error, stdout: string, _stderr: string) => { - resolve(stdout); - }); - }); + try { + const {stdout, stderr} = await exec(command); + if(stdout) { + return stdout.toString(); + } + if(stderr) { + this.logger.error('stderr> ' + stderr); + } + } + catch (e) { + this.logger.error('Exception caught: ' + e.message + ' ' + e.data); + } + } + else { + this.logger.trace('Ctags binpath not set'); } // Return empty promise if ctags path is not set to avoid errors when indexing return Promise.resolve(''); @@ -268,7 +279,7 @@ export class Ctags { async index(): Promise { this.logger.info('indexing ', this.doc.uri.fsPath); - let output = await this.execCtags(this.doc.uri.fsPath) + let output = await this.execCtags(this.doc.uri.fsPath); await this.buildSymbolsList(output); } }