diff --git a/haskell-commands.el b/haskell-commands.el index ceea47ba1..17b9cdf5f 100644 --- a/haskell-commands.el +++ b/haskell-commands.el @@ -32,6 +32,7 @@ (require 'haskell-font-lock) (require 'haskell-interactive-mode) (require 'haskell-session) +(require 'haskell-string) (require 'haskell-presentation-mode) (require 'haskell-utils) (require 'highlight-uses-mode) @@ -469,7 +470,10 @@ Returns: ;;;###autoload (defun haskell-mode-jump-to-def (ident) "Jump to definition of identifier IDENT at point." - (interactive (list (haskell-ident-at-point))) + (interactive + (list + (haskell-string-drop-qualifier + (haskell-ident-at-point)))) (let ((loc (haskell-mode-find-def ident))) (when loc (haskell-mode-handle-generic-loc loc)))) diff --git a/haskell-string.el b/haskell-string.el index 0a614b04e..71f5104a9 100644 --- a/haskell-string.el +++ b/haskell-string.el @@ -162,6 +162,14 @@ See also `haskell-string-take'." ((< n 1) "") (t (concat (substring string 0 (1- n)) "…")))) +(defun haskell-string-drop-qualifier (ident) + "Drop qualifier from given identifier IDENT. + +If the identifier is not qualified return it unchanged." + (or (and (string-match "^\\([^.]*\\.\\)*\\(?1:[^.]+\\)$" ident) + (match-string 1 ident)) + ident)) + (provide 'haskell-string) ;;; haskell-string.el ends here diff --git a/haskell.el b/haskell.el index 10d635f92..513cd9f34 100644 --- a/haskell.el +++ b/haskell.el @@ -338,7 +338,7 @@ If `haskell-process-load-or-reload-prompt' is nil, accept `default'." Give optional NEXT-P parameter to override value of `xref-prompt-for-identifier' during definition search." (interactive "P") - (let ((ident (haskell-ident-at-point)) + (let ((ident (haskell-string-drop-qualifier (haskell-ident-at-point))) (tags-file-dir (haskell-cabal--find-tags-dir)) (tags-revert-without-query t)) (when (and ident