Skip to content

feat(code-actions, document-symbols): add more code actions and support for structs in document symbols#239

Merged
hongjr03 merged 6 commits into
masterfrom
feat/more-actions
Jun 8, 2026
Merged

feat(code-actions, document-symbols): add more code actions and support for structs in document symbols#239
hongjr03 merged 6 commits into
masterfrom
feat/more-actions

Conversation

@roife
Copy link
Copy Markdown
Member

@roife roife commented Jun 7, 2026

  • Add struct document symbols for typedef struct/union declarations, including nested generate/block scopes, and map them to LSP STRUCT.
  • Add assists:
    • reformat_number_literal
    • convert_named_port_connection_shorthand
    • convert_always_block
    • convert_port_declarations
    • remove_parentheses
    • merge_nested_if
    • extract_variable
    • pull_assignment_up
    • pull_assignment_down
  • Add assists description in comments

Copilot AI review requested due to automatic review settings June 7, 2026 18:32
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 7, 2026

Docs preview: https://vide.pascal-lab.net/preview/pr-239/

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands the IDE/LSP feature set by adding several new code actions (assists) and enhancing document symbol support so typedef struct/union declarations are surfaced as STRUCT symbols in LSP clients. It also updates the supporting plumbing (i18n keys, LSP title mapping, test utilities, and some HIR/display helpers) to make these features discoverable and testable.

Changes:

  • Add multiple new code action handlers (e.g., extract variable, remove redundant parentheses, convert always blocks, convert port declarations, merge nested if, pull assignment up/down) plus extensive unit/integration tests.
  • Improve document symbols: introduce SymbolKind::Struct, map it to LSP STRUCT, and add coverage for typedef struct/union (including nested generate scopes).
  • Extend localization/i18n and code-action title key mapping for newly added actions.

Reviewed changes

Copilot reviewed 41 out of 41 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/tests.rs Test helpers for precise range selection in code action requests; enable REFACTOR_EXTRACT capability in client caps.
src/lsp_ext/to_proto.rs Map SymbolKind::Struct to LSP STRUCT; add i18n title-key routing for new code actions.
src/i18n/en.toml Add English strings for new code actions (incl. digit separator removal).
src/i18n/zh-CN.toml Add/adjust Chinese strings for new code actions and refine De Morgan descriptions.
src/i18n.rs Add i18n key constants for newly introduced code actions.
crates/slang/bindings/rust/ast.rs Add only_children() helpers on list wrappers for “exactly one child” extraction.
crates/ide/src/verilog_2005.rs Add document symbol regression test for typedef struct/union (including nested generate).
crates/ide/src/rename.rs Adjust same-name port-connection handling using token value_text() comparisons.
crates/ide/src/lib.rs Add SymbolKind::Struct variant.
crates/ide/src/document_symbols.rs Emit struct-related document symbols and treat typedef’d structs as Struct kind.
crates/ide/src/code_action/tests.rs Add many new unit tests; introduce selection-range test utilities.
crates/ide/src/code_action/handlers.rs Register new code action handlers.
crates/ide/src/code_action/context.rs Minor formatting-only change.
crates/ide/src/code_action/handlers/wrap_statement_in_begin_end.rs Add assist documentation comments.
crates/ide/src/code_action/handlers/split_declaration_declarators.rs Add assist documentation comments.
crates/ide/src/code_action/handlers/sort_named_instantiation_items.rs Add assist documentation comments.
crates/ide/src/code_action/handlers/remove_parentheses.rs New assist: remove redundant parentheses with precedence/associativity rules.
crates/ide/src/code_action/handlers/remove_empty_port_connections.rs Add assist documentation comments.
crates/ide/src/code_action/handlers/reformat_number_literal.rs New assist: add/remove digit separators in integer literals.
crates/ide/src/code_action/handlers/pull_assignment_up.rs New assists: pull assignment up/down (if/else ↔ ternary).
crates/ide/src/code_action/handlers/merge_nested_if.rs New assist: merge nested if chains without else branches.
crates/ide/src/code_action/handlers/invert_if_else.rs Add assist documentation comments.
crates/ide/src/code_action/handlers/insert_expected_token.rs Add assist documentation comments.
crates/ide/src/code_action/handlers/extract_variable.rs New assist: extract a selected expression into a new variable/net declaration.
crates/ide/src/code_action/handlers/expand_postfix_inc_dec.rs Add assist documentation comments.
crates/ide/src/code_action/handlers/expand_compound_assignment.rs Add assist documentation comments.
crates/ide/src/code_action/handlers/convert_port_declarations.rs New assist: convert ANSI ↔ non-ANSI port declarations.
crates/ide/src/code_action/handlers/convert_ordered_connections.rs Add assist documentation comments.
crates/ide/src/code_action/handlers/convert_named_port_connections.rs New assist: expand/collapse named port shorthand connections.
crates/ide/src/code_action/handlers/convert_literal_base.rs Add assist documentation comments.
crates/ide/src/code_action/handlers/convert_always_block.rs New assist: convert between always, always_comb, and always_ff when safe.
crates/ide/src/code_action/handlers/apply_de_morgan.rs Add assist documentation comments.
crates/ide/src/code_action/handlers/add_missing_parameters.rs Add assist documentation comments.
crates/ide/src/code_action/handlers/add_missing_connections.rs Add assist documentation comments.
crates/ide/src/code_action/handlers/add_instance_parens.rs Add assist documentation comments.
crates/ide/src/code_action/handlers/add_implicit_named_port_parens.rs Add assist documentation comments.
crates/ide/src/code_action/handlers/add_default_case_item.rs Add assist documentation comments.
crates/hir/src/hir_def/subroutine.rs Switch to lower_ident_opt in name lowering paths.
crates/hir/src/hir_def/expr/data_ty.rs Fix default signing inference for vector types (avoid default-signed vectors).
crates/hir/src/hir_def/aggregate.rs Extend StructSrc with typedef-name pointer and implement IsNamedSrc for it.
crates/hir/src/display.rs Improve type-display formatting for signing/dimensions (ordering/spacing).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/ide/src/document_symbols.rs
@roife roife changed the title feat(code actions, document symbols): add more code actions and support for structs in document symbols feat(code-actions, document-symbols): add more code actions and support for structs in document symbols Jun 8, 2026
@hongjr03 hongjr03 merged commit e2ac7fc into master Jun 8, 2026
12 checks passed
@hongjr03 hongjr03 deleted the feat/more-actions branch June 8, 2026 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants