-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
28 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,17 +14,20 @@ import core.thread; | |
import core.thread.fiber; | ||
|
||
import served.lsp.filereader; | ||
import served.lsp.jsonops; | ||
import served.lsp.jsonrpc; | ||
import served.lsp.protocol; | ||
import served.lsp.uri; | ||
import served.lsp.jsonops; | ||
|
||
version (assert) | ||
{ | ||
} | ||
else | ||
static assert(false, "Compile with asserts."); | ||
|
||
__gshared RPCProcessor rpc; | ||
__gshared string cwd; | ||
|
||
// https://forum.dlang.org/post/[email protected] | ||
void copyDir(string inDir, string outDir) | ||
{ | ||
|
@@ -88,6 +91,25 @@ void main() | |
return; | ||
} | ||
|
||
void delegate(RequestMessageRaw msg) gotRequest; | ||
void delegate(RequestMessageRaw msg) gotNotify; | ||
|
||
shared static this() | ||
{ | ||
gotRequest = toDelegate(&defaultRequestHandler); | ||
gotNotify = toDelegate(&defaultNotifyHandler); | ||
} | ||
|
||
void defaultRequestHandler(RequestMessageRaw msg) | ||
{ | ||
assert(false, "Unexpected request " ~ msg.toString); | ||
} | ||
|
||
void defaultNotifyHandler(RequestMessageRaw msg) | ||
{ | ||
info("Ignoring notification " ~ msg.toString); | ||
} | ||
|
||
void pumpEvents() | ||
{ | ||
while (rpc.hasData) | ||
|
@@ -105,13 +127,13 @@ void doTests() | |
WorkspaceClientCapabilities workspace = { | ||
configuration: opt(true) | ||
}; | ||
InitializeParams init = InitializeParams( | ||
processId: typeof(InitializeParams.processId)(thisProcessID), | ||
InitializeParams init = { | ||
processId: thisProcessID, | ||
rootUri: uriFromFile(cwd), | ||
capabilities: ClientCapabilities( | ||
capabilities: { | ||
workspace: opt(workspace) | ||
) | ||
); | ||
} | ||
}; | ||
auto msg = rpc.sendRequest("initialize", init, 10.seconds); | ||
info("Response: ", msg.resultJson); | ||
|
||
|
This file was deleted.
Oops, something went wrong.