Skip to content

Commit 2d7aab1

Browse files
committed
Add additional logs
1 parent 42cdfd3 commit 2d7aab1

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

.vscode/launch.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"name": "Launch Client",
99
"runtimeExecutable": "${execPath}",
1010
"args": [
11-
"--extensionDevelopmentPath=${workspaceRoot}"
11+
"--extensionDevelopmentPath=${workspaceRoot}",
12+
"--folder-uri=file:/Users/nojaf/Projects/daisy"
1213
],
1314
"outFiles": [
1415
"${workspaceRoot}/client/out/**/*.js"

server/src/server.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,18 @@ let codeActionsFromDiagnostics: codeActions.filesCodeActions = {};
6060
// will be properly defined later depending on the mode (stdio/node-rpc)
6161
let send: (msg: p.Message) => void = (_) => {};
6262

63+
let mediLog = (message: string) => {
64+
const notificationMessage: p.NotificationMessage = {
65+
method: p.LogMessageNotification.method,
66+
jsonrpc: c.jsonrpcVersion,
67+
params: {
68+
type: p.MessageType.Info,
69+
message,
70+
},
71+
};
72+
send(notificationMessage);
73+
};
74+
6375
let findRescriptBinary = async (projectRootPath: p.DocumentUri | null): Promise<string | null> => {
6476
if (config.extensionConfiguration.binaryPath != null &&
6577
fs.existsSync(path.join(config.extensionConfiguration.binaryPath, "rescript"))) {
@@ -1040,6 +1052,7 @@ async function onMessage(msg: p.Message) {
10401052
process.exit(1);
10411053
}
10421054
} else if (msg.method === InitializedNotification.method) {
1055+
mediLog("Got Client initialized");
10431056
/*
10441057
The initialized notification is sent from the client to the server after the client received the result of the initialize request
10451058
but before the client is sending any other request or notification to the server.
@@ -1084,6 +1097,9 @@ async function onMessage(msg: p.Message) {
10841097
send(req);
10851098
} else if (msg.method === DidChangeWatchedFilesNotification.method) {
10861099
const params = msg.params as p.DidChangeWatchedFilesParams;
1100+
params.changes.forEach((change) => {
1101+
mediLog(`File change: ${change.uri}`);
1102+
});
10871103
await onWorkspaceDidChangeWatchedFiles(params);
10881104
} else if (msg.method === DidOpenTextDocumentNotification.method) {
10891105
let params = msg.params as p.DidOpenTextDocumentParams;
@@ -1133,6 +1149,7 @@ async function onMessage(msg: p.Message) {
11331149
for (const workspaceFolder of initParams.workspaceFolders || []) {
11341150
const workspaceRootPath = fileURLToPath(workspaceFolder.uri);
11351151
workspaceFolders.add(workspaceRootPath);
1152+
mediLog(`Add workspace folder: ${workspaceRootPath}`);
11361153
}
11371154
let initialConfiguration = initParams.initializationOptions
11381155
?.extensionConfiguration as extensionConfiguration | undefined;

0 commit comments

Comments
 (0)