Closed thisEric closed 7 years ago
Hmm...it looks like the server is running. Let's see if we can narrow down the issue.
First, did you install the latest company-ycmd
as well? It's a separate package from ycmd
, so perhaps there's a mismatch.
Next, if you run ycmd-display-completions
at some point where you expect completion, does it show anything? It should dump its results into the *ycmd-completions*
buffer.
Finally, what does ycmd-show-debug-info
show you?
yes, I have company-ycmd installed and configured. ycmd-display-completions shows "No completion available" ycmd-show-debug-info:
Ycmd debug information for buffer ClangIndexer.cpp in c++-mode: No debug info available from server
Server is running at: 127.0.0.1:41838 Ycmd Mode is enabled Ycmd version: 1.2 Emacs version: 25.2.1 System: x86_64-unknown-linux-gnu Window system: x
and I found something very strange, the auto completion works if I connect to the machine on windows with putty, but doesn't work with native emacs.
another thing, if I have compile_commands.json in source directory, then I don't need to have any global config file, right ?
another thing, if I have compile_commands.json in source directory, then I don't need to have any global config file, right ?
Yes, I think that's correct.
he auto completion works if I connect to the machine on windows with putty, but doesn't work with native emacs.
Weird! Do you mean that you're ssh'ing into the machine from windows with Putty and running console emacs? Or that you're running emacs on a windows machine and accessing files with tramp/putty?
Are you by any chance using spacemacs? That might be messing with your configuration.
I am ssh'ing the linux machine with putty and run console emacs, and ycmd works. I don't have emacs installed on windows. I am trying with GNU emacs, don't have spacemacs, not sure whether it's related with emacs version, since I tried with latest build.
I guess the next thing is to try to pinpoint the error. Can you use debug-on-error
or stack-trace-on-error
to see where the failure is happening?
Also please run emacs -Q
and evaluate this code:
(require 'package)
(package-initialize) ; this works if you installed ycmd from melpa and
; `pacakge-user-dir` is default (~/.emacs.d/elpa)
(require 'ycmd)
(global-ycmd-mode)
(set-variable 'ycmd-server-command '("python" "/path/to/ycmd/ycmd"))
(require 'company)
(global-company-mode)
(require 'company-ycmd)
(company-ycmd-setup)
and open this file for example and try to complete /path/to/ycmd/cpp/ycm/Candidate.cpp
. You should be able to complete.
This works on my Fedora 25 system
@abingham , I tried with debug-on-error enabled, but still failed, and I didn't get more debug info to locate the error point.
@ptrv , I tried with your config, the same issue with before. failed with native emacs, but succeed with putty ssh connection, I attach the snapshot for your reference.
I tried to degrade emacs version to 24.5, still get the same error.
@abingham @ptrv , BTW, is there any customization for company or company-ycmd performance?
I only
(setq company-idle-delay 0.1)
but the complete speed is still not as fast as expected, I always need to wait for the candidates show up. current completion speed is bearable, but it will be very nice if I can improve it more, thanks
Sorry for the late response. I've been on vacation the past week. Hopefully I'm not too jet-lagged right now to help you out!
is there any customization for company or company-ycmd performance?
If you've got ycmd-force-semantic-completion
set to non-nil then you'll often see noticeable delay. Some people (like me) leave it disabled and have a separate function that temporarily enables forced-semantic-completion, and we bind that function to a separate keybinding.
I'm still pretty baffled by what you're seeing. One possibility is that we're somehow failing to parse the server's port. Can you check the value of ycmd--server-actual-port
?
@abingham , I reinstalled the system and cannot reproduce this issue any more, thanks for your comments, and I close this issue right now.
OK, sorry it took so long, but I'm glad you got things working.
I installed stable ycmd and emacs-ycmd from melpa-stable (version 1.2 )
I follow the configs: (require 'ycmd) (add-hook 'after-init-hook #'global-ycmd-mode) (set-variable 'ycmd-server-command '("python" "/path/to/ycmd/package")) (require 'company-ycmd) (company-ycmd-setup)
I didn't set ycmd-global-config, and have compile_commands.json in the root directory, from ycmd document, it will find this .json file.
but when I try with company-ycmd auto completion, it doesn't work at all, did I miss something?
ycmd-server buffer: serving on http://127.0.0.1:39031 DEBUG- Keeping subservers alive
Message buffer: REQUEST [error] Error (error) while connecting to http://127.0.0.1:39031/completions. deferred error: (wrong-type-argument number-or-p nil)
Any suggestion to help me enable ycmd for emacs ?