[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/go-mode d41ebaf 341/495: go.tools/oracle: improvements to
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/go-mode d41ebaf 341/495: go.tools/oracle: improvements to command set and performance. |
Date: |
Sat, 7 Aug 2021 09:05:44 -0400 (EDT) |
branch: elpa/go-mode
commit d41ebaf88d7865cc3092a6f33da56724dbb6eb12
Author: Alan Donovan <adonovan@google.com>
Commit: Dominik Honnef <dominik@honnef.co>
go.tools/oracle: improvements to command set and performance.
Command set:
- what: an extremely fast query that parses a single
file and returns the AST stack, package name and the
set of query modes that apply to the current selection.
Intended for GUI tools that need to grey out UI elements.
- definition: shows the definition of an identifier.
- pointsto: the PTA features of 'describe' have been split
out into their own command.
- describe: with PTA stripped out, the cost is now bounded by
type checking.
Performance:
- The importer.Config.TypeCheckFuncBodies predicate supports
setting the 'IgnoreFuncBodies' typechecker flag on a
per-package basis. This means we can load dependencies from
source more quickly if we only need exported types.
(We avoid gcimport data because it may be absent or stale.)
This also means we can run type-based queries on packages
that aren't part of the pointer analysis scope. (Yay.)
- Modes that require only type analysis of the query package
run a "what" query first, and restrict their analysis scope
to just that package and its dependencies (sans func
bodies), making them much faster.
- We call newOracle not oracle.New in Query, so that the
'needs' bitset isn't ignored (oops!). This makes the
non-PTA queries faster.
Also:
- removed vestigial timers junk.
- pos.go: existing position utilties split out into own file.
Added parsePosFlag utility.
- numerous cosmetic tweaks.
+ very basic tests.
To do in follow-ups:
- sophisticated editor integration of "what".
- better tests.
- refactoring of control flow as described in comment.
- changes to "implements", "describe" commands.
- update design doc + user manual.
R=crawshaw, dominik.honnef
CC=golang-dev, gri
https://golang.org/cl/40630043
---
guru_import/cmd/oracle/oracle.el | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/guru_import/cmd/oracle/oracle.el b/guru_import/cmd/oracle/oracle.el
index 03b267b..dacf9da 100644
--- a/guru_import/cmd/oracle/oracle.el
+++ b/guru_import/cmd/oracle/oracle.el
@@ -36,14 +36,18 @@
nil
"History of values supplied to `go-oracle-set-scope'.")
+;; TODO(adonovan): I'd like to get rid of this separate mode since it
+;; makes it harder to use the oracle.
(defvar go-oracle-mode-map
(let ((m (make-sparse-keymap)))
- (define-key m (kbd "C-c C-o d") #'go-oracle-describe)
+ (define-key m (kbd "C-c C-o t") #'go-oracle-describe) ; t for type
(define-key m (kbd "C-c C-o f") #'go-oracle-freevars)
(define-key m (kbd "C-c C-o g") #'go-oracle-callgraph)
(define-key m (kbd "C-c C-o i") #'go-oracle-implements)
- (define-key m (kbd "C-c C-o p") #'go-oracle-peers)
+ (define-key m (kbd "C-c C-o c") #'go-oracle-peers) ; c for channel
(define-key m (kbd "C-c C-o r") #'go-oracle-referrers)
+ (define-key m (kbd "C-c C-o d") #'go-oracle-definition)
+ (define-key m (kbd "C-c C-o p") #'go-oracle-pointsto)
(define-key m (kbd "C-c C-o s") #'go-oracle-callstack)
(define-key m (kbd "C-c C-o <") #'go-oracle-callers)
(define-key m (kbd "C-c C-o >") #'go-oracle-callees)
@@ -128,7 +132,7 @@ result."
;; Hide the file/line info to save space.
;; Replace each with a little widget.
;; compilation-mode + this loop = slooow.
- ;; TODO(adonovan): have oracle give us an S-expression
+ ;; TODO(adonovan): have oracle give us JSON
;; and we'll do the markup directly.
(let ((buffer-read-only nil)
(p 1))
@@ -171,11 +175,21 @@ function containing the current point."
(interactive)
(go-oracle--run "callstack"))
+(defun go-oracle-definition ()
+ "Show the definition of the selected identifier."
+ (interactive)
+ (go-oracle--run "definition"))
+
(defun go-oracle-describe ()
- "Describe the expression at the current point."
+ "Describe the selected syntax, its kind, type and methods."
(interactive)
(go-oracle--run "describe"))
+(defun go-oracle-pointsto ()
+ "Show what the selected expression points to."
+ (interactive)
+ (go-oracle--run "pointsto"))
+
(defun go-oracle-implements ()
"Describe the 'implements' relation for types in the package
containing the current point."
- [nongnu] elpa/go-mode e035e60 309/495: Mention GOPATH detection in README, (continued)
- [nongnu] elpa/go-mode e035e60 309/495: Mention GOPATH detection in README, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 43da263 313/495: Simplify go-root-and-paths by using process-lines, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 95c74ba 324/495: Update URL to gogetdoc tool., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 228ded4 314/495: Use cons instead of append, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 205672f 322/495: Use separate godoc commands for godoc and godoc-at-point, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 737611e 329/495: Update URL to goimports, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode b65e408 334/495: go.tools/cmd/oracle: cosmetic tweaks to Emacs., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode e76464a 331/495: go.tools/oracle: an oracle that answers questions about Go source code., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 8560557 354/495: cmd/guru: fix bug in mode map caused by bad merge, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode b36d2fd 352/495: cmd/guru: emacs: report an error when the guru command fails, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode d41ebaf 341/495: go.tools/oracle: improvements to command set and performance.,
ELPA Syncer <=
- [nongnu] elpa/go-mode 385153c 338/495: go.tools/oracle: new query 'referrers' returns all references to an identifier., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode f18b4eb 369/495: cmd/guru: support streaming plain and -json output, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 9a5284b 362/495: cmd/guru: emacs: update scope documentation, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 4dfa1c4 350/495: cmd/guru: add support for loading modified files, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode fdb5dfa 335/495: go.tools/oracle: change notation for byte offsets to "-pos=file.go:#123-#456", ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 1dc6fb5 357/495: cmd/guru: fix mode map, again, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode fac4a24 336/495: go.tools/importer: negate "cgo" build tag to avoid native code in "net"., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 5b5ac61 364/495: cmd/guru: emacs: highlight all instances of an identifier, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 4146860 373/495: cmd/guru: Emacs: run guru asynchronously using compilation-mode, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 7077c4f 375/495: cmd/guru: fix quoting bug in Emacs binding, ELPA Syncer, 2021/08/07