@@ -339,28 +339,39 @@ void linting_lsp_server_handler::handle_text_document_did_change_notification(
339
339
return ;
340
340
}
341
341
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 ));
343
359
bool url_is_tracked = document_it != this ->documents_ .end ();
344
360
if (!url_is_tracked) {
345
361
return ;
346
362
}
347
363
document_base& doc = *document_it->second ;
348
364
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 );
350
366
if (document_path.empty ()) {
351
367
// TODO(strager): Report a warning and use a default configuration.
352
368
QLJS_UNIMPLEMENTED ();
353
369
}
354
370
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 ;
362
373
363
- doc.on_text_changed (*this , uri-> json );
374
+ doc.on_text_changed (*this , notification. uri . json );
364
375
}
365
376
366
377
void linting_lsp_server_handler::config_document::on_text_changed (
0 commit comments