@@ -339,28 +339,39 @@ void linting_lsp_server_handler::handle_text_document_did_change_notification(
339339 return ;
340340 }
341341
342- auto document_it = this ->documents_ .find (string8 (uri->data ));
342+ ::simdjson::ondemand::array changes;
343+ if (!get_array (request, " params" , " contentChanges" , &changes)) {
344+ // Ignore invalid notification.
345+ return ;
346+ }
347+
348+ return this ->handle_text_document_did_change_notification (
349+ lsp_text_document_did_change_notification{
350+ .uri = *uri,
351+ .version_json = get_raw_json (version),
352+ .changes = changes,
353+ });
354+ }
355+
356+ void linting_lsp_server_handler::handle_text_document_did_change_notification (
357+ const lsp_text_document_did_change_notification& notification) {
358+ auto document_it = this ->documents_ .find (string8 (notification.uri .data ));
343359 bool url_is_tracked = document_it != this ->documents_ .end ();
344360 if (!url_is_tracked) {
345361 return ;
346362 }
347363 document_base& doc = *document_it->second ;
348364
349- std::string document_path = parse_file_from_lsp_uri (uri-> data );
365+ std::string document_path = parse_file_from_lsp_uri (notification. uri . data );
350366 if (document_path.empty ()) {
351367 // TODO(strager): Report a warning and use a default configuration.
352368 QLJS_UNIMPLEMENTED ();
353369 }
354370
355- ::simdjson::ondemand::array changes;
356- if (!get_array (request, " params" , " contentChanges" , &changes)) {
357- // Ignore invalid notification.
358- return ;
359- }
360- this ->apply_document_changes (doc.doc , changes);
361- doc.version_json = get_raw_json (version);
371+ this ->apply_document_changes (doc.doc , notification.changes );
372+ doc.version_json = notification.version_json ;
362373
363- doc.on_text_changed (*this , uri-> json );
374+ doc.on_text_changed (*this , notification. uri . json );
364375}
365376
366377void linting_lsp_server_handler::config_document::on_text_changed (
0 commit comments