idanarye / vim-dutyl

Coordinate D tools to work together for you
http://www.vim.org/scripts/script.php?script_id=5003
79 stars 13 forks source link

Function `complete` is not supported by currently loaded Dutyl modules. Possible reasons: DCD server not running #7

Closed stonemaster closed 9 years ago

stonemaster commented 9 years ago

I've installed the current master version of Dutyl using Vundle I'm having the following error when trying to get completion to work with Dutyl:

Fehler beim Ausführen von "function dutyl#dComplete":   (error while executing function dutyl#dComplete)                                                                                                                                                                  
Zeile   35: (line 35)
 Function `complete` is not supported by currently loaded Dutyl modules. Possible reasons: DCD server not running

Dcd-Server is running (I've started it using :DUDCDstartServer). I even cross-checked using the DCD Kate plugin Lumen which picks up the DCD server started by Dutyl and correctly displays completion tips. Is there something obvious I'm missing?

idanarye commented 9 years ago

What happens when you run

:echo dutyl#core#runTool('dcd-client','--query') dutyl#core#shellReturnCode()

when the DCD server is running?

stonemaster commented 9 years ago

The following is returned:

object.Exception@std/stdio.d(1902): Enforcement failed
----------------
dcd-client(pure @safe bool std.exception.enforce!(bool).enforce(bool, lazy const(char)[], immutable(char)[], ulong)+0x5e) [0x4aa76a]
dcd-client(ref std.stdio.File.LockingTextWriter std.stdio.File.LockingTextWriter.__ctor(ref std.stdio.File)+0x59) [0x49bc49]
dcd-client(std.stdio.File.LockingTextWriter std.stdio.File.lockingTextWriter()+0x29) [0x49bd69]
dcd-client(void std.stdio.File.write!(immutable(char)[], immutable(char)[], char).write(immutable(char)[], immutable(char)[], char)+0x2d) [0x479a81]
dcd-client(_Dmain+0x1b5) [0x4732d1]
dcd-client(void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll().void __lambda1()+0x18) [0x48d260]
dcd-client(void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate())+0x2a) [0x48d1ba]
dcd-client(void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll()+0x30) [0x48d220]
dcd-client(void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate())+0x2a) [0x48d1ba]
dcd-client(_d_run_main+0x1a3) [0x48d13b]
dcd-client(main+0x17) [0x481c0b]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7f08c769dec5]
 1

It seems that the dcd-client just crashes when calling it with a wrong command line argument. What version of DCD is needed for Dutyl? I have DCD 0.3.0~beta6 from the d-apt repository. Maybe this version is just too old. dcd-client --help also doesn't list the --query option.

idanarye commented 9 years ago

That's probably it - the --query flag was added at the final 0.3.0 release.

I use --query to verify that the DCD server is running - if it isn't, Dutyl can fall back to Dscanner for some of the options. I don't want to parse a random Enforcement fail exception to check that a flag is not supported(this is a recipe for future bugs. If there was an error message saying that the flag is not supported that was a whole different story...) so I rather adding a workaround flag for this.

Check out the feature/add-legacy-flag-for-old-dcd-without-query branch. It introduces a new flag - g:dutyl_dcd_assumeServerIsRunning - that you need to set to 1 in your vimrc to prevent Dutyl from relying on the --query flag and make it assume that the DCD server is running. If that works for you I'll merge that branch in the next release(that should be today or tomorrow).

Note that this will prevent Dutyl from using Dscanner for finding declaration locations. If you need that feature you'll have to upgrade to DCD 0.4.0. I don't want to alienate d-apt users, but there is a limit to how much I'm willing to invest in supporting old versions of DCD...

stonemaster commented 9 years ago

I won't be able until Monday to try your new feature branch. Anyway thank you very much for this quick fix on this issue!

But I totally agree with you regarding the support of older DCD versions. Just because my client is too old I wouldn't change your plugin. DCD is still work in progress and changing a lot (and compling is really easy for it). The real problem is that d-apt provides a month old DCD package which misses all the great new stuff. I'll contact the maintainer and ask him to update to a more recent release. What would be nice is if you could a short note on which minimum version of DCD is required for Dutyl.

So from my side just drop your fix, close this bug and if you like just add a little version requirement information. I'm eager trying Dutyl with a recent DCD and having some more bugs filed here :-)

idanarye commented 9 years ago

Added the docs