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

Function Signatures are not displayed in mini-buffer #24

Open
jack836 opened this issue May 8, 2018 · 11 comments
Open

Function Signatures are not displayed in mini-buffer #24

jack836 opened this issue May 8, 2018 · 11 comments
Labels
bug a feature isn't working

Comments

@jack836
Copy link

jack836 commented May 8, 2018

Could not get function signatures to be displayed in mini buffer as shown here

Some points of concern

  • I am using the latest emacs-27
  • I run emacs inside the terminal using the -nw option

My .emacs

(add-hook 'python-mode-hook 'company-mode)
(company-quickhelp-mode 1)

(defun my/python-mode-hook ()
  (add-to-list 'company-backends 'company-jedi))
(add-hook 'python-mode-hook 'my/python-mode-hook)
(setq jedi:complete-on-dot t) 
(setq jedi:tooltip-method 'pos-tip)
;; (setq jedi:tooltip-method nil) 

I tried setting jedi:tooltip-method to both nil and pos-tip, nothing changed.

The output of jedi:show-setup-info is as follows

; Emacs Lisp version: (:emacs-version "27.0.50" :jedi-version "0.2.7" :python-environment-version "0.0.2alpha0") ;; Python version: ((:version "3.5.3 (default, Jan 19 2017, 14:11:04) \n[GCC 6.3.0 20170118]" :file nil :name "sys") (:version "0.12.0" :file "/home/svi/.emacs.d/.python-environments/default/lib/python3.5/site-packages/jedi/__init_\ _.py" :name "jedi") (:version "0.0.5" :file "/home/svi/.emacs.d/.python-environments/default/lib/python3.5/site-packages/epc/__init__.\ py" :name "epc") (:version "0.0.3" :file "/home/svi/.emacs.d/.python-environments/default/lib/python3.5/site-packages/sexpdata.py" \ :name "sexpdata")) ;; Command line: (:virtualenv "/home/svi/.virtualEnvs/python3/bin/virtualenv" :virtualenv-version "15.2.0\n") ;; Customization: ((jedi:complete-on-dot . t) (jedi:doc-display-buffer . display-buffer) (jedi:doc-hook view-mode) (jedi:doc-mode . rst-mode) (jedi:environment-root) (jedi:environment-virtualenv) (jedi:get-in-function-call-delay . 1000) (jedi:get-in-function-call-timeout . 3000) (jedi:goto-definition-config (nil nil nil) (t nil nil) (nil definition nil) (t definition nil) (nil nil t) (t nil t) (nil definition t) (t definition t)) (jedi:goto-definition-marker-ring-length . 16) (jedi:imenu-create-index-function . jedi:create-nested-imenu-index) (jedi:import-python-el-settings . t) (jedi:install-imenu) (jedi:install-python-jedi-dev-command "pip" "install" "--upgrade" "git+https://github.com/davidhalter/jedi.git@dev\ #egg=jedi") (jedi:key-complete . [C-tab]) (jedi:key-goto-definition . [67108910]) (jedi:key-goto-definition-pop-marker . [67108908]) (jedi:key-related-names . "^Cr") (jedi:key-show-doc . "^Cd") (jedi:server-args) (jedi:server-command "/home/svi/.emacs.d/.python-environments/default/bin/jediepcserver") (jedi:setup-keys) (jedi:tooltip-method pos-tip popup) (jedi:use-shortcuts) (python-environment-default-root-name . "default") (python-environment-directory . "~/.emacs.d/.python-environments") (python-environment-virtualenv "virtualenv" "--system-site-packages" "--quiet"))

When I open a python file i receive a warning and Eldoc is loaded as shown below

screen shot 2018-05-08 at 20 01 10

Once it starts autocomplete, Eldoc disappears (probably due to limited space)

screen shot 2018-05-08 at 19 53 22

Finally no signatures completion when inside function paranthesis

screen shot 2018-05-08 at 20 05 42

I love this feature and would be great if if works. Any help is highly appreciated.

@chameco
Copy link

chameco commented Jun 6, 2018

I'm having the same issue. Calling jedi:get-in-function-call with point inside the parentheses yields

deferred error : (error "\"AttributeError(\\\"'Definition' object has no attribute 'get_code'\\\",)\"")

which makes me think the problem is possibly inside Jedi itself.

@jack836
Copy link
Author

jack836 commented Jun 11, 2018

I get the same error too when running jedi:get-in-function-call. But I get it (function signatures) to work when I use elpy as a front-end to Jedi by setting (setq elpy-rpc-backend "jedi"). So I am confused now???

@jack836
Copy link
Author

jack836 commented Jun 12, 2018

I came to know that, this issue has been already dealt with; see 294 and 296. I manually modified 3 lines in jediepcserver.py (as shown in the above links) and it works now.

@srustamo
Copy link

srustamo commented Jul 5, 2018

@jack836 did you need to re-run the setup? I changed those three lines, with no effect.

@srustamo
Copy link

srustamo commented Jul 5, 2018

I re-run the setup, and got things running. Where do you see (supposed to see) the function sigs? Minibuffer? Tooltip? I see the sig as a tooltip in the buffer itself (see screenshot).

screenshot 2018-07-05 21 08 54

@ghost
Copy link

ghost commented Aug 10, 2018

@jack836, would it be possible to paste the three lines you modified please?

@Islam0mar
Copy link

@noelfarrugia09

line 103: params=[p.name for p in call_def.params], 

line 105:  call_name=call_def.name,

line 179:   return list(map(get_names_recursively, jedi.api.names(*args))) 

then reinstall server "for me I have to delete then install".

@ghost
Copy link

ghost commented Aug 11, 2018

Thanks! The modification seems to work when tested using the function jedi:get-in-function-call. However, it's not working as expected. When I call the function jedi:get-in-function-call with the cursor between the braces of a function I get the parameters shown in the mini-buffer as shown in the figure below; however, as soon as I start typing, the function arguments are hidden.

My question is how can I get the function signature to show automatically and keep it in the mini-buffer?

My current setup for company and jedi:

;; Installing company mode
(use-package company
  :ensure t
  :config
  (add-hook 'after-init-hook 'global-company-mode)
  (setq company-idle-delay 0)  ;; Disable the delay
  (company-tng-configure-default))  ;; Enable tab style completion

(global-set-key (kbd "C-c c") 'company-complete)

;; Installing company quick help
(use-package company-quickhelp
  :ensure t
  :config
  (company-quickhelp-mode))

;;; Company jedi
(use-package company-jedi
  :ensure t)

(defun my/python-mode-hook ()
  (add-to-list 'company-backends 'company-jedi))

(add-hook 'python-mode-hook 'my/python-mode-hook)

(setq jedi:environment-root "default")  ; or any other name you like
(setq jedi:environment-virtualenv
      (append python-environment-virtualenv
              '("--python" "/usr/bin/python3")))
(setq jedi:complete-on-dot t)
(setq jedi:tooltip-method nil)
(setq jedi:get-in-function-call-delay 0)

image

Thanks in advance!

@Islam0mar
Copy link

You have to enable jedi-mode. Change this:

(defun my/python-mode-hook ()
  (add-to-list 'company-backends 'company-jedi))

To

(defun my/python-mode-hook ()
  (add-to-list 'company-backends 'company-jedi)
  (lambda () (setq jedi-mode t))))

When you idle for a while, it would display it again.

@ghost
Copy link

ghost commented Aug 12, 2018

@CatchMeFastFat Thanks a lot!!!!!!! I had to enable jedi-mode. Your code did not work but managed to make it work using the following code:

(defun my/python-mode-hook ()
  (add-to-list 'company-backends 'company-jedi)
  (jedi-mode))

Thanks again! 👍

@dvincentwest
Copy link

dvincentwest commented Sep 18, 2018

Confirming that the above fixes are working for me running latest emacs on Windows 10 x64. Does this mean that this is a bug (maybe because Jedi API has been updated or something to that effect) and this needs to be fixed? Modifying 3 lines seems a fairly small ask, but does it break something else?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug a feature isn't working
Development

No branches or pull requests

6 participants