Skip to content

Commit

Permalink
Merge branch 'main' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
gmlarumbe committed May 15, 2023
2 parents 09f75b7 + 35db57a commit af46210
Show file tree
Hide file tree
Showing 6 changed files with 867 additions and 2,513 deletions.
3,333 changes: 843 additions & 2,490 deletions test/verilog-ext-tests-tags.el

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion verilog-ext-imenu.el
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Find recursively tasks and functions inside classes."
(let* ((data (and (verilog-ext-find-class-bwd)
(verilog-ext-forward-sexp)
(verilog-ext-find-function-task-class-bwd)))
(pos (when data
(pos (when (alist-get 'pos data)
(save-excursion
(goto-char (alist-get 'pos data))
(line-beginning-position))))
Expand Down
8 changes: 5 additions & 3 deletions verilog-ext-nav.el
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,16 @@ the function call."
(setq tf-args-pos-beg (1+ (point)))
(setq tf-args (split-string (buffer-substring-no-properties tf-args-pos-beg tf-args-pos-end) ","))
(setq tf-args (mapcar #'string-trim tf-args)))
(backward-word)
;; Func/task name
(when (looking-at verilog-identifier-re)
(setq tf-name (match-string-no-properties 0))
(verilog-ext-backward-syntactic-ws)
(when (and (looking-back verilog-identifier-sym-re (car (bounds-of-thing-at-point 'symbol)))
(setq tf-name (match-string-no-properties 0))
(not (member tf-name (remove "new" verilog-keywords)))) ; Avoid getting stuck with "task ; "
(setq tf-name-pos-beg (match-beginning 0))
(setq tf-name-pos-end (match-end 0))
(setq found t))
;; Externally defined functions
(backward-word)
(verilog-ext-when-t (eq (preceding-char) ?:)
(skip-chars-backward ":")
(backward-word)
Expand Down
26 changes: 11 additions & 15 deletions verilog-ext-tags.el
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ completion."
(when ignore-paren-decl
(verilog-in-parenthesis-p))
(not tag))
(setq desc (verilog-ext-tags-desc tag))
(setq desc (verilog-ext-tags-desc))
(verilog-ext-tags-table-push-tag table tag type desc file parent))))
("tf" (while (setq data (verilog-ext-find-function-task-fwd limit))
(setq type (alist-get 'type data))
(setq tag (match-string-no-properties 1))
(setq desc (verilog-ext-tags-desc tag))
(setq desc (verilog-ext-tags-desc))
(verilog-ext-tags-table-push-tag table tag type desc file parent)
;; Get tasks and function declarations
(save-excursion
Expand All @@ -147,12 +147,12 @@ completion."
("instances" (while (verilog-ext-find-module-instance-fwd limit)
(setq tag (match-string-no-properties 2))
(setq type (match-string-no-properties 1))
(setq desc (verilog-ext-tags-desc tag))
(setq desc (verilog-ext-tags-desc))
(verilog-ext-tags-table-push-tag table tag type desc file parent)))
("structs" (while (setq data (verilog-ext-find-struct))
(setq tag (alist-get 'name data))
(setq type "struct")
(setq desc (verilog-ext-tags-desc tag))
(setq desc (verilog-ext-tags-desc))
(verilog-ext-tags-table-push-tag table tag type desc file parent)
;; Get struct items
(save-excursion
Expand All @@ -163,7 +163,7 @@ completion."
("classes" (while (setq data (verilog-ext-find-class-fwd limit))
(setq type "class")
(setq tag (alist-get 'name data))
(setq desc (verilog-ext-tags-desc tag))
(setq desc (verilog-ext-tags-desc))
(verilog-ext-tags-table-push-tag table tag type desc file parent)
;; Get class items
(save-excursion
Expand All @@ -175,7 +175,7 @@ completion."
("top-items" (while (verilog-re-search-forward verilog-ext-top-re nil :no-error)
(setq tag (match-string-no-properties 3))
(setq type (match-string-no-properties 1))
(setq desc (verilog-ext-tags-desc tag))
(setq desc (verilog-ext-tags-desc))
(verilog-ext-tags-table-push-tag table tag type desc file)
;; Get top-block items
(setq inner-start (match-beginning 1))
Expand Down Expand Up @@ -211,7 +211,7 @@ Limit search between START and LIMIT if provided."
(setq begin (match-beginning 0))
(setq tag (match-string-no-properties 0))
(setq type nil) ; Does not apply for references
(setq desc (verilog-ext-tags-desc tag))
(setq desc (verilog-ext-tags-desc))
(unless (or (member tag verilog-keywords) ; Filter verilog keywords
;; Filter existing definitions
(and defs-table
Expand All @@ -230,15 +230,11 @@ Limit search between START and LIMIT if provided."
;; Return updated table
table))

(defun verilog-ext-tags-desc (tag)
"Return propertized description for TAG.
(defun verilog-ext-tags-desc ()
"Return description for current TAG.
Meant to be used for `xref' backend."
(let* ((desc (string-trim (buffer-substring-no-properties (line-beginning-position) (line-end-position))))
(desc-prop (replace-regexp-in-string (concat "\\_<" tag "\\_>")
(propertize tag 'face '(:foreground "goldenrod" :weight bold))
desc
:fixedcase)))
desc-prop))
(string-trim (buffer-substring-no-properties (line-beginning-position) (line-end-position))))


(provide 'verilog-ext-tags)

Expand Down
6 changes: 3 additions & 3 deletions verilog-ext-workspace.el
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ With current-prefix or VERBOSE, dump output log."
"Get tags of current workspace.
With current-prefix or VERBOSE, dump output log."
(interactive "p")
(let* ((files (verilog-ext-workspace-files))
(let* ((files (verilog-ext-workspace-files :follow-symlinks))
(num-files (length files))
(num-files-processed 0)
(table (make-hash-table :test #'equal))
Expand Down Expand Up @@ -441,7 +441,7 @@ in corresponding async function."
"Update typedef list of current workspace.
With current-prefix or VERBOSE, dump output log."
(interactive "p")
(verilog-ext-workspace-typedef-batch-update (verilog-ext-workspace-files) verbose))
(verilog-ext-workspace-typedef-batch-update (verilog-ext-workspace-files :follow-symlinks) verbose))

(defun verilog-ext-workspace-typedef-update-async (&optional verbose)
"Update typedef list of current workspace asynchronously.
Expand All @@ -452,7 +452,7 @@ With current-prefix or VERBOSE, dump output log."
`(lambda ()
,(async-inject-variables verilog-ext-async-inject-variables-re)
(require 'verilog-ext)
(verilog-ext-workspace-typedef-batch-update (verilog-ext-workspace-files) ,verbose))
(verilog-ext-workspace-typedef-batch-update (verilog-ext-workspace-files :follow-symlinks) ,verbose))
(lambda (result)
(message "Finished collection of typedefs!")
(setq verilog-ext-workspace-align-typedef-words-re result)
Expand Down
5 changes: 4 additions & 1 deletion verilog-ext-xref.el
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@
(setq file (plist-get loc :file))
(setq line (plist-get loc :line))
(setq column nil)
(setq desc (plist-get loc :desc))
(setq desc (replace-regexp-in-string (concat "\\_<" symbol "\\_>")
(propertize symbol 'face '(:foreground "goldenrod" :weight bold))
(plist-get loc :desc)
:fixedcase))
(push (xref-make desc (xref-make-file-location file line column)) xref-entries)))
xref-entries))

Expand Down

0 comments on commit af46210

Please sign in to comment.