Closed LuciferK9 closed 5 years ago
Hi @LuciferK9, by analyzing the logs the issue is on this line ncm2_d_dcd.py:25
when running on MacOS:
server_args = list(vim.eval("g:ncm2_d#dcd_server_args"))
1 - Looks like you overwrote the default values of these args, did you? I mean, by looking at the logs I can see that the server had these arguments, and by default they are meant to be ['-I/usr/include/dmd/druntime/import', '-I/usr/include/dmd/phobos', '-I/usr/include/dlang/dmd']
:
2019-02-03 19:39:15,064 [DEBUG @ async_session.py:_on_response:100] 25538 - received response: None, [b'-I/usr/local/include/dlang/dmd/druntime/import', b'-I/usr/local/include/dmd/phobos', b'-I/usr/local/include/dmd']
2 - Can you try to manually start the following command?
dcd-server -I/usr/local/include/dlang/dmd/druntime/import -I/usr/local/include/dmd/phobos -I/usr/local/include/dmd
and check if you have got any errors?
3 - If number #2 doesn't result in any error, I'd suggest that you try python3.6 instead of python3.7 on MacOS, maybe there's a serialization issue over message pack that's not clear in the logs.
If none of these steps resolve your problem, as a workaround for now you can disable the autostart process of dcd with ncm2_d_dcd.py by setting this var:,
let g:ncm2_d#dcd_autostart_server=0
by disabling the autostart then you're supposed to bootstrap the server by yourself, maybe you can always have dcd-server running in background or autostart in the shell.
4 - Out of curiosity, on neovim, what do you have when you evaluate this expression?
:echo g:ncm2_d#dcd_server_args
Yes. I just deleted my whole vim folder and I'm crying so if I don't reply tomorrow or the next day please don't close the issue. I'll try to reply as soon as I can. But I remember something:
Thanks for your help!
I tried python 3.6 but it still says the same error. I think it's a problem with the vim module.
I wrote a = vim.eval('g:AutoPairs')
above the line that evals the arguments and I get the same error but other plugins that use python don't give this error.
I don't code in python so I'm sorry that I can't help.
@LuciferK9, which version of pynvim
and msgpack
do you have installed? I'm starting to think that maybe there might be a serialization issue with msgpack over list types (even though on Linux it works)
❯ pip3 freeze | egrep "(msgpack)|(pynvim)"
msgpack==0.6.0
pynvim==0.3.1
Could you try to install this version of msgpack?
pip3 install msgpack==0.6.0
If none of this works I can probably provide a string as an argument as opposed to a list of strings.
I have
msgpack==0.6.1 pynvim==0.3.2
I installed msgpack 0.6.0 and I get the same error.
Is there something I can try to test msgpack?
@LuciferK9, can you try this branch issue_6
https://github.com/ncm2/ncm2-d/tree/issue_6, and see if works? I added this variable g:ncm2_d#dcd_server_args_str
, which has this default value:
let g:ncm2_d#dcd_server_args_str = '-I/usr/include/dmd/druntime/import -I/usr/include/dmd/phobos -I/usr/include/dlang/dmd'
Could you double check all directories you want to include on MacOS, and fill out the right string based on this example? As you can see, the -I
should be concatenated with the included directory, since this will be split with spaces.
@LuciferK9, did you have the chance to test this branch that I mentioned in the last reply?
@viniarck Sorry about that! I'll try it right now. I've been busy lately and I don't get notifications from the issue so I didn't notice. Sorry for wasting your time and thanks for being patient.
@viniarck I just tried it and I get the same error but if I try :py import vim; print(vim.eval("g:ncm2_d#dcd_server_args_str"))
from within vim the eval works.
I made it work by replacing the main function with:
def main():
"""Main function."""
start_dcd_server()
I tried that in master. It only works with the standard library though. I'm using gtk-d and I get autocompletation but it thinks that each folder is an import path instead of showing the import paths from dub.json but I think this is a different issue. I also get "dcd-server didn't cache any symbols! Double check dcd include paths -I flag!" but I don't know what that means but it looks like a warning only and I already checked my include paths.
I also tried sending vim
through an argument to the function start_dcd_server
using the args
parameter in the Process constructor? but I got the same error. I thought it would send a reference to that "file handler/descriptor" or something like that but I don't know python so I just gave up.
Hi @LuciferK9, If you got this error: "dcd-server didn\'t cache any symbols! Double check dcd include paths -I flag!"
, that means that dcd-server
started without the right include paths (on Linux it's supposed to be either one of these ['-I/usr/include/dmd/druntime/import', '-I/usr/include/dmd/phobos', '-I/usr/include/dlang/dmd']
paths). The easiest way to figure this out, is to manually start dcd-server in the shell, and see how many symbols dcd cached, if it's zero, then the include folders are wrong.
Yes, any library like gtk-d
you install with dub should be available for autocompletion, as long as it is in the dub list
then, the dcd-client will ask dcd-server
to auto include them during runtime with this variable https://github.com/ncm2/ncm2-d/blob/adad9e8bef50819e52b33e01a2d42c576c08e2e1/autoload/ncm2_d.vim#L76
(which you don't need to edit, since it parses the output from dub list
).
So, here's what I would recommend:
1 - Try to manually start dcd-server
in your shell and make sure in the standard output it says it cached a positive number of symbols. Once you figure this out, you can use these dirs as -I
flags in the script.
2 - If the previous step fails, a temporary workaround, is to always have dcd-server
running in the background, which is not that bad. There are multiple ways to accomplish this, either with an autocmd on neovim, .zshrc, .bashrc or even whenever your OS starts.
You're almost there. Don't give up, if you manage to find a solution, post here to help other MacOS users. Thanks!
It's working now with the standard library. I still get 0 symbols cached but I included the same folders than on linux (Phobos, import) but using the correct path obviously. The only problem I have now is that it tries to import folders that aren't modules for example: gtk-d has a folder structure like:
gtkd/src/...
gtkd/generated/
gtkd/generated/gtkd
gtkd/generated/gtkd/{gtk, cairo, ...}
If I type import g
It completes generated
, gtkd
, gtkc
but those are not modules, those are only folders.
The actual modules are inside of gtkd/generated/***
and are set in the dub.json file.
I don't know if that is a problem with ncm2-d or dcd but it worked with another editor that I think it used dcd too. I can live with it, I only use autocompletation because sometimes I forget the function names but I still type the whole name.
I'm dualbooting linux so I think I'm not going to code anymore on Mac but your plugin works perfectly on linux.
I'm curious about what Process
did and why it works without it. I assume that it was just a way to implement concurrency in python. But if that's the case, deleting it would drop the performance on larger projects? I didn't notice the plugin blocking vim while autocompleting but it's a small project.
Thanks for your help. If another Mac user has problems I will be glad to help. Should I close this? It doesn't crash on startup anymore.
Hi @LuciferK9,
multiprocessing.Process
was used for performance reasons. I don't have benchmarks though to compare with bigger/smaller projects. Totally appreciate your feedback. Yes, I believe we can close this issue. Thanks again! Enjoy developing on Linux from now on :), it's rock solid.
When I open neovim with a D file, the plugin crashes with this trace.
Here are the logs from yarp: nvim_log_py3_ncm2_core nvim_log_py3_ncm2_d nvim_log_py3_ncm2_d_dcd
MacOS Mojave 10.14.3 Neovim v0.3.4 DMD64 v2.084 dcd v0.10.2-11-gadc3b81
I used this same setup in Linux yesterday but I can't get it to work in MacOS.