Skip to content

Commit 054b39a

Browse files
authored
Merge pull request mshr-h#457 from hirooih:use-uctag-parameter-field-option
use uctag parameter field option for module instantiation (mshr-h#102)
2 parents 189a3af + 0298d7e commit 054b39a

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66

7+
## [Unreleased] - 2023-12-xx
8+
9+
### Fixed
10+
11+
- Fix [#102](https://github.com/mshr-h/vscode-verilog-hdl-support/issues/102)
12+
- requires [Universal Ctags, Oct 22, 2020 version](https://github.com/universal-ctags/ctags/pull/2666) and later.
13+
714
## [1.13.0] 2023-08-31
815

916
### Added

src/commands/ModuleInstantiation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function instantiateModule(srcpath: string): Thenable<vscode.SnippetString> {
5959
portsName = ports.map((tag) => tag.name);
6060
let params: Symbol[] = ctags.symbols.filter(
6161
(tag) =>
62-
tag.type === 'constant' && tag.parentType === 'module' && tag.parentScope === scope
62+
tag.type === 'parameter' && tag.parentType === 'module' && tag.parentScope === scope
6363
);
6464
parametersName = params.map((tag) => tag.name);
6565
logger.info('Module name: ' + module.name);

src/ctags.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export class Symbol {
5252
static isContainer(type: string): boolean {
5353
switch (type) {
5454
case 'constant':
55+
case 'parameter':
5556
case 'event':
5657
case 'net':
5758
case 'port':
@@ -84,6 +85,8 @@ export class Symbol {
8485
switch (name) {
8586
case 'constant':
8687
return vscode.SymbolKind.Constant;
88+
case 'parameter':
89+
return vscode.SymbolKind.Constant;
8790
case 'event':
8891
return vscode.SymbolKind.Event;
8992
case 'function':
@@ -165,7 +168,7 @@ export class Ctags {
165168
vscode.workspace.getConfiguration().get('verilog.ctags.path', 'none')
166169
);
167170
if (binPath !== 'none') {
168-
let command: string = binPath + ' -f - --fields=+K --sort=no --excmd=n "' + filepath + '"';
171+
let command: string = binPath + ' -f - --fields=+K --sort=no --excmd=n --fields-SystemVerilog=+{parameter} "' + filepath + '"';
169172
this.logger.info('Executing Command: ' + command);
170173
return new Promise((resolve, _reject) => {
171174
child_process.exec(command, (_error: Error, stdout: string, _stderr: string) => {
@@ -185,7 +188,11 @@ export class Ctags {
185188
name = parts[0];
186189
// pattern = parts[2];
187190
type = parts[3];
188-
if (parts.length == 5) {
191+
// override "type" for parameters (See #102)
192+
if (parts.length == 6 && parts[5] === 'parameter:') {
193+
type = 'parameter';
194+
}
195+
if (parts.length >= 5) {
189196
scope = parts[4].split(':');
190197
parentType = scope[0];
191198
parentScope = scope[1];

0 commit comments

Comments
 (0)