diff --git a/CHANGELOG.md b/CHANGELOG.md index ff080f98..95bc01f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/commands/ModuleInstantiation.ts b/src/commands/ModuleInstantiation.ts index 9f9f82aa..19396bbb 100644 --- a/src/commands/ModuleInstantiation.ts +++ b/src/commands/ModuleInstantiation.ts @@ -59,7 +59,7 @@ function instantiateModule(srcpath: string): Thenable { 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); diff --git a/src/ctags.ts b/src/ctags.ts index 4b8c58d4..27c1f6ed 100644 --- a/src/ctags.ts +++ b/src/ctags.ts @@ -52,6 +52,7 @@ export class Symbol { static isContainer(type: string): boolean { switch (type) { case 'constant': + case 'parameter': case 'event': case 'net': case 'port': @@ -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': @@ -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) => { @@ -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:') { + type = 'parameter'; + } + if (parts.length >= 5) { scope = parts[4].split(':'); parentType = scope[0]; parentScope = scope[1];