Skip to content

Better logging for ctags exection #498

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
27 changes: 19 additions & 8 deletions src/ctags.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -169,11 +170,21 @@
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('');
Expand All @@ -189,7 +200,7 @@
// pattern = parts[2];
type = parts[3];
// override "type" for parameters (See #102)
if (parts.length == 6 && parts[5] === 'parameter:') {

Check warning on line 203 in src/ctags.ts

View workflow job for this annotation

GitHub Actions / Upload vsix package (macos-latest)

Expected '===' and instead saw '=='

Check warning on line 203 in src/ctags.ts

View workflow job for this annotation

GitHub Actions / Upload vsix package (ubuntu-latest)

Expected '===' and instead saw '=='

Check warning on line 203 in src/ctags.ts

View workflow job for this annotation

GitHub Actions / Upload vsix package (windows-latest)

Expected '===' and instead saw '=='
type = 'parameter';
}
if (parts.length >= 5) {
Expand Down Expand Up @@ -268,7 +279,7 @@
async index(): Promise<void> {
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);
}
}
Expand Down
Loading