update of packages
This commit is contained in:
@@ -1,13 +1,17 @@
|
||||
(define-package "anaconda-mode" "20220922.741" "Code navigation, documentation lookup and completion for Python"
|
||||
(define-package "anaconda-mode" "20230821.2131" "Code navigation, documentation lookup and completion for Python"
|
||||
'((emacs "25.1")
|
||||
(pythonic "0.1.0")
|
||||
(dash "2.6.0")
|
||||
(s "1.9")
|
||||
(f "0.16.2"))
|
||||
:commit "ca8edbaa7662d97e4a4416ec9a8d743863303911" :authors
|
||||
:commit "9dbd65b034cef519c01f63703399ae59651f85ca" :authors
|
||||
'(("Artem Malyshev" . "proofit404@gmail.com"))
|
||||
:maintainers
|
||||
'(("Artem Malyshev" . "proofit404@gmail.com"))
|
||||
:maintainer
|
||||
'("Artem Malyshev" . "proofit404@gmail.com")
|
||||
:keywords
|
||||
'("convenience" "anaconda")
|
||||
:url "https://github.com/proofit404/anaconda-mode")
|
||||
;; Local Variables:
|
||||
;; no-byte-compile: t
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
;; URL: https://github.com/proofit404/anaconda-mode
|
||||
;; Version: 0.1.15
|
||||
;; Package-Requires: ((emacs "25.1") (pythonic "0.1.0") (dash "2.6.0") (s "1.9") (f "0.16.2"))
|
||||
;; Keywords: convenience anaconda
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
@@ -28,6 +29,7 @@
|
||||
|
||||
(require 'ansi-color)
|
||||
(require 'pythonic)
|
||||
(require 'cl-lib)
|
||||
(require 'tramp)
|
||||
(require 'xref)
|
||||
(require 'json)
|
||||
@@ -77,6 +79,13 @@
|
||||
"Time in seconds `anaconda-mode' waits for a synchronous response."
|
||||
:type 'integer)
|
||||
|
||||
; create a defcustom that only allows for 'never, 'always, or 'remote
|
||||
(defcustom anaconda-mode-disable-rpc 'never
|
||||
"Disable RPC calls to the `anaconda-mode' server when remote."
|
||||
:type '(choice (const :tag "Never" never)
|
||||
(const :tag "Always" always)
|
||||
(const :tag "Remote" remote)))
|
||||
|
||||
;;; Compatibility
|
||||
|
||||
;; Functions from posframe which is an optional dependency
|
||||
@@ -361,8 +370,11 @@ called when `anaconda-mode-port' will be bound."
|
||||
(defun anaconda-mode-call (command callback)
|
||||
"Make remote procedure call for COMMAND.
|
||||
Apply CALLBACK to the result asynchronously."
|
||||
(anaconda-mode-start
|
||||
(lambda () (anaconda-mode-jsonrpc command callback))))
|
||||
(unless (or (eq anaconda-mode-disable-rpc 'always)
|
||||
(and (eq anaconda-mode-disable-rpc 'remote)
|
||||
(pythonic-remote-p)))
|
||||
(anaconda-mode-start
|
||||
(lambda () (anaconda-mode-jsonrpc command callback)))))
|
||||
|
||||
(defun anaconda-mode-call-sync (command callback)
|
||||
"Make remote procedure call for COMMAND.
|
||||
@@ -699,26 +711,29 @@ Show ERROR-MESSAGE if result is empty."
|
||||
|
||||
;;; Eldoc.
|
||||
|
||||
(defun anaconda-mode-eldoc-function ()
|
||||
(defun anaconda-mode-eldoc-function (callback &rest _ignored)
|
||||
"Show eldoc for context at point."
|
||||
(anaconda-mode-call "eldoc" 'anaconda-mode-eldoc-callback)
|
||||
(anaconda-mode-call
|
||||
"eldoc"
|
||||
(lambda (x)
|
||||
(funcall callback (anaconda-mode-eldoc-format x))))
|
||||
;; Don't show response buffer name as ElDoc message.
|
||||
nil)
|
||||
|
||||
(defun anaconda-mode-eldoc-callback (result)
|
||||
"Display eldoc from server RESULT."
|
||||
(eldoc-message (anaconda-mode-eldoc-format result)))
|
||||
|
||||
(defun anaconda-mode-eldoc-format (result)
|
||||
"Format eldoc string from RESULT."
|
||||
(when result
|
||||
(let ((doc (anaconda-mode-eldoc-format-definition
|
||||
(aref result 0)
|
||||
(aref result 1)
|
||||
(aref result 2))))
|
||||
(let ((doc (cl-map 'list
|
||||
(lambda (s)
|
||||
(anaconda-mode-eldoc-format-definition
|
||||
(aref s 0)
|
||||
(aref s 1)
|
||||
(aref s 2)))
|
||||
result)))
|
||||
(if anaconda-mode-eldoc-as-single-line
|
||||
(substring doc 0 (min (frame-width) (length doc)))
|
||||
doc))))
|
||||
(let ((d (mapconcat #'identity doc ", ")))
|
||||
(substring d 0 (min (frame-width) (length d))))
|
||||
(mapconcat #'identity doc "\n")))))
|
||||
|
||||
(defun anaconda-mode-eldoc-format-definition (name index params)
|
||||
"Format function definition from NAME, INDEX and PARAMS."
|
||||
@@ -768,13 +783,14 @@ Show ERROR-MESSAGE if result is empty."
|
||||
|
||||
(defun turn-on-anaconda-eldoc-mode ()
|
||||
"Turn on `anaconda-eldoc-mode'."
|
||||
(make-local-variable 'eldoc-documentation-function)
|
||||
(setq-local eldoc-documentation-function 'anaconda-mode-eldoc-function)
|
||||
(add-hook 'eldoc-documentation-functions
|
||||
'anaconda-mode-eldoc-function nil 't)
|
||||
(eldoc-mode +1))
|
||||
|
||||
(defun turn-off-anaconda-eldoc-mode ()
|
||||
"Turn off `anaconda-eldoc-mode'."
|
||||
(kill-local-variable 'eldoc-documentation-function)
|
||||
(remove-hook 'eldoc-documentation-functions
|
||||
'anaconda-mode-eldoc-function 't)
|
||||
(eldoc-mode -1))
|
||||
|
||||
(provide 'anaconda-mode)
|
||||
|
||||
@@ -192,11 +192,11 @@ def get_references(script, line, column):
|
||||
@script_method
|
||||
def eldoc(script, line, column):
|
||||
signatures = script.get_signatures(line, column)
|
||||
if len(signatures) == 1:
|
||||
signature = signatures[0]
|
||||
return [signature.name,
|
||||
signature.index,
|
||||
[param.description[6:] for param in signature.params]]
|
||||
if len(signatures) >= 1:
|
||||
return [(s.name,
|
||||
s.index,
|
||||
[param.description[6:] for param in s.params])
|
||||
for s in signatures]
|
||||
|
||||
# Run.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user