From 7f67167d097b6f5123946568fde14c7d43bbfd1e Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 5 Oct 2022 10:43:27 +1100 Subject: fixing naming of identifiers in hcel-results --- hcel-results.el | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/hcel-results.el b/hcel-results.el index 1e0dbb0..6cac9de 100644 --- a/hcel-results.el +++ b/hcel-results.el @@ -269,17 +269,18 @@ Start by choosing a package." hcel-ids-query hcel-results-page-number hcel-results-max-page-number)) (mapc - (lambda (result) + (lambda (identifier) (insert "--\n") - (insert (hcel-ids-render-result result - 'hcel-tag-span-button-load-source))) + (insert (hcel-ids-render-identifier + identifier + 'hcel-tag-span-button-load-source))) (alist-get 'json results)) (goto-char (point-min)))) -(defun hcel-ids-render-result (result button-action) - (let* ((location-info (alist-get 'locationInfo result)) +(defun hcel-ids-render-identifier (identifier button-action) + (let* ((location-info (alist-get 'locationInfo identifier)) (doc (hcel-render-html - (or (alist-get 'doc result) + (or (alist-get 'doc identifier) (alist-get 'documentation (ignore-errors (hcel-definition-site-location-info @@ -288,8 +289,8 @@ Start by choosing a package." (concat (propertize (format "%s :: %s\n" - (alist-get 'occName result) - (hcel-render-id-type (alist-get 'idType result))) + (alist-get 'occName identifier) + (hcel-render-id-type (alist-get 'idType identifier))) 'location-info location-info 'match-line t) (concat "Defined in " @@ -338,14 +339,14 @@ Start by choosing a package." (let ((results (mapcar (lambda (item) - (let* ((info (get-text-property 0 'info item)) - (location-info (alist-get 'locationInfo info)) + (let* ((identifier (get-text-property 0 'identifier item)) + (location-info (alist-get 'locationInfo identifier)) (suffix (propertize (format " :: %s" (hcel-render-components - (alist-get 'components (alist-get 'idType info)) + (alist-get 'components (alist-get 'idType identifier)) nil hcel-ids-minibuffer-component-max-len)) 'face 'completions-annotations)) @@ -380,15 +381,12 @@ Start by choosing a package." (setq hcel-ids--minibuffer-saved-query query hcel-ids--minibuffer-saved-results (mapcar - (lambda (result) + (lambda (identifier) (propertize (format "%s %s" - (alist-get 'demangledOccName result) - (alist-get 'externalId result)) - 'info result - 'location-info (alist-get 'locationInfo result) - 'components (alist-get 'components - (alist-get 'idType result)))) + (alist-get 'demangledOccName identifier) + (alist-get 'externalId identifier)) + 'identifier identifier)) (hcel-api-identifiers scope query package-id nil (number-to-string hcel-ids-live-per-page)))) @@ -407,7 +405,8 @@ Start by choosing a package." (if (length= splitted 2) (hcel-load-module-location-info (alist-get 'locationInfo - (get-text-property 0 'info hcel-ids--minibuffer-selected))) + (get-text-property 0 'identifier + hcel-ids--minibuffer-selected))) (let ((buffer-name (hcel-ids-buffer-name scope query))) (with-current-buffer (get-buffer-create buffer-name) (hcel-ids-mode) @@ -440,12 +439,14 @@ Start by choosing a package." ;; TODO: it is impossible with the current API to follow link within the help ;; buffer, as definitionSite does not contain signature, and ExactLocation does ;; not contain component name or even name -(defun hcel-help-internal (info) - (help-setup-xref (list #'hcel-help-internal info) +(defun hcel-help-internal (identifier) + (help-setup-xref (list #'hcel-help-internal identifier) (called-interactively-p 'interactive)) (with-help-window (help-buffer) (with-current-buffer standard-output - (insert (hcel-ids-render-result info 'hcel-tag-span-button-load-source))))) + (insert + (hcel-ids-render-identifier + identifier 'hcel-tag-span-button-load-source))))) (defun hcel-help (query) (interactive @@ -455,7 +456,7 @@ Start by choosing a package." #'hcel-global-ids-minibuffer-collection)))) (when (length= (split-string query " ") 2) (hcel-help-internal - (get-text-property 0 'info hcel-ids--minibuffer-selected)))) + (get-text-property 0 'identifier hcel-ids--minibuffer-selected)))) (provide 'hcel-results) ;;; hcel-results.el ends here. -- cgit v1.2.3