abingham / emacs-ycmd

Emacs client for ycmd, the code completion system.
MIT License
384 stars 46 forks source link

ycmd-restart-semantic-server makes ycm say unsupported command #499

Open mohkale opened 4 years ago

mohkale commented 4 years ago

Here's the output for ycmd-show-debug-info


((python
  (executable . "c:\\SP_CI_PROGRAMS\\Shells\\cmder\\vendor\\git-for-windows\\usr\\bin\\python3.exe")
  (version . "3.7.1"))
 (clang
  (has_support . t)
  (version . "clang version 8.0.0 (tags/RELEASE_800/final)"))
 (extra_conf
  (path . "c:/Users/MoHKale/.ycmd-config")
  (is_loaded . t))
 (completer
  (name . "C-family")
  (servers)
  (items
   ((key . "compilation database path")
    (value . "None"))
   ((key . "flags")
    (value . "['-Wall', '-Wextra', '-Werror', '-Werror=format-security', '-Werror=implicit-function-declaration', '-Wc++98-compat', '-Wno-long-long', '-Wno-variadic-macros', '-fexceptions', '-std=c++11', '-x', 'c++', '-I.', '-Ic:/Users/MoHKale\\\\includes', '-IC:/SP_CI_PROGRAMS/IDE/emacs/include', '-IC:/SP_CI_PROGRAMS/MinGW/include', '-resource-dir=c:\\\\Users\\\\MoHKale\\\\.vim\\\\plugged\\\\YouCompleteMe\\\\third_party\\\\ycmd\\\\third_party\\\\clang\\\\lib\\\\clang\\\\8.0.0', '-fno-delayed-template-parsing', '-fspell-checking']"))
   ((key . "translation unit")
    (value . "f:/Blarg/hello-world.c")))))

Server is running at: 127.0.0.1:62685

Ycmd Mode is enabled

--------------------

Ycmd version:   1.3snapshot (package: 20190416.807)
Emacs version:  26.1
System:         x86_64-w64-mingw32
Window system:  w32

Here's the relevent section of the server logs.

Traceback (most recent call last):
  File "c:\Users\MoHKale\.vim\plugged\YouCompleteMe\third_party\ycmd\ycmd\completers\completer.py", line 346, in OnUserCommand
    command = command_map[ arguments[ 0 ] ]
KeyError: 'RestartServer'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\Users\MoHKale\.vim\plugged\YouCompleteMe\third_party\ycmd\third_party\bottle\bottle.py", line 862, in _handle
    return route.call(**args)
  File "c:\Users\MoHKale\.vim\plugged\YouCompleteMe\third_party\ycmd\third_party\bottle\bottle.py", line 1740, in wrapper
    rv = callback(*a, **ka)
  File "c:\Users\MoHKale\.vim\plugged\YouCompleteMe\third_party\ycmd\ycmd\watchdog_plugin.py", line 104, in wrapper
    return callback( *args, **kwargs )
  File "c:\Users\MoHKale\.vim\plugged\YouCompleteMe\third_party\ycmd\ycmd\hmac_plugin.py", line 68, in wrapper
    body = callback( *args, **kwargs )
  File "c:\Users\MoHKale\.vim\plugged\YouCompleteMe\third_party\ycmd\ycmd\handlers.py", line 82, in RunCompleterCommand
    request_data ) )
  File "c:\Users\MoHKale\.vim\plugged\YouCompleteMe\third_party\ycmd\ycmd\completers\completer.py", line 348, in OnUserCommand
    raise ValueError( self.UserCommandsHelpMessage() )
ValueError: Supported commands are:
ClearCompilationFlagCache
FixIt
GetDoc
GetDocImprecise
GetParent
GetType
GetTypeImprecise
GoTo
GoToDeclaration
GoToDefinition
GoToImprecise
GoToInclude

I'm not very familliar with the ycmd codebade, but I've tracked down the file in question and it doesn't have RestartServer as a command. using rg, I've found that clangd does have it as a command, don't know if that'll help very much.

bstaletic commented 4 years ago

Hi. I am a ycmd maintainer. I don't know if you still care for the answer, but you basically got it right. Not every completer supports RestartServer. Since I also maintain the vim client, I'll have to talk about that one instead.

The RestartServer subcommand in the vim client is available as :YcmCompleter RestartServer. There's also :YcmRestartServer, which sends a /shutdown request and then sets up a new instance of the ycmd server.