emacs-ycmd
emacs-ycmd copied to clipboard
how dose emacs-ycmd detect a java project ?
after emacs-ycmd installed. and then i opening the java file within gradle java project. but it seems not detect the java project, there's no auto complete. emacs-ycmd dose not support java project ? or my emacs-ycmd installation there's something wrong ?
emacs-ycmd config at init.el
(use-package ycmd
:ensure t
:init
(add-hook 'after-init-hook #'global-ycmd-mode)
(add-hook 'java-mode-hook #'ycmd-mode)
(set-variable 'ycmd-server-command '("python3" "/Users/hoho/workspace/ycmd/ycmd/")))
;;;flycheck
(use-package flycheck
:ensure t
:diminish flycheck-mode
:init (global-flycheck-mode t))
;;;flycheck-ycmd
(use-package flycheck-ycmd
:ensure t
:init
(add-hook 'ycmd-file-parse-result-hook 'flycheck-ycmd--cache-parse-results)
(add-to-list 'flycheck-checkers 'ycmd)
:config
(flycheck-ycmd-setup)
(setq flycheck-indication-mode nil))
;;;company-ycmd
(use-package company-ycmd
:ensure t
:config
(company-ycmd-setup))
the debug info shows below:
Ycmd debug information for buffer java/App.java in java-mode:
((python (executable . "/usr/local/bin/python3") (version . "3.7.0")) (clang (has_support . :json-false) (version)) (extra_conf (path) (is_loaded . :json-false)) (completer))
Server is running at: 127.0.0.1:62143
Ycmd Mode is enabled
Ycmd version: 1.3snapshot (package: 20180724.1256) Emacs version: 26.1 System: x86_64-apple-darwin17.5.0 Window system: ns
Currently it looks like we don't. This might be because ycmd didn't support
java when we set up the language mappings in ycmd-file-type-map, but I'm
not sure. It might "just work" if you add (java-mode . ("java")) to
ycmd-file-type-map. Can you try that and let me know?
On Sun, Oct 28, 2018 at 6:06 AM yangjiannan [email protected] wrote:
emacs-ycmd was installed. and then i open java file within a java project(with gradle). but it seems not detacted the java project, there's no auto complete. emacs-ycmd dose not support java project ? or my emacs-ycmd installation there's something wrong ? the debug info shows below:
Ycmd debug information for buffer java/App.java in java-mode:
((python (executable . "/usr/local/bin/python3") (version . "3.7.0")) (clang (has_support . :json-false) (version)) (extra_conf (path) (is_loaded . :json-false)) (completer))
Server is running at: 127.0.0.1:62143
Ycmd Mode is enabled
Ycmd version: 1.3snapshot (package: 20180724.1256) Emacs version: 26.1 System: x86_64-apple-darwin17.5.0 Window system: ns
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/abingham/emacs-ycmd/issues/486, or mute the thread https://github.com/notifications/unsubscribe-auth/AAE1eD3rNaM5SP41mHPFuMyxKvNK95SEks5upUlygaJpZM4X9zXC .
Currently it looks like we don't. This might be because ycmd didn't support java when we set up the language mappings in
ycmd-file-type-map, but I'm not sure. It might "just work" if you add(java-mode . ("java"))toycmd-file-type-map. Can you try that and let me know? … On Sun, Oct 28, 2018 at 6:06 AM yangjiannan @.***> wrote: emacs-ycmd was installed. and then i open java file within a java project(with gradle). but it seems not detacted the java project, there's no auto complete. emacs-ycmd dose not support java project ? or my emacs-ycmd installation there's something wrong ? the debug info shows below: Ycmd debug information for buffer java/App.java in java-mode: ((python (executable . "/usr/local/bin/python3") (version . "3.7.0")) (clang (has_support . :json-false) (version)) (extra_conf (path) (is_loaded . :json-false)) (completer)) Server is running at: 127.0.0.1:62143 Ycmd Mode is enabled ------------------------------ Ycmd version: 1.3snapshot (package: 20180724.1256) Emacs version: 26.1 System: x86_64-apple-darwin17.5.0 Window system: ns — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#486>, or mute the thread https://github.com/notifications/unsubscribe-auth/AAE1eD3rNaM5SP41mHPFuMyxKvNK95SEks5upUlygaJpZM4X9zXC .
thanks a lot!
i did add (java-mode . ("java")) to ycmd-file-type-map , and it was not working
OK, that was just guessing on my part. Do you see anything in the *ycmd-server* buffer that gives you any clues? Does there seem to be any activity at all related to java files in there?
yes, *ycmd-server* buffer show ycmd server error,
2018-10-31 17:02:10,556 - INFO - Received filetype completion available request Traceback (most recent call last): File "/Users/nono/workspace/ycmd/third_party/bottle/bottle.py", line 862, in _handle return route.call(**args) File "/Users/nono/workspace/ycmd/third_party/bottle/bottle.py", line 1740, in wrapper rv = callback(*a, **ka) File "/Users/nono/workspace/ycmd/ycmd/watchdog_plugin.py", line 107, in wrapper return callback( *args, **kwargs ) File "/Users/nono/workspace/ycmd/ycmd/hmac_plugin.py", line 70, in wrapper body = callback( *args, **kwargs ) File "/Users/nono/workspace/ycmd/ycmd/handlers.py", line 166, in FiletypeCompletionAvailable RequestWrap( request.json )[ 'filetypes' ] ) ) File "/Users/nono/workspace/ycmd/ycmd/request_wrap.py", line 46, in init EnsureRequestValid( request ) File "/Users/yjn/workspace/ycmd/ycmd/request_validation.py", line 40, in EnsureRequestValid raise ServerError( message ) ycmd.responses.ServerError: Request missing required field: file_data["/Users/nono/workspace/hello-java-app/src/main/java/App2.java"]["filetypes"][0]
I'm not sure what the problem is. Is your project on github? Maybe I can try it from my end. I don't do any java work, so I don't have project to test this out on.
For me everything is fine:
2019-06-03 17:49:03,366 - INFO - Received event notification
2019-06-03 17:49:03,367 - DEBUG - Event name: FileReadyToParse
2019-06-03 17:49:03,367 - INFO - Adding buffer identifiers for file: /tmp/x.java
2019-06-03 17:49:03,367 - ERROR - No semantic completer exists for filetypes: ['java']
Traceback (most recent call last):
File "/usr/local/share/ycmd/ycmd/../ycmd/server_state.py", line 101, in FiletypeCompletionAvailable
self.GetFiletypeCompleter( filetypes )
File "/usr/local/share/ycmd/ycmd/../ycmd/server_state.py", line 90, in GetFiletypeCompleter
current_filetypes ) )
ValueError: No semantic completer exists for filetypes: ['java']
It's detected, so all you need is to have ycmd built with java completer back end support.