Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Improve fontification of variables #1807

Merged
merged 2 commits into from
Sep 15, 2022
Merged

Conversation

gmlarumbe
Copy link
Contributor

Hi,

This PR includes 2 commits.

First one fixes a bug in the highlighting of variables inside task and function arguments.

Before the fix:

fontify_before_pr

After the fix:

fontify_after_pr

Second commit adds the variable verilog-fontify-variables to enable/disable fontification of variables, as suggested in #1752:

And while I'm here, it would be really nice to be able to disable fontifying the variable names in declarations without having to locate and comment out the code in the LISP as I did below to make it stop doing this.

The variable verilog-fontify-variables defaults to t to keep backwards compatibility.

Thanks!

;; Find the variable name (match-data is set here)
(setq found-var (re-search-forward verilog-identifier-sym-re limit t))
;; Walk to this variable's delimiter
(save-match-data
Copy link
Member

@wsnyder wsnyder Sep 13, 2022

Choose a reason for hiding this comment

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

I wonder if the save-match-data should be in verilog-forward-ws instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe it is already wrapping the last three verilog-forward-ws&directives. I am sorry this diff seems so confusing, it is caused by the indentation changes after adding this condition at the beginning of the function:

  (when (and verilog-fontify-variables
             (not (member (thing-at-point 'symbol) verilog-keywords)))

Copy link
Member

@wsnyder wsnyder left a comment

Choose a reason for hiding this comment

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

One question, feel free to push.

* verilog-mode.el (Line#3434, Line#3435, Line#3438, Line#3439,
verilog-declaration-varname-matcher):
Fix bug in highlighting of vars on func/task arguments.

Signed-off-by: Gonzalo Larumbe <[email protected]>
* verilog-mode.el (Line#939, verilog-declaration-varname-matcher,
verilog-fontify-variables, verilog-submit-bug-report):
Add option to enable/disable variable fontification.

Signed-off-by: Gonzalo Larumbe <[email protected]>
@gmlarumbe gmlarumbe merged commit 81f50f8 into veripool:master Sep 15, 2022
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.

2 participants