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

Code Completion inserting return type. #184

Closed
laep opened this issue Dec 16, 2019 · 13 comments
Closed

Code Completion inserting return type. #184

laep opened this issue Dec 16, 2019 · 13 comments

Comments

@laep
Copy link

laep commented Dec 16, 2019

When I' auto completing variables instead of adding:

randomVariable

It will add:

randomVariable : int

This happens for anything I try to auto complete.

For example if i try to auto complete the method:

getClass()

I will get:

getClass() : Class<?>

Im doing this on a fresh installation using the config on the lsp-java readme

@yyoncho
Copy link
Member

yyoncho commented Dec 16, 2019

My guess is that yasnippet is not loaded, can you eval (require 'yasnippet) and check whether this will fix your issue?

@laep
Copy link
Author

laep commented Dec 16, 2019

My guess is that yasnippet is not loaded, can you eval (require 'yasnippet) and check whether this will fix your issue?

Tried that, i also have yas-global-mode 1, the error still occurs

@yyoncho
Copy link
Member

yyoncho commented Dec 16, 2019

@laep I tested the configuration from the readme in the https://github.com/emacs-lsp/lsp-docker/ and in works fine.

  1. can you check Messages buffer for errors?
  2. Can you delete ~/.emacs.d/elpa and try again with the configuration from readme?
  3. Which version of emacs do you use?

@laep
Copy link
Author

laep commented Dec 17, 2019

@laep I tested the configuration from the readme in the https://github.com/emacs-lsp/lsp-docker/ and in works fine.

1. can you check Messages buffer for errors?

2. Can you delete ~/.emacs.d/elpa and try again with the configuration from readme?

3. Which version of emacs do you use?

I did several testing with my configurations and seems like evil-collection where having a problem. I was able to solve it by adding:

:custom (evil-collection-company-use-tng nil)

@yyoncho
Copy link
Member

yyoncho commented Dec 17, 2019

company-tng is incompatible with company-lsp

see company-mode/company-mode#891

@yyoncho yyoncho closed this as completed Dec 17, 2019
@laep
Copy link
Author

laep commented Dec 17, 2019

Now its working properly.

Maybe you can help me with a separate issue.
Is it possible to have code actions as a drop down menu?
also generate tostrings and generate constructors only allow me to select one parameter

@yyoncho
Copy link
Member

yyoncho commented Dec 17, 2019

Is it possible to have code actions as a drop down menu?

Dropdown like right click menu or like helm/ivy?

also generate tostrings and generate constructors only allow me to select one parameter

It depends on what you are using(e. g. helm/ivy/vanilla), but you could select multiple elements.

E. g. in help you could use C-SPC to mark multiple entries M-M to mark all.

@laep
Copy link
Author

laep commented Dec 17, 2019

Is it possible to have code actions as a drop down menu?

Dropdown like right click menu or like helm/ivy?

Right now i have to type :lsp-execute-code-action in evil mode o M-x lsp-execute-code-action
After typing that i have to type the code action i want to run.

By drop down i meant a simple dropdown menu like the completion one with all the code actions i can take. Maybe some keys that let me select the code actions on the sideline without using the mouse.

I also wouldn't mind if it was an helm like menu in the minibuffer

also generate tostrings and generate constructors only allow me to select one parameter

It depends on what you are using(e. g. helm/ivy/vanilla), but you could select multiple elements.

E. g. in help you could use C-SPC to mark multiple entries M-M to mark all.

I am using Helm-lsp. Most code actions were complainning they couldnt find helm-map when i tried to use code actions. I assume helm is enforced even if documentation doesnt says anything about it.

I didn't know about C-SPC, seems now i can mark the arguments i want, its just annoying being forced to use the arrow keys. Is there any way to use evil keys? e.g: C-j and C-k to chose and v to mark them?

@yyoncho
Copy link
Member

yyoncho commented Dec 17, 2019

Right now i have to type :lsp-execute-code-action in evil mode o M-x lsp-execute-code-action
After typing that i have to type the code action i want to run.

Enabling helm-mode will fix that.

I didn't know about C-SPC, seems now i can mark the arguments i want, its just annoying being forced to use the arrow keys. Is there any way to use evil keys? e.g: C-j and C-k to chose and v to mark them?

(define-key helm-map (kbd "C-k") 'helm-previous-line)
(define-key helm-map (kbd "C-j") 'helm-next-line)
(define-key helm-map (kbd "v")      'helm-toggle-visible-mark) ;; this will steal v key. 

@mangkoran
Copy link

mangkoran commented Apr 18, 2021

Now its working properly.

Maybe you can help me with a separate issue.
Is it possible to have code actions as a drop down menu?
also generate tostrings and generate constructors only allow me to select one parameter

I have the same problem. I dont know if I should open new issue or not. I am using ivy, and i want to use lsp-code-action's generate constructor to generate constructor with multiple parameters. But it only allows me to select one paramater. C-SPC not working with ivy

@dakra
Copy link
Contributor

dakra commented Apr 19, 2021

Ivy has multi-select too but probably way less used than in helm.
You can press C-o and then m to mark all the candidates
you want. Or if you want all candidates selected you can
press C-o t.

@mangkoran
Copy link

Thank you. I can confirm this. What should I do is calling hydra-ivy/body (as you said C-o in vanilla, in my Doom it is M-o).

@Ma-Nu-El
Copy link

in vanilla, in my Doom it is M-o).

Yes! Thank you very much!

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

No branches or pull requests

5 participants