Function: claude-code-ide-mcp-imenu-list-symbols
claude-code-ide-mcp-imenu-list-symbols is a natively compiled function
defined in claude-code-ide-emacs-tools.el.
Signature
(claude-code-ide-mcp-imenu-list-symbols FILE-PATH)
Documentation
List all symbols in FILE-PATH using imenu.
Returns a list of symbols with their types and positions.
Source Code
;; Defined in /nix/store/yjvbhwl7p6zrbw9xlnni7y4hra8sa3pl-emacs-packages-deps/share/emacs/site-lisp/claude-code-ide-emacs-tools.el
(defun claude-code-ide-mcp-imenu-list-symbols (file-path)
"List all symbols in FILE-PATH using imenu.
Returns a list of symbols with their types and positions."
(if (not file-path)
(error "file_path parameter is required")
(claude-code-ide-mcp-server-with-session-context nil
(condition-case err
(let ((target-buffer (or (find-buffer-visiting file-path)
(find-file-noselect file-path))))
(with-current-buffer target-buffer
;; Generate or update imenu index
(imenu--make-index-alist)
(if imenu--index-alist
(let ((results '()))
;; Process the imenu index
(dolist (item imenu--index-alist)
(cond
;; Skip special entries
((string-match-p "^\\*" (car item)) nil)
;; Handle simple entries (name . position)
((markerp (cdr item))
(let ((line (line-number-at-pos (marker-position (cdr item)))))
(push (format "%s:%d: %s"
file-path
line
(car item))
results)))
;; Handle position numbers
((numberp (cdr item))
(let ((line (line-number-at-pos (cdr item))))
(push (format "%s:%d: %s"
file-path
line
(car item))
results)))
;; Handle nested entries (category . items)
((listp (cdr item))
(let ((category (car item)))
(dolist (subitem (cdr item))
(when (and (consp subitem)
(or (markerp (cdr subitem))
(numberp (cdr subitem))))
(let ((line (line-number-at-pos
(if (markerp (cdr subitem))
(marker-position (cdr subitem))
(cdr subitem)))))
(push (format "%s:%d: [%s] %s"
file-path
line
category
(car subitem))
results))))))))
(if results
(nreverse results)
(format "No symbols found in %s" file-path)))
(format "No imenu support or no symbols found in %s" file-path))))
(error
(format "Error listing symbols in %s: %s"
file-path (error-message-string err)))))))