LanguageClient onRequest isn't being called

I’ve been trying to hook up two custom LSP requests for nova-yaml for requesting json schemas and providing custom schema associations to files. In the documentation for LanguageServer#onRequest it states that you can use this for non-core LSP messages, but my code isn’t being called:

const client = new LanguagaeClient(/* ...*/)

client.onRequest("custom/schema/request", async (file) => {
  console.log("custom/schema/request " + file)
  return []
})

client.start()

client.sendNotification("yaml/registerCustomSchemaRequest")

From debugging the server I can see it is receiving the notification and when the server requests a schema it is sending the request to Nova:

{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "custom/schema/request",
  "params": [
    "file:///Volumes/Macintosh%20HD/Users/rob/dev/nova/yaml/examples/kustomization.yml"
  ]
}

But the callback isn’t getting executed, I see no response to the request from Nova and there aren’t any errors in the debug console.

I’ve never gotten the onRequest or onNotification apis to work, myself.

Has anyone else managed to get these working?

I saw recently that Nova fixed a bug with LanguageClient to allow extensions to implement custom LSP requests. I can now see that my code inside of the handler for onRequest is being called but it seems that what I return does not get sent in the request’s response.

My code

I can see my debug statements being called in the extension console, but it seems to always pass null back in the response?

client.onRequest("custom/schema/request", ([uri]: [string]) => {
  debug("custom/schema/request", uri);
  const editor = nova.workspace.textEditors.find(
    (e) => e.document.uri === uri
  );
  if (!editor) return [];

  const text = editor.document.getTextInRange(
    new Range(0, editor.document.length)
  );

  const apiVersion = /^apiVersion: +(\S+)$/m.exec(text);
  const kind = /^kind: +(\S+)$/m.exec(text);

  if (!apiVersion || !kind) return [];

  debug("custom/schema/request", [apiVersion[1], kind[1]]);
  return [{ uri: "kubernetes", name: kind[1], description: apiVersion[1] }];
});

client.start();

client.sendNotification("yaml/registerCustomSchemaRequest");

The request

{"jsonrpc":"2.0","id":1,"method":"custom/schema/request","params":["file:///Users/rob/dev/nova/yaml/examples/ingress.yml"]}

The response

{"jsonrpc":"2.0","method":"yaml\/registerCustomSchemaRequest","params":null}Content-Length: 38

{"jsonrpc":"2.0","id":2,"result":null}

Also, should the ids match up?

Hmm. This is odd. I will investigate!