Skip to content

Commit 9218161

Browse files
authored
Merge pull request #39 from Pure-D/workspaced-v3
Workspaced v3
2 parents a6a358e + 5261c46 commit 9218161

15 files changed

+939
-390
lines changed

dub.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"description": "Microsoft Language Server Protocol implementation using workspace-d",
44
"license": "MIT",
55
"dependencies": {
6-
"workspace-d": "~>2.12.0",
6+
"workspace-d": "~>3.1.0",
77
"eventsystem": "~>1.2.0",
88
"painlessjson": "~>1.3.8",
9-
"libddoc": "~>0.2.0",
9+
"libddoc": "~>0.3.0-beta.1",
1010
"rm-rf": "~>0.1.0"
1111
},
1212
"stringImportPaths": [

source/app.d

+12-11
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,13 @@ void processNotify(RequestMessage msg)
110110
served.extension.shutdown();
111111
return;
112112
}
113-
if (msg.method == "workspace/didChangeConfiguration")
113+
if (!initialized)
114114
{
115-
auto newConfig = msg.params["settings"].fromJSON!Configuration;
116-
served.extension.changedConfig(served.types.config.replace(newConfig));
115+
trace("Tried to call notification without initializing");
116+
return;
117117
}
118+
if (msg.method == "workspace/didChangeConfiguration")
119+
served.extension.processConfigChange(msg.params["settings"].fromJSON!Configuration);
118120
documents.process(msg);
119121
foreach (name; __traits(derivedMembers, served.extension))
120122
{
@@ -173,12 +175,16 @@ int main(string[] args)
173175
bool printVer;
174176
string[] features;
175177
string lang = "en";
178+
bool wait;
176179
//dfmt off
177180
auto argInfo = args.getopt(
178181
"r|require", "Adds a feature set that is required. Unknown feature sets will intentionally crash on startup", &features,
179182
"v|version", "Print version of program", &printVer,
180-
"lang", "Change the language of GUI messages", &lang);
183+
"lang", "Change the language of GUI messages", &lang,
184+
"wait", "Wait for a second before starting (for debugging)", &wait);
181185
//dfmt on
186+
if (wait)
187+
Thread.sleep(2.seconds);
182188
if (argInfo.helpWanted)
183189
{
184190
if (printVer)
@@ -199,8 +205,6 @@ int main(string[] args)
199205

200206
fibersMutex = new Mutex();
201207

202-
served.types.workspaceRoot = fs.getcwd();
203-
204208
foreach (feature; features)
205209
if (!IncludedFeatures.canFind(feature.toLower.strip))
206210
throw new Exception("Feature set '" ~ feature ~ "' not in this version of serve-d");
@@ -225,17 +229,15 @@ int main(string[] args)
225229
{
226230
while (rpc.hasData)
227231
{
228-
trace("Has Message");
229232
auto msg = rpc.poll;
230-
trace("Message: ", msg);
233+
// Log on client side instead! (vscode setting: "serve-d.trace.server": "verbose")
234+
//trace("Message: ", msg);
231235
if (msg.id.hasData)
232236
pushFiber({
233237
ResponseMessage res;
234238
try
235239
{
236-
trace("Processing as request");
237240
res = processRequest(msg);
238-
trace("Responding with: ", res);
239241
}
240242
catch (Throwable e)
241243
{
@@ -249,7 +251,6 @@ int main(string[] args)
249251
pushFiber({
250252
try
251253
{
252-
trace("Processing as notification");
253254
processNotify(msg);
254255
}
255256
catch (Throwable e)

source/served/ddoc.d

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ MarkedString[] ddocToMarked(string ddoc)
3737
string prepareDDoc(string str)
3838
{
3939
import ddoc.lexer;
40-
import ddoc.macros : tokOffset;
4140

4241
auto lex = Lexer(str, true);
4342
string output;

0 commit comments

Comments
 (0)