Skip to content

Commit

Permalink
Merge pull request #344 from immerrr/prepare-release-0-2-8
Browse files Browse the repository at this point in the history
Prepare for new release
  • Loading branch information
immerrr authored Oct 11, 2019
2 parents 4c0b8f9 + 666a141 commit 0fe5f22
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 36 deletions.
130 changes: 94 additions & 36 deletions jedi-core.el
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,20 @@ If it is nil, `python-environment-default-root-name' is used.
You can specify a full path instead of a name (relative path).
In that case, `python-environment-directory' is ignored and
Python virtual environment is created at the specified path."
:group 'jedi)
:group 'jedi
:type '(choice (directory
(const nil))))


(defcustom jedi:environment-virtualenv nil
"``virtualenv`` command to use. A list of string.
If it is nil, `python-environment-virtualenv' is used instead.
You must set non-`nil' value to `jedi:environment-root' in order
to make this setting work."
:group 'jedi)
:group 'jedi
:type '(repeat string))


(defun jedi:-env-server-command ()
(let* ((getbin (lambda (x) (python-environment-bin x jedi:environment-root)))
Expand Down Expand Up @@ -127,7 +132,9 @@ reinstall jediepcserver.py.
If you want to pass some arguments to the Jedi server command,
use `jedi:server-args' instead of appending them
`jedi:server-command'."
:group 'jedi)
:group 'jedi
:type '(repeat string))


(defcustom jedi:server-args nil
"Command line arguments to be appended to `jedi:server-command'.
Expand Down Expand Up @@ -178,30 +185,41 @@ for Jedi.el and other EPC applications.
If you want to start a new ad-hoc server for the current buffer,
use the command `jedi:start-dedicated-server'."
:group 'jedi)
:group 'jedi
:type '(repeat string))


(defcustom jedi:complete-on-dot nil
"Non-`nil' means automatically start completion after inserting a dot.
To make this option work, you need to use `jedi:setup' instead of
`jedi:ac-setup' to start Jedi."
:group 'jedi)
:group 'jedi
:type 'boolean)


(defcustom jedi:tooltip-method '(pos-tip popup)
"Configuration for `jedi:tooltip-show'.
This is a list which may contain symbol(s) `pos-tip' and/or
`popup'. It determines tooltip method to use. Setting this
value to nil means to use minibuffer instead of tooltip."
:group 'jedi)
:group 'jedi
:type '(list (choice (const pos-tip)
(const popup))))


(defcustom jedi:get-in-function-call-timeout 3000
"Cancel request to server for call signature after this period
specified in in millisecond."
:group 'jedi)
:group 'jedi
:type 'integer)


(defcustom jedi:get-in-function-call-delay 1000
"How long Jedi should wait before showing call signature
tooltip in millisecond."
:group 'jedi)
:group 'jedi
:type 'integer)


(defcustom jedi:goto-definition-config
'((nil nil nil)
Expand Down Expand Up @@ -244,11 +262,15 @@ use the setting like this::
You can rearrange the order to have most useful sets of arguments
at the top."
:group 'jedi)
:group 'jedi
:type '(list sexp))


(defcustom jedi:doc-mode 'rst-mode
"Major mode to use when showing document."
:group 'jedi)
:group 'jedi
:type 'symbol)


(defcustom jedi:doc-hook '(view-mode)
"The hook that's run after showing a document."
Expand All @@ -262,19 +284,22 @@ at the top."

(defcustom jedi:doc-display-buffer 'display-buffer
"A function to be called with a buffer to show document."
:group 'jedi)
:group 'jedi
:type 'function)

(defcustom jedi:install-imenu nil
"If `t', use Jedi to create `imenu' index."
:group 'jedi)
:group 'jedi
:type 'boolean)

(defcustom jedi:imenu-create-index-function 'jedi:create-nested-imenu-index
"`imenu-create-index-function' for Jedi.el.
It must be a function that takes no argument and return an object
described in `imenu--index-alist'.
This can be set to `jedi:create-flat-imenu-index'.
Default is `jedi:create-nested-imenu-index'."
:group 'jedi)
:group 'jedi
:type 'function)

(make-obsolete-variable 'jedi:setup-keys nil "0.1.3")
(defcustom jedi:setup-keys nil
Expand Down Expand Up @@ -329,44 +354,72 @@ ropemacs's `rope-show-doc' is same as `jedi:show-doc'. You can
avoid collision by something like this::
(setq jedi:key-show-doc (kbd \"C-c D\"))"
:group 'jedi)
:group 'jedi
:type 'boolean)

(defcustom jedi:key-complete (kbd "<C-tab>")
(defun jedi:-custom-set-key-string (sym defs)
"Convert key sequence DEFS from string and store into in SYM."
(custom-set-default sym (kbd defs)))

(defun jedi:-custom-get-key-string (sym)
"Convert key sequence stored in SYM to string representation."
(key-description (default-value sym)))

(defcustom jedi:key-complete "<C-tab>"
"Keybind for command `jedi:complete'."
:group 'jedi)
:group 'jedi
:type 'string
:set #'jedi:-custom-set-key-string
:get #'jedi:-custom-get-key-string)

(defcustom jedi:key-goto-definition (kbd "C-.")
(defcustom jedi:key-goto-definition "C-."
"Keybind for command `jedi:goto-definition'."
:group 'jedi)
:group 'jedi
:type 'string
:set #'jedi:-custom-set-key-string
:get #'jedi:-custom-get-key-string)

(defcustom jedi:key-show-doc (kbd "C-c d")
(defcustom jedi:key-show-doc "C-c d"
"Keybind for command `jedi:show-doc'."
:group 'jedi)
:group 'jedi
:type 'string
:set #'jedi:-custom-set-key-string
:get #'jedi:-custom-get-key-string)

(defcustom jedi:key-related-names (kbd "C-c r")
(defcustom jedi:key-related-names "C-c r"
"Keybind for command `helm-jedi-related-names' or
`anything-jedi-related-names'."
:group 'jedi)
:group 'jedi
:type 'string
:set #'jedi:-custom-set-key-string
:get #'jedi:-custom-get-key-string)

(defcustom jedi:key-goto-definition-pop-marker (kbd "C-,")
(defcustom jedi:key-goto-definition-pop-marker "C-,"
"Keybind for command `jedi:goto-definition-pop-marker'."
:group 'jedi)
:group 'jedi
:type 'string
:set #'jedi:-custom-set-key-string
:get #'jedi:-custom-get-key-string)


(defcustom jedi:use-shortcuts nil
"If non-`nil', enable the following shortcuts:
| ``M-.`` `jedi:goto-definition'
| ``M-,`` `jedi:goto-definition-pop-marker'
"
:group 'jedi)
:group 'jedi
:type 'boolean)

(defcustom jedi:import-python-el-settings t
"Automatically import settings from python.el variables."
:group 'jedi)
:group 'jedi
:type 'boolean)

(defcustom jedi:goto-definition-marker-ring-length 16
"Length of marker ring to store `jedi:goto-definition' call positions"
:group 'jedi)
:group 'jedi
:type 'integer)


;;; Internal variables
Expand Down Expand Up @@ -466,12 +519,12 @@ connection."
is-part lines)
(if (not (buffer-live-p epc-buffer))
""
(save-excursion
(set-buffer epc-buffer)
(goto-char (point-max))
(forward-line -10)
(setq is-part (not (eq (point) (point-min))))
(setq lines (buffer-substring-no-properties (point) (point-max))))
(with-current-buffer epc-buffer
(save-excursion
(goto-char (point-max))
(forward-line -10)
(setq is-part (not (eq (point) (point-min))))
(setq lines (buffer-substring-no-properties (point) (point-max)))))
(format "*** EPC Server Output (last %s lines) ***\n%s%s\n"
line-count
(if is-part "<...snipped, see all with `epc:pop-to-last-server-process-buffer'...>\n" "")
Expand Down Expand Up @@ -533,7 +586,7 @@ Python module imports."
(defun jedi:server-pool--resolve-command (command)
"Resolve COMMAND using current environment.
Tries to find (car command) in \"exec-path\"."
(let (command-path (executable-find (car command)))
(let ((command-path (executable-find (car command))))
(if command-path
(cons command-path (cdr command))
command)))
Expand Down Expand Up @@ -609,11 +662,14 @@ later when it is needed."
This is useful to apply new settings or VIRTUAL_ENV variable
value to all buffers."
(interactive)
;; Kill all servers attached to buffers
(cl-dolist (buf (buffer-list))
(when (buffer-live-p buf)
(with-current-buffer buf
(when (jedi:epc--live-p jedi:epc)
(jedi:stop-server))))))
(jedi:stop-server)))))
;; Kill all unused servers too.
(jedi:server-pool--gc))

(defun jedi:get-epc ()
"Get an EPC instance of a running server or start a new one."
Expand Down Expand Up @@ -1275,7 +1331,9 @@ See also:
'("pip" "install" "--upgrade"
"git+https://github.com/davidhalter/jedi.git@master#egg=jedi")
"Pip command to be used for `jedi:install-python-jedi-dev'."
:group 'jedi)
:group 'jedi
:type '(repeat string)
)

(defun jedi:install-python-jedi-dev ()
"Install developmental version of Python-Jedi from GitHub."
Expand Down
5 changes: 5 additions & 0 deletions test-jedi.el
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ json.load
buffers))
(mocker-let
((jedi:epc--start-epc (x y) ,start-epc-records)
;; FIXME: test suite is not yet adapted to resolving the command to
;; absolute path, so it is mocked to return the command untouched.
(jedi:server-pool--resolve-command (command)
((:input-matcher (lambda (&rest _) t)
:output-generator (lambda (command) command))))
(jedi:epc--live-p (x) ,epc--live-p-records)
;; Probably this mocking is too "strong". What I need to
;; mock is only `buffer-list' in `jedi:-get-servers-in-use'.
Expand Down

0 comments on commit 0fe5f22

Please sign in to comment.