Skip to content

Package-scoped completion omits enum literals #139

@FukangZ

Description

@FukangZ

Summary

Completion after package_name:: shows the enum typedef name, but does not show enum literals declared by that typedef.

This affects common SystemVerilog workflows where enum values are referenced with package scope, for example state_pkg::IDLE.

Environment

  • OS: Windows
  • VS Code version:
  • Vizsla extension version:
  • Vizsla server version:

Minimal Reproduction

Create a workspace with these files:

completion-package-enum-literals/
  .vscode/
    settings.json
  vizsla.toml
  top.sv

.vscode/settings.json:

{
  "editor.wordBasedSuggestions": "off",
  "editor.snippetSuggestions": "none"
}

vizsla.toml:

#:schema https://pascal-lab.github.io/vizsla/schemas/v1/vizsla.schema.json

top_modules = ["top"]

sources = [
  "top.sv",
]

top.sv:

package enum_pkg;
  localparam int PKG_WIDTH = 8;

  typedef enum logic [1:0] {
    MODE_IDLE,
    MODE_RUN,
    MODE_DONE
  } mode_e;
endpackage

module top;
  import enum_pkg::*;

  enum_pkg::mode_e mode_q;

  initial begin
    mode_q = enum_pkg::;
  end
endmodule

Reproduction Steps

  1. Open the completion-package-enum-literals/ directory in VS Code.
  2. Wait until Vizsla is ready.
  3. Open top.sv.
  4. Put the cursor after enum_pkg:: in this line:
mode_q = enum_pkg::;
  1. Trigger completion with Ctrl+Space.

Expected

The completion list should include package members, including enum literals:

PKG_WIDTH
mode_e
MODE_IDLE
MODE_RUN
MODE_DONE

In particular, enum literals should be discoverable because these are valid package-scoped enum values:

enum_pkg::MODE_IDLE
enum_pkg::MODE_RUN
enum_pkg::MODE_DONE

Actual

The completion list includes the enum typedef name:

mode_e

But it does not include the enum literals:

MODE_IDLE
MODE_RUN
MODE_DONE

Metadata

Metadata

Assignees

No one assigned

    Labels

    known-limitThis is a known limit and may be implemented in future.sv-supportThis issue is related to system verilog supports.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions