Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minibuffer switching between function signature and description #337

Open
DiogoFerrari opened this issue Jun 27, 2019 · 4 comments
Open
Labels

Comments

@DiogoFerrari
Copy link

My minibuffer keeps switching between showing the function signature and the first line of the description of the function. I want to have only the former. Any idea of what is happening?

@immerrr
Copy link
Collaborator

immerrr commented Jun 27, 2019

It could be a weird interaction between jedi showing the signature and python-mode's builtin eldoc backend that tries to show the documentation in the same minibuffer. I have

(setq eldoc-documentation-function nil)

in my python-mode-hook. Could be that. If not, I'm going to need a repro to tell more.

@DiogoFerrari
Copy link
Author

I am not using eldoc. A repro code is difficult to get for this case.

@immerrr
Copy link
Collaborator

immerrr commented Jun 30, 2019

Starting with Emacs 25.1 global-eldoc-mode is enabled by default, so it could be active unless you specifically disabled it. Other than that, it's difficult to say what's going on without a repro, but most likely it's unrelated to jedi either. The only places where in jedi sources the docstrings are referred are in jedi:show-doc function that shows the docstring in a separate buffer and in the auto-complete backend implementation.

@tangxinfa
Copy link

For anyone who prefer integration jedi with eldoc:

(defun jedi:get-documentation-deferred ()
  (deferred:$
    (jedi:call-deferred 'get_definition)
    (deferred:nextc it
      (lambda (reply)
        (cl-loop for def in reply
                 do (cl-destructuring-bind (&key doc description full_name &allow-other-keys)
                        def
                      (when (or doc description)
                        (return
                         (string-trim
                          (concat
                           (propertize (or full_name "") 'face 'font-lock-variable-name-face)
                           "\n\n"
                           (or doc description)))))))))))
(cl-defun jedi:get-documentation-sync ()
  (epc:sync
   (jedi:get-epc)
   (deferred:timeout 500 nil (jedi:get-documentation-deferred))))

(setq jedi:get-in-function-call--d t) ; disable jedi's popup documentation
(add-hook 'python-mode-hook 
          (lambda ()
            (setq-local eldoc-documentation-function #'jedi:get-documentation-sync)))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants