@@ -516,9 +516,10 @@ async fn test_vscode_ide_websocket8() {
516516 & mut ws_ide,
517517 & EditorMessage {
518518 id : INITIAL_MESSAGE_ID + MESSAGE_ID_INCREMENT ,
519- message : EditorMessageContents :: Result ( Ok ( ResultOkTypes :: LoadFile ( Some (
519+ message : EditorMessageContents :: Result ( Ok ( ResultOkTypes :: LoadFile ( Some ( (
520520 "# testing" . to_string ( ) ,
521- ) ) ) ) ,
521+ 0.0 ,
522+ ) ) ) ) ) ,
522523 } ,
523524 )
524525 . await ;
@@ -547,6 +548,7 @@ async fn test_vscode_ide_websocket8() {
547548 contents: "<p>testing</p>\n " . to_string( )
548549 } ] ,
549550 } ) ,
551+ version: 0.0 ,
550552 } ) ,
551553 cursor_position: None ,
552554 scroll_position: None ,
@@ -648,6 +650,7 @@ async fn test_vscode_ide_websocket7() {
648650 doc : "# more" . to_string ( ) ,
649651 doc_blocks : vec ! [ ] ,
650652 } ) ,
653+ version : 0.0 ,
651654 } ) ,
652655 cursor_position : None ,
653656 scroll_position : None ,
@@ -674,7 +677,8 @@ async fn test_vscode_ide_websocket7() {
674677 delimiter: "#" . to_string( ) ,
675678 contents: "<p>more</p>\n " . to_string( )
676679 } ]
677- } )
680+ } ) ,
681+ version: 0.0 ,
678682 } ) ,
679683 cursor_position: None ,
680684 scroll_position: None ,
@@ -720,6 +724,7 @@ async fn test_vscode_ide_websocket7() {
720724 . to_string ( ) ,
721725 doc_blocks : vec ! [ ] ,
722726 } ) ,
727+ version : 1.0 ,
723728 } ) ,
724729 cursor_position : None ,
725730 scroll_position : None ,
@@ -749,8 +754,10 @@ async fn test_vscode_ide_websocket7() {
749754 indent: "" . to_string( ) ,
750755 delimiter: "#" . to_string( ) ,
751756 contents: "<p>most</p>\n " . to_string( )
752- } ) ]
757+ } ) ] ,
758+ version: 0.0 ,
753759 } ) ,
760+ version: 1.0 ,
754761 } ) ,
755762 cursor_position: None ,
756763 scroll_position: None ,
@@ -807,6 +814,7 @@ async fn test_vscode_ide_websocket6() {
807814 contents: "less\n " . to_string( ) ,
808815 } ] ,
809816 } ) ,
817+ version : 0.0 ,
810818 } ) ,
811819 cursor_position : None ,
812820 scroll_position : None ,
@@ -828,6 +836,7 @@ async fn test_vscode_ide_websocket6() {
828836 doc: "# less\n " . to_string( ) ,
829837 doc_blocks: vec![ ] ,
830838 } ) ,
839+ version: 0.0 ,
831840 } ) ,
832841 cursor_position: None ,
833842 scroll_position: None ,
@@ -946,8 +955,11 @@ async fn test_vscode_ide_websocket4() {
946955 // This should also produce an `Update` message sent from the Server.
947956 //
948957 // Message ids: IDE - 0, Server - 2->3, Client - 0.
958+ //
959+ // Since the version is randomly generated, copy that from the received message.
960+ let msg = read_message ( & mut ws_client) . await ;
949961 assert_eq ! (
950- read_message ( & mut ws_client ) . await ,
962+ msg ,
951963 EditorMessage {
952964 id: INITIAL_MESSAGE_ID + 2.0 * MESSAGE_ID_INCREMENT ,
953965 message: EditorMessageContents :: Update ( UpdateMessageContents {
@@ -966,6 +978,11 @@ async fn test_vscode_ide_websocket4() {
966978 contents: "<p>test.py</p>\n " . to_string( )
967979 } ] ,
968980 } ) ,
981+ version: cast!( & msg. message, EditorMessageContents :: Update )
982+ . contents
983+ . as_ref( )
984+ . unwrap( )
985+ . version,
969986 } ) ,
970987 cursor_position: None ,
971988 scroll_position: None ,
@@ -1025,6 +1042,8 @@ async fn test_vscode_ide_websocket4() {
10251042 . await ;
10261043 join_handle. join ( ) . unwrap ( ) ;
10271044
1045+ // What makes sense here? If the IDE didn't load the file, either the Client shouldn't edit it or the Client should switch to using a filewatcher for edits.
1046+ /*
10281047 // Send an update from the Client, which should produce a diff.
10291048 //
10301049 // Message ids: IDE - 0, Server - 4, Client - 0->1.
@@ -1048,6 +1067,7 @@ async fn test_vscode_ide_websocket4() {
10481067 contents: "<p>test.py</p>".to_string(),
10491068 }],
10501069 }),
1070+ version: 1.0,
10511071 }),
10521072 cursor_position: None,
10531073 scroll_position: None,
@@ -1072,7 +1092,9 @@ async fn test_vscode_ide_websocket4() {
10721092 insert: format!("More{}", if cfg!(windows) { "\r\n" } else { "\n" }),
10731093 }],
10741094 doc_blocks: vec![],
1095+ version: 0.0,
10751096 }),
1097+ version: 1.0,
10761098 }),
10771099 cursor_position: None,
10781100 scroll_position: None,
@@ -1094,6 +1116,7 @@ async fn test_vscode_ide_websocket4() {
10941116 message: EditorMessageContents::Result(Ok(ResultOkTypes::Void))
10951117 }
10961118 );
1119+ */
10971120
10981121 check_logger_errors ( 0 ) ;
10991122 // Report any errors produced when removing the temporary directory.
0 commit comments