[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/dart-mode a1f36f4 094/192: Allow dart-show-hover to displa
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/dart-mode a1f36f4 094/192: Allow dart-show-hover to display in a new buffer |
Date: |
Sun, 29 Aug 2021 11:01:57 -0400 (EDT) |
branch: elpa/dart-mode
commit a1f36f4e83f5da35519c1b1bb373998a06a7a716
Author: Natalie Weizenbaum <nex342@gmail.com>
Commit: Natalie Weizenbaum <nex342@gmail.com>
Allow dart-show-hover to display in a new buffer
---
README.md | 4 ++++
dart-mode.el | 32 +++++++++++++++++++++++---------
2 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/README.md b/README.md
index 42d4e79..6de7985 100644
--- a/README.md
+++ b/README.md
@@ -41,3 +41,7 @@ To see all the information the analyzer knows about a
particular identifier,
move your cursor onto it and press `C-c ?`. This will show the identifier's
type
and documentation in the echo area at the bottom of the editor, as well as some
extra information if it's available.
+
+Sometimes there's just too much documentation to fit down there, or you want to
+keep the documentation open as you're working. In that case, you can run `C-u
+C-c ?` instead to open the information in a new window to read at your leisure.
diff --git a/dart-mode.el b/dart-mode.el
index 6de744e..bc710ab 100644
--- a/dart-mode.el
+++ b/dart-mode.el
@@ -987,11 +987,15 @@ reported to CALLBACK."
;;;; Hover
-(defun dart-show-hover ()
- "Displays hover information for the current point."
- (interactive)
+(defun dart-show-hover (&optional show-in-buffer)
+ "Displays hover information for the current point.
+
+With a prefix argument, opens a new buffer rather than using the
+minibuffer."
+ (interactive "P")
(-when-let (filename (buffer-file-name))
- (lexical-let ((buffer (current-buffer)))
+ (lexical-let ((show-in-buffer show-in-buffer)
+ (buffer (current-buffer)))
(dart--analysis-server-send
"analysis.getHover"
`(("file" . ,filename) ("offset" . ,(point)))
@@ -1026,8 +1030,17 @@ reported to CALLBACK."
(when dartdoc) (insert ?\n))
(when dartdoc
(when (or element-description parameter) (insert ?\n))
- (insert (dart--highlight-dartdoc dartdoc)))
- (message "%s" (buffer-string))))))))))
+ (insert (dart--highlight-dartdoc dartdoc (not
show-in-buffer))))
+
+ (let ((text (buffer-string)))
+ (if show-in-buffer
+ (with-current-buffer-window
+ "*Dart Analysis*" nil nil
+ (insert text)
+ ;; We should really create our own mode, but this will do
+ ;; in a pinch.
+ (help-mode))
+ (message "%s" text)))))))))))
(defconst dart--highlight-keyword-re
(regexp-opt
@@ -1088,14 +1101,15 @@ reported to CALLBACK."
(and (looking-at (concat "\\(" dart--identifier-re "\\|[<>]\\)*"))
(eq (char-after (match-end 0)) ?\()))))
-(defun dart--highlight-dartdoc (dartdoc)
+(defun dart--highlight-dartdoc (dartdoc truncate)
"Returns a higlighted copy of DARTDOC."
(with-temp-buffer
(insert dartdoc)
;; Cut off long dartdocs so that the full signature is always visible.
- (goto-line 11)
- (delete-region (- (point) 1) (point-max))
+ (when truncate
+ (goto-line 11)
+ (delete-region (- (point) 1) (point-max)))
(goto-char (point-min))
- [nongnu] elpa/dart-mode d20d978 076/192: Bump version to 0.14., (continued)
- [nongnu] elpa/dart-mode d20d978 076/192: Bump version to 0.14., ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 0c3d6d7 074/192: Fix an off-by-one bug in offset calculation., ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode be9e422 077/192: Fix a bunch of byte-compilation warnings., ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode e6635b3 084/192: Bump version to 0.15. (#38), ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode b380818 085/192: Adapt the gofmt-related code in go-mode.el for dartfmt. (#39), ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode f5962c3 080/192: Make version check work in Emacs 25., ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 93efb54 089/192: Update the version and URL and flesh out the README, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode ecf3191 091/192: Add a command to show hover information, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 0cf32d5 092/192: Highlight hover descriptions, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode c4a5045 096/192: Add support for navigation, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode a1f36f4 094/192: Allow dart-show-hover to display in a new buffer,
ELPA Syncer <=
- [nongnu] elpa/dart-mode 89a2d4e 100/192: Add a special mode for popups, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode eca3f15 105/192: Add the ability to autocomplete parameters, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode d333a73 102/192: Add an analyzer-based auto-complete, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode d507fa1 101/192: Add a binding to re-run searches, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode a2ab55b 114/192: Make more thorough use of dash, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode c11d02a 137/192: Remedy invalid file path format, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 8f972c0 097/192: Add support for finding references, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 848f983 104/192: Show docs for expansions, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 6bc08f7 136/192: Adds failing test against dart dev, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 9c9a63e 130/192: Fix dart-format, ELPA Syncer, 2021/08/29