Nova can't parse LSP response

Hi again,

I just got an initial ruby-lsp LanguageClient working in my extension, however Nova terminates the LSP quickly during initial handshake because it data couldn’t be read because it isn’t in the correct format.

Here is what it looks like - maybe you can identify why it can’t process the response from it

(sorry for the verbose post, but I didn’t find a way to attach a text file to the post)

Ruby Language Server[22:14:12.088000] Initializing Ruby LSP v0.15.0...

Ruby Language Server[22:14:12.110000] Received JSON-RPC request: number(1) window/workDoneProgress/create
{
  "method" : "window\/workDoneProgress\/create",
  "jsonrpc" : "2.0",
  "params" : {
	"token" : "indexing-progress"
  },
  "id" : 1
}

Ruby Language Server[22:14:12.111000] Received JSON-RPC notification: $/progress
{
  "jsonrpc" : "2.0",
  "params" : {
	"token" : "indexing-progress",
	"value" : {
	  "title" : "Ruby LSP: indexing files",
	  "kind" : "begin",
	  "message" : "0% completed",
	  "percentage" : 0
	}
  },
  "method" : "$\/progress"
}

Ruby Language Server[22:14:12.122000] Received JSON-RPC response: number(0) initialize
{
  "id" : 0,
  "jsonrpc" : "2.0",
  "result" : {
	"capabilities" : {
	  "foldingRangeProvider" : {
		"lineFoldingOnly" : true
	  },
	  "semanticTokensProvider" : {
		"legend" : {
		  "tokenTypes" : [
			"namespace",
			"type",
			"class",
			"enum",
			"interface",
			"struct",
			"typeParameter",
			"parameter",
			"variable",
			"property",
			"enumMember",
			"event",
			"function",
			"method",
			"macro",
			"keyword",
			"modifier",
			"comment",
			"string",
			"number",
			"regexp",
			"operator",
			"decorator"
		  ],
		  "tokenModifiers" : [
			"declaration",
			"definition",
			"readonly",
			"static",
			"deprecated",
			"abstract",
			"async",
			"modification",
			"documentation",
			"default_library"
		  ]
		},
		"documentSelector" : {
		  "scheme" : "file",
		  "language" : "ruby"
		},
		"full" : {
		  "delta" : false
		},
		"range" : true
	  },
	  "documentLinkProvider" : {

	  },
	  "hoverProvider" : {

	  },
	  "documentSymbolProvider" : {
		"symbolKind" : {
		  "value_set" : [
			1,
			2,
			3,
			4,
			5,
			6,
			7,
			8,
			9,
			10,
			11,
			12,
			13,
			14,
			15,
			16,
			17,
			18,
			19,
			20,
			21,
			22,
			23,
			24,
			25,
			26
		  ]
		},
		"hierarchicalDocumentSymbolSupport" : true
	  },
	  "documentOnTypeFormattingProvider" : {
		"firstTriggerCharacter" : "{",
		"moreTriggerCharacter" : [
		  "\n",
		  "|",
		  "d"
		]
	  },
	  "codeActionProvider" : {
		"resolveProvider" : true
	  },
	  "diagnosticProvider" : {
		"interFileDependencies" : false,
		"workspaceDiagnostics" : false
	  },
	  "definitionProvider" : true,
	  "signatureHelpProvider" : {
		"triggerCharacters" : [
		  "(",
		  " ",
		  ","
		]
	  },
	  "completionProvider" : {
		"resolveProvider" : true,
		"completionItem" : {
		  "labelDetailsSupport" : true
		},
		"triggerCharacters" : [
		  "\/",
		  "\"",
		  "'"
		]
	  },
	  "documentFormattingProvider" : true,
	  "positionEncoding" : "utf-16",
	  "workspaceSymbolProvider" : true,
	  "textDocumentSync" : {
		"openClose" : true,
		"change" : 2
	  },
	  "selectionRangeProvider" : true,
	  "codeLensProvider" : {

	  },
	  "documentHighlightProvider" : true,
	  "inlayHintProvider" : {

	  }
	},
	"serverInfo" : {
	  "name" : "Ruby LSP",
	  "version" : "0.15.0"
	},
	"formatter" : "none"
  }
}

Ruby Language Server[22:14:12.122000] The data couldn’t be read because it isn’t in the correct format.

Ruby Language Server[22:14:12.122000] Ruby Language Server connection closed unexpectedly: typeMismatch(Swift.Array<Any>, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "result", intValue: nil), CodingKeys(stringValue: "capabilities", intValue: nil), CodingKeys(stringValue: "semanticTokensProvider", intValue: nil), CodingKeys(stringValue: "documentSelector", intValue: nil)], debugDescription: "Expected to decode Array<Any> but found a dictionary instead.", underlyingError: nil))

FYI - I’ve been able to track it down and it appears you’re right and the ruby-lsp is not sending a correct response as defined in the LSP spec.

I could fix it locally and hope they will fix it so I can publish the extension eventually.