Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[circt-verilog-lsp] Add inlay hints support for Verilog LSP server #8303

Open
wants to merge 1 commit into
base: dev/hidetou/lsp-features/vscode
Choose a base branch
from

Conversation

uenoku
Copy link
Member

@uenoku uenoku commented Mar 6, 2025

This commit adds inlay hint support to the Verilog LSP server. It currently supports two ways of displaying inlay hints:

  1. Built-in inlay hints for function calls and module instantiations, showing port types and directions (in/out/inout).

  2. User-provided inlay hints through a custom LSP extension method "verilog/putUserProvidedInlayHints", allowing clients to add contextual information to Verilog symbols.

The implementation includes:

  • Protocol extensions for user-provided inlay hints
  • Visitor pattern for traversing the AST to find hint locations
  • Support for refreshing hints when they are updated

This commit adds inlay hint support to the Verilog LSP server.
It currently supports two ways of displaying inlay hints:

1. Built-in inlay hints for function calls and module instantiations,
   showing port types and directions (in/out/inout).

2. User-provided inlay hints through a custom LSP extension method
   "verilog/putUserProvidedInlayHints", allowing clients to add
   contextual information to Verilog symbols.

The implementation includes:
- Protocol extensions for user-provided inlay hints
- Visitor pattern for traversing the AST to find hint locations
- Support for refreshing hints when they are updated
@@ -521,14 +652,20 @@ struct VerilogIndexer : slang::ast::ASTVisitor<VerilogIndexer, true, true> {
isDefinition);
}

// Handle references to the left-hand side of a parent assignment.
void visit(const slang::ast::LValueReferenceExpression &expr) {
// Handle named values, such as references to declared variables.
Copy link
Member Author

Choose a reason for hiding this comment

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

This change must be moved to #8280.

"text":"module test(); wire foo; reg bar; endmodule"
}}}
// -----
// Find definition of `out`
Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
// Find definition of `out`

@@ -241,7 +274,7 @@ export class CIRCTContext implements vscode.Disposable {
};

// Configure file patterns relative to the workspace folder.
let filePattern: vscode.GlobPattern = "**/*." + languageName;
let filePattern: vscode.GlobPattern = "**/*.(sv|v)";
Copy link
Member Author

Choose a reason for hiding this comment

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

This must be moved to vscode PR

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant