emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/haskell-tng-mode 0113f37 273/385: hsinspect should work on


From: ELPA Syncer
Subject: [nongnu] elpa/haskell-tng-mode 0113f37 273/385: hsinspect should work on symbols with FQNs
Date: Tue, 5 Oct 2021 23:59:46 -0400 (EDT)

branch: elpa/haskell-tng-mode
commit 0113f37ec9b9c626270079d5130d9f51d4bedb4e
Author: Tseen She <ts33n.sh3@gmail.com>
Commit: Tseen She <ts33n.sh3@gmail.com>

    hsinspect should work on symbols with FQNs
---
 haskell-tng-hsinspect.el | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/haskell-tng-hsinspect.el b/haskell-tng-hsinspect.el
index b2602e2..a0452b2 100644
--- a/haskell-tng-hsinspect.el
+++ b/haskell-tng-hsinspect.el
@@ -20,7 +20,7 @@
   "Consult the imports in scope and display the fully qualified
 name of the symbol at point in the minibuffer."
   (interactive) ;; TODO prefix should copy to kill ring
-  (if-let* ((sym (symbol-name (symbol-at-point)))
+  (if-let* ((sym (haskell-tng--hsinspect-symbol-at-point))
             (found (seq-find
                     (lambda (names) (member sym (seq-map #'cdr names)))
                     (haskell-tng--hsinspect-imports))))
@@ -31,6 +31,22 @@ name of the symbol at point in the minibuffer."
         (error "hsinspect is not available")
       (message "<not imported>"))))
 
+(defun haskell-tng--hsinspect-symbol-at-point ()
+  "A `symbol-at-point' that includes FQN parts."
+  (buffer-substring-no-properties
+   (save-excursion
+     (while ;; WORKAROUND non-greedy matches
+         (re-search-backward
+          (rx symbol-start (+ (| word (syntax symbol) ".")) point)
+          (line-beginning-position)
+          t))
+     (match-beginning 0))
+   (save-excursion
+     (re-search-forward
+      (rx point (+ (| word (syntax symbol) ".")) symbol-end)
+      (line-end-position) t)
+     (match-end 0))))
+
 (defun haskell-tng--hsinspect-ghcflags ()
   ;; https://github.com/haskell/cabal/issues/6203
   "Obtain the ghc flags for the current buffer"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]