emacs-lsp / lsp-java

lsp-mode :heart: java
https://emacs-lsp.github.io/lsp-java
GNU General Public License v3.0
650 stars 90 forks source link

Yasnippet completion does not work, server-side snippets appear to be broken #330

Open RantSomeWhere opened 3 years ago

RantSomeWhere commented 3 years ago

The JDTLS server appears to supply its own set of snippets, or 'code templates' as they're called in Eclipse. The first problem is that these server-side snippets appear to override yasnippet completion (lsp-enable-snippet is set to t and company-yasnippet is loaded properly). I cannot get yasnippet completion to work. Secondly, these server-side snippets are broken themselves as well, which led me to rewrite most of my java snippets in yasnippet. Placeholders (like $TM_SELECTED_TEXT) are not populated and they don't follow my formatter code style (I like opening braces on their own lines, for example). I am not sure whether this is an lsp-java or lsp issue, or whether I should ask this on the jdtls github.

image

Is there any way to configure the behavior of lsp regarding snippets or turn off server-side snippets altogether?

yyoncho commented 3 years ago

placeholders are yet to be supported - if you want to use company-yasnippet you have to set the company-backends to something like (company-capf :with company-yasnippet)

yyoncho commented 3 years ago

((company-capf :with company-yasnippet)) not (company-capf :with company-yasnippet)