This commit is contained in:
Hackerpilot 2013-09-01 13:04:25 +00:00
commit 49578a49aa
6 changed files with 59 additions and 21 deletions

View File

@ -20,10 +20,8 @@ back to the client.
* *import* statement completions * *import* statement completions
* Not working: * Not working:
* Automatic starting of the server by the client * Automatic starting of the server by the client
* Windows support (I don't know that it won't work, but this program is not tested on Windows yet)
* UFCS * UFCS
* Autocompletion of declarations with template arguments * Autocompletion of declarations with template arguments
* Fields inherited from super classes or implemented interfaces.
* *auto* declarations * *auto* declarations
* *alias this* * *alias this*
* Determining the type of an enum member when no base type is specified, but the first member has an initialaizer * Determining the type of an enum member when no base type is specified, but the first member has an initialaizer

View File

@ -594,7 +594,7 @@ static this()
{ {
s.parts ~= alignof_; s.parts ~= alignof_;
s.parts ~= new ACSymbol("dig", CompletionKind.keyword, s); s.parts ~= new ACSymbol("dig", CompletionKind.keyword, s);
s.parts ~= new ACSymbol("episilon", CompletionKind.keyword, s); s.parts ~= new ACSymbol("epsilon", CompletionKind.keyword, s);
s.parts ~= new ACSymbol("infinity", CompletionKind.keyword, s); s.parts ~= new ACSymbol("infinity", CompletionKind.keyword, s);
s.parts ~= new ACSymbol("init", CompletionKind.keyword, s); s.parts ~= new ACSymbol("init", CompletionKind.keyword, s);
s.parts ~= mangleof_; s.parts ~= mangleof_;

2
build.bat Normal file
View File

@ -0,0 +1,2 @@
dmd -wi client.d messages.d msgpack-d/src/msgpack.d -Imsgpack-d/src -ofdcd-client -L/exet:nt/su:windows:4.0
dmd -wi -g server.d modulecache.d actypes.d messages.d constants.d acvisitor.d autocomplete.d dscanner/stdx/d/ast.d dscanner/stdx/d/parser.d dscanner/stdx/d/lexer.d dscanner/stdx/d/entities.d msgpack-d/src/msgpack.d -Imsgpack-d/src -Idscanner/ -ofdcd-server

View File

@ -27,11 +27,48 @@ import std.algorithm;
import std.path; import std.path;
import std.file; import std.file;
import std.conv; import std.conv;
//version(Windows)
//{
// import core.runtime;
// import core.sys.windows.windows;
// import std.string;
//}
import msgpack; import msgpack;
import messages; import messages;
int main(string[] args) //version(Windows)
//{
// extern(Windows) int WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
// {
// int result;
// void exceptionHandler(Throwable e) {
// throw e;
// }
// try
// {
// Runtime.
// Runtime.initialize(&exceptionHandler);
// result = _main(["dcd-client"] ~ to!string(lpCmdLine).split(" ").array());
// Runtime.terminate(&exceptionHandler);
// }
// catch (Throwable e) // catch any uncaught exceptions
// {
// MessageBoxA(null, e.toString().toStringz(), "Error",
// MB_OK | MB_ICONEXCLAMATION);
// result = 0; // failed
// }
// return result;
// }
//}
//else
//{
// int main(string[] args)
// {
// return _main(args);
// }
//}
int /*_*/main(string[] args)
{ {
size_t cursorPos = size_t.max; size_t cursorPos = size_t.max;
string[] importPaths; string[] importPaths;
@ -104,7 +141,7 @@ int main(string[] args)
string fileName = usingStdin ? "stdin" : args[1]; string fileName = usingStdin ? "stdin" : args[1];
if (!usingStdin && !exists(args[1])) if (!usingStdin && !exists(args[1]))
{ {
stderr.writefln("%s does not exist"); stderr.writefln("%s does not exist", args[1]);
return 1; return 1;
} }
File f = usingStdin ? stdin : File(args[1]); File f = usingStdin ? stdin : File(args[1]);

View File

@ -111,7 +111,7 @@ function M.autocomplete(ch)
if buffer:get_lexer() ~= "dmd" then return end if buffer:get_lexer() ~= "dmd" then return end
local fileName = os.tmpname() local fileName = os.tmpname()
local command = M.PATH_TO_DCD_CLIENT .. " -c" .. buffer.current_pos .. " > " .. fileName local command = M.PATH_TO_DCD_CLIENT .. " -c" .. buffer.current_pos .. " > " .. fileName
local p = io.popen(command, "w") local p = io.popen(command, "wb")
p:write(buffer:get_text()) p:write(buffer:get_text())
p:flush() p:flush()
p:close() p:close()

View File

@ -34,11 +34,11 @@ import modulecache;
version(Posix) version(Posix)
{ {
enum CONFIG_FILE_PATH = "~/.config/dcd"; enum CONFIG_FILE_PATH = "~/.config/dcd";
} }
else version(Windows) else version(Windows)
{ {
enum CONFIG_FILE_PATH = "dcd.conf"; enum CONFIG_FILE_PATH = "dcd.conf";
} }
int main(string[] args) int main(string[] args)
@ -143,19 +143,20 @@ int main(string[] args)
string[] loadConfiguredImportDirs() string[] loadConfiguredImportDirs()
{ {
version(Windows) version(Windows)
{ {
string fullPath = buildPath(getcwd(), CONFIG_FILE_PATH); string fullPath = buildPath(getcwd(), CONFIG_FILE_PATH);
} }
else version(Posix) else version(Posix)
{ {
string fullPath = expandTilde(CONFIG_FILE_PATH); string fullPath = expandTilde(CONFIG_FILE_PATH);
} }
if (!exists(fullPath)) if (!exists(fullPath))
return []; return [];
File f = File(fullPath);
return f.byLine(KeepTerminator.no).map!(a => a.idup).filter!(a => a.exists()).array(); File f = File(fullPath, "rt");
return f.byLine(KeepTerminator.no).map!(a => a.idup).filter!(a => a.exists()).array();
} }
void printHelp(string programName) void printHelp(string programName)