www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Neovim autocompletion using deoplete

reply landaire <landergriffith+dlang gmail.com> writes:
I wanted to drop by with a link to something I've been working on 
for a few days: deoplete-d [1]. If anyone uses Neovim with 
deoplete [2] this plugin will add asynchronous autocompletion for 
D utilizing DCD. It's pretty basic right now but I've found it 
better than using dutyl.

Issues are expected but as long as dcd-client and dcd-server are 
in your $PATH nothing should break terribly (there are options to 
set these manually but I haven't bothered to actually test them).

Some notes since I'm missing docs:

- By default it'll auto-start dcd-server and kill the process 
when nvim exits
- If your buffer has a parent directory `src` or `source` then 
that directory will be added to DCD's import paths, otherwise the 
buffer's parent dir is added

Demo: https://gfycat.com/ImprobableSecondhandAmericanwarmblood

[1] https://github.com/landaire/deoplete-d
[2] https://github.com/Shougo/deoplete.nvim
Feb 20 2016
next sibling parent reply NVolcz <niklas.volcz gmail.com> writes:
On Saturday, 20 February 2016 at 22:04:57 UTC, landaire wrote:
 Demo: https://gfycat.com/ImprobableSecondhandAmericanwarmblood

 [1] https://github.com/landaire/deoplete-d
 [2] https://github.com/Shougo/deoplete.nvim
This is well worthy the announcement group and reddit :-)
Feb 20 2016
parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 02/21/2016 01:44 AM, NVolcz wrote:
 On Saturday, 20 February 2016 at 22:04:57 UTC, landaire wrote:
 Demo: https://gfycat.com/ImprobableSecondhandAmericanwarmblood

 [1] https://github.com/landaire/deoplete-d
 [2] https://github.com/Shougo/deoplete.nvim
This is well worthy the announcement group and reddit :-)
Thanks! I'll put it on social media on Monday. -- Andrei
Feb 21 2016
prev sibling parent reply maik klein <maikklein googlemail.com> writes:
On Saturday, 20 February 2016 at 22:04:57 UTC, landaire wrote:
 I wanted to drop by with a link to something I've been working 
 on for a few days: deoplete-d [1]. If anyone uses Neovim with 
 deoplete [2] this plugin will add asynchronous autocompletion 
 for D utilizing DCD. It's pretty basic right now but I've found 
 it better than using dutyl.

 Issues are expected but as long as dcd-client and dcd-server 
 are in your $PATH nothing should break terribly (there are 
 options to set these manually but I haven't bothered to 
 actually test them).

 Some notes since I'm missing docs:

 - By default it'll auto-start dcd-server and kill the process 
 when nvim exits
 - If your buffer has a parent directory `src` or `source` then 
 that directory will be added to DCD's import paths, otherwise 
 the buffer's parent dir is added

 Demo: https://gfycat.com/ImprobableSecondhandAmericanwarmblood

 [1] https://github.com/landaire/deoplete-d
 [2] https://github.com/Shougo/deoplete.nvim
Good job, but could you also explain why do you think its better than in dutyl? I currently also use nvim with dutyl(dcd, dscanner, fmt) and youcompleteme and I haven't run into any issues. Is it possible to filter autocompletions based on the type? Like modules, struct alias, enum etc?
Feb 21 2016
next sibling parent Idan Arye <GenericNPC gmail.com> writes:
On Sunday, 21 February 2016 at 13:36:26 UTC, maik klein wrote:
 Good job, but could you also explain why do you think its 
 better than in dutyl? I currently also use nvim with dutyl(dcd, 
 dscanner, fmt) and youcompleteme and I haven't run into any 
 issues.
As Dutyl's author, I can think of few things: 1) Dutyl requires the user to run DCD in the background. It provides helpers to start and stop the DCD server, but it's still up to the user to run them. I did not want to start DCD automatically when I have no way of closing it when the user exits Vim. deoplete-d is running the DCD server as a Python subprocess, so it can fully control it's lifetime. 2) Dutyl is running dcd-client synchronously and parses it's output in the main Vim process, which freezes Vim. The freezes are very short - DCD is very fast and there is not much to parse - but they still exist. deoplete-d, on the other hand, is using the deoplete framework to do this asynchronously, so the completions seem instantaneous. This is mainly an illusion - they should take about the same time(OK, maybe a bit faster - after all, Python is faster than VimScript), and they only feel faster because they are done asynchronously and there are no freezes, but I can see how it improves the UX.
Feb 21 2016
prev sibling parent reply landaire <landergriffith+dlang gmail.com> writes:
On Sunday, 21 February 2016 at 13:36:26 UTC, maik klein wrote:
 Good job, but could you also explain why do you think its 
 better than in dutyl? I currently also use nvim with dutyl(dcd, 
 dscanner, fmt) and youcompleteme and I haven't run into any 
 issues.

 Is it possible to filter autocompletions based on the type? 
 Like modules, struct alias, enum etc?
Sorry, I didn't mean to say it's objectively better than dutyl but it's been working better for me. dutyl has some solid features that this plugin does not have such as calltip completion (simple enough to add), finding ddoc, and finding declarations. As Idan pointed out, this fits my own workflow a little better since I don't have to manually start/stop dcd-server and I've found that it's a little more reliable with triggering completions (although this may have been a misconfiguration on my end). Currently you cannot filter autocompletions based on the type but that might be easy to add depending on what you mean.
Feb 21 2016
parent reply Idan Arye <GenericNPC gmail.com> writes:
On Sunday, 21 February 2016 at 18:34:42 UTC, landaire wrote:
 On Sunday, 21 February 2016 at 13:36:26 UTC, maik klein wrote:
 Good job, but could you also explain why do you think its 
 better than in dutyl? I currently also use nvim with 
 dutyl(dcd, dscanner, fmt) and youcompleteme and I haven't run 
 into any issues.

 Is it possible to filter autocompletions based on the type? 
 Like modules, struct alias, enum etc?
Sorry, I didn't mean to say it's objectively better than dutyl but it's been working better for me. dutyl has some solid features that this plugin does not have such as calltip completion (simple enough to add), finding ddoc, and finding declarations. As Idan pointed out, this fits my own workflow a little better since I don't have to manually start/stop dcd-server and I've found that it's a little more reliable with triggering completions (although this may have been a misconfiguration on my end). Currently you cannot filter autocompletions based on the type but that might be easy to add depending on what you mean.
No offense LoL. People who have time to get offended by hearing their project is inferior to another project, should better use that time to improve that project of them! At any rate, programming(any kind of engineering actually) is the art of tradeoffs. I could add these features to Dutyl, but then I'll have to add more requirements, which is something I don't want to do.
Feb 21 2016
parent reply landaire <landergriffith+dlang gmail.com> writes:
On Sunday, 21 February 2016 at 19:46:50 UTC, Idan Arye wrote:
 No offense LoL. People who have time to get offended by hearing 
 their project is inferior to another project, should better use 
 that time to improve that project of them!
I'm not sure where I said or how you got the idea I was offended, but thanks for the encouragement.
Feb 21 2016
parent Idan Arye <GenericNPC gmail.com> writes:
On Sunday, 21 February 2016 at 22:56:23 UTC, landaire wrote:
 On Sunday, 21 February 2016 at 19:46:50 UTC, Idan Arye wrote:
 No offense LoL. People who have time to get offended by 
 hearing their project is inferior to another project, should 
 better use that time to improve that project of them!
I'm not sure where I said or how you got the idea I was offended, but thanks for the encouragement.
Sorry, I thought my English was better than that... I meant "not offense taken"...
Feb 22 2016