Hi,
I’m new to Nova extensions and Language Servers and I’m trying to add redhat-developer/yaml-language-server.
The Language server is quite similar to json-langauge-server which @apexskier has ported, but for yaml files instead. It lints yaml, validates against known json-scheams and has special support for Kubernetes resources.
I’ve got the server installed in my extension storage using apexskier/nova-extension-utils and have it starting up with a LanguageClient
instance.
I’m getting this error in the extension console after the server starts:
Error: Invalid parameter: registrations
Registrations must be of type Registration[]
After quite a bit of hackery, I’ve been debugging the JSON RPC messages to see what’s going on. I managed this by setting my LanguageClient
path to be my node.js path, then changing the args
to be ["--inspect-brk", languageServerPath, "--stdio"]
. So it starts the node process and immediately breakpoints until I connect a nodejs debugger (vs code ).
It seems to initialize fine and send up an initialized too. The server then requests a client/registerCapability with the payload below but the response is the error.
The client/registerCapability
:
{
"jsonrpc": "2.0",
"id": 0,
"method": "client/registerCapability",
"params": {
"registrations": [
{
"id": "69a84b93-43ca-46bf-b556-45ca3ac357ef",
"method": "workspace/didChangeWorkspaceFolders",
"registerOptions": {}
}
]
}
}
The response:
{
"jsonrpc": "2.0",
"id": 0,
"error": {
"message": "Invalid parameter: registrations\nRegistrations must be of type Registration[]",
"code": -32602
}
}
It logs that error to the Nova debug pane too, but the stack trace isn’t very useful
Is this capability not supported by Nova, is something else going on here or am I doing something horribly wrong?
Thanks for any help or advice,
Rob
Snippets
main.ts
// add '--inspect-brk=9231' as the first arg to debug on that port
const serverOptions: ServerOptions = {
type: "stdio",
path: nodePath,
args: ["--trace-warnings", serverPath, "--stdio"],
};
const settings = {
yaml: {
format: {
enable: true,
singleQuote: true,
},
validate: true,
hover: true,
completion: true,
schemas: {},
schemaStore: { enable: false },
},
};
const clientOptions: ClientOptions = {
syntaxes: ["yaml"],
initializationOptions: settings,
};
client = new LanguageClient(
"robb-j.yaml",
nova.extension.name,
serverOptions,
clientOptions
);
client.start();
Device Info:
- Nova 3.1 build 221256
- macOS 11.0.1 (20B29)