Skip to content

Commit

Permalink
Merge pull request #457 from hirooih:use-uctag-parameter-field-option
Browse files Browse the repository at this point in the history
use uctag parameter field option for module instantiation (#102)
  • Loading branch information
mshr-h authored Jan 15, 2024
2 parents 189a3af + 0298d7e commit 054b39a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ 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] - 2023-12-xx

### Fixed

- Fix [#102](https://github.com/mshr-h/vscode-verilog-hdl-support/issues/102)
- requires [Universal Ctags, Oct 22, 2020 version](https://github.com/universal-ctags/ctags/pull/2666) and later.

## [1.13.0] 2023-08-31

### Added
Expand Down
2 changes: 1 addition & 1 deletion src/commands/ModuleInstantiation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function instantiateModule(srcpath: string): Thenable<vscode.SnippetString> {
portsName = ports.map((tag) => tag.name);
let params: Symbol[] = ctags.symbols.filter(
(tag) =>
tag.type === 'constant' && tag.parentType === 'module' && tag.parentScope === scope
tag.type === 'parameter' && tag.parentType === 'module' && tag.parentScope === scope
);
parametersName = params.map((tag) => tag.name);
logger.info('Module name: ' + module.name);
Expand Down
11 changes: 9 additions & 2 deletions src/ctags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export class Symbol {
static isContainer(type: string): boolean {
switch (type) {
case 'constant':
case 'parameter':
case 'event':
case 'net':
case 'port':
Expand Down Expand Up @@ -84,6 +85,8 @@ export class Symbol {
switch (name) {
case 'constant':
return vscode.SymbolKind.Constant;
case 'parameter':
return vscode.SymbolKind.Constant;
case 'event':
return vscode.SymbolKind.Event;
case 'function':
Expand Down Expand Up @@ -165,7 +168,7 @@ export class Ctags {
vscode.workspace.getConfiguration().get('verilog.ctags.path', 'none')
);
if (binPath !== 'none') {
let command: string = binPath + ' -f - --fields=+K --sort=no --excmd=n "' + filepath + '"';
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) => {
Expand All @@ -185,7 +188,11 @@ export class Ctags {
name = parts[0];
// pattern = parts[2];
type = parts[3];
if (parts.length == 5) {
// override "type" for parameters (See #102)
if (parts.length == 6 && parts[5] === 'parameter:') {

Check warning on line 192 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 192 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 192 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) {
scope = parts[4].split(':');
parentType = scope[0];
parentScope = scope[1];
Expand Down

0 comments on commit 054b39a

Please sign in to comment.