Request for editor scripting help

Brian Schott briancschott at gmail.com
Sat Aug 17 13:37:21 PDT 2013


On Saturday, 17 August 2013 at 18:25:50 UTC, Tobias Pankrath 
wrote:
> How do the existing plugins handle completion of non-saved 
> parts of the file? Currently I'm just saving the file on every 
> completion request. However that is a usability nightmare. 
> Would saving to a temporary do without confusing  DCD?

There are several ways that you can solve this, depending on the 
implementation of whatever function you use to launch the client.

The client supports reading from a file (which should be a 
temporary file to avoid the UI issues you mentioned), or from 
standard input. It writes to standard output.

1. Write the buffer to a temporary file, run the client on this 
file and redirect to another temporary. Then read this file and 
display the completions
2. popen "dcd-client > output.txt" and read the completions. This 
is what I use with Lua because its implementation of popen 
doesn't allow reading and writing to the same process. (I know 
the implementation in git at the moment does this backwards. I'm 
going to fix it this evening)
3. popen the client and handle everything in memory. This is 
probably the best way to handle it.


More information about the Digitalmars-d mailing list