Skip to content

Commit

Permalink
Merge pull request #39 from Pure-D/workspaced-v3
Browse files Browse the repository at this point in the history
Workspaced v3
  • Loading branch information
WebFreak001 authored Jul 5, 2018
2 parents a6a358e + 5261c46 commit 9218161
Show file tree
Hide file tree
Showing 15 changed files with 939 additions and 390 deletions.
4 changes: 2 additions & 2 deletions dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"description": "Microsoft Language Server Protocol implementation using workspace-d",
"license": "MIT",
"dependencies": {
"workspace-d": "~>2.12.0",
"workspace-d": "~>3.1.0",
"eventsystem": "~>1.2.0",
"painlessjson": "~>1.3.8",
"libddoc": "~>0.2.0",
"libddoc": "~>0.3.0-beta.1",
"rm-rf": "~>0.1.0"
},
"stringImportPaths": [
Expand Down
23 changes: 12 additions & 11 deletions source/app.d
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,13 @@ void processNotify(RequestMessage msg)
served.extension.shutdown();
return;
}
if (msg.method == "workspace/didChangeConfiguration")
if (!initialized)
{
auto newConfig = msg.params["settings"].fromJSON!Configuration;
served.extension.changedConfig(served.types.config.replace(newConfig));
trace("Tried to call notification without initializing");
return;
}
if (msg.method == "workspace/didChangeConfiguration")
served.extension.processConfigChange(msg.params["settings"].fromJSON!Configuration);
documents.process(msg);
foreach (name; __traits(derivedMembers, served.extension))
{
Expand Down Expand Up @@ -173,12 +175,16 @@ int main(string[] args)
bool printVer;
string[] features;
string lang = "en";
bool wait;
//dfmt off
auto argInfo = args.getopt(
"r|require", "Adds a feature set that is required. Unknown feature sets will intentionally crash on startup", &features,
"v|version", "Print version of program", &printVer,
"lang", "Change the language of GUI messages", &lang);
"lang", "Change the language of GUI messages", &lang,
"wait", "Wait for a second before starting (for debugging)", &wait);
//dfmt on
if (wait)
Thread.sleep(2.seconds);
if (argInfo.helpWanted)
{
if (printVer)
Expand All @@ -199,8 +205,6 @@ int main(string[] args)

fibersMutex = new Mutex();

served.types.workspaceRoot = fs.getcwd();

foreach (feature; features)
if (!IncludedFeatures.canFind(feature.toLower.strip))
throw new Exception("Feature set '" ~ feature ~ "' not in this version of serve-d");
Expand All @@ -225,17 +229,15 @@ int main(string[] args)
{
while (rpc.hasData)
{
trace("Has Message");
auto msg = rpc.poll;
trace("Message: ", msg);
// Log on client side instead! (vscode setting: "serve-d.trace.server": "verbose")
//trace("Message: ", msg);
if (msg.id.hasData)
pushFiber({
ResponseMessage res;
try
{
trace("Processing as request");
res = processRequest(msg);
trace("Responding with: ", res);
}
catch (Throwable e)
{
Expand All @@ -249,7 +251,6 @@ int main(string[] args)
pushFiber({
try
{
trace("Processing as notification");
processNotify(msg);
}
catch (Throwable e)
Expand Down
1 change: 0 additions & 1 deletion source/served/ddoc.d
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ MarkedString[] ddocToMarked(string ddoc)
string prepareDDoc(string str)
{
import ddoc.lexer;
import ddoc.macros : tokOffset;

auto lex = Lexer(str, true);
string output;
Expand Down
Loading

0 comments on commit 9218161

Please sign in to comment.