File tree Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -616,11 +616,27 @@ command from GHCi."
616
616
(defun haskell-mode-show-type-at (&optional insert-value )
617
617
" Show the type of the thing at point."
618
618
(interactive " P" )
619
- (let ((ty (haskell-mode-type-at)))
619
+ (let ((ty (haskell-mode-type-at))
620
+ (orig (point )))
620
621
(if insert-value
621
- (progn (goto-char (line-beginning-position ))
622
- (insert (haskell-fontify-as-mode ty 'haskell-mode )
623
- " \n " ))
622
+ (let ((ident-pos (haskell-ident-pos-at-point)))
623
+ (cond
624
+ ((region-active-p )
625
+ (delete-region (region-beginning )
626
+ (region-end ))
627
+ (insert " (" ty " )" )
628
+ (goto-char (1+ orig)))
629
+ ((= (line-beginning-position ) (car ident-pos))
630
+ (goto-char (line-beginning-position ))
631
+ (insert (haskell-fontify-as-mode ty 'haskell-mode )
632
+ " \n " ))
633
+ (t
634
+ (save-excursion
635
+ (let ((col (save-excursion (goto-char (car ident-pos))
636
+ (current-column ))))
637
+ (save-excursion (insert " \n " )
638
+ (indent-to col))
639
+ (insert (haskell-fontify-as-mode ty 'haskell-mode )))))))
624
640
(message " %s " (haskell-fontify-as-mode ty 'haskell-mode )))))
625
641
626
642
(defun haskell-process-generate-tags (&optional and-then-find-this-tag )
You can’t perform that action at this time.
0 commit comments