pub fn on_text_document_sync_notification(
    files: &mut VirtualFileSystem,
    notification: &Notification,
) {
    match notification.method.as_str() {
        lsp_types::notification::DidOpenTextDocument::METHOD => {
            let parameters =
                serde_json::from_value::<DidOpenTextDocumentParams>(notification.params.clone())
                    .expect("could not deserialize notification");
            files.update(
                parameters.text_document.uri.path(),
                &parameters.text_document.text,
            );
        }
        lsp_types::notification::DidChangeTextDocument::METHOD => {
            let parameters =
                serde_json::from_value::<DidChangeTextDocumentParams>(notification.params.clone())
                    .expect("could not deserialize notification");
            files.update(
                parameters.text_document.uri.path(),
                &parameters.content_changes.last().unwrap().text,
            );
        }
        lsp_types::notification::DidSaveTextDocument::METHOD => {
            let parameters =
                serde_json::from_value::<DidSaveTextDocumentParams>(notification.params.clone())
                    .expect("could not deserialize notification");
            files.update(
                parameters.text_document.uri.path(),
                &parameters.text.unwrap(),
            );
        }
        lsp_types::notification::DidCloseTextDocument::METHOD => {
            let parameters =
                serde_json::from_value::<DidCloseTextDocumentParams>(notification.params.clone())
                    .expect("could not deserialize notification");
            files.remove(parameters.text_document.uri.path());
        }
        _ => panic!("invalid notification '{}'", notification.method),
    }
}
/// Updates the given virtual file system based on the text document sync notification that was sent.
Updates the given virtual file system based on the text document sync notification that was sent.
Updates the given virtual file system based on the text document sync notification that was sent .
pub fn on_text_document_sync_notification(
    files: &mut VirtualFileSystem,
    notification: &Notification,
) {
    match notification.method.as_str() {
        lsp_types::notification::DidOpenTextDocument::METHOD => {
            let parameters =
                serde_json::from_value::<DidOpenTextDocumentParams>(notification.params.clone())
                    .expect("could not deserialize notification");
            files.update(
                parameters.text_document.uri.path(),
                &parameters.text_document.text,
            );
        }
        lsp_types::notification::DidChangeTextDocument::METHOD => {
            let parameters =
                serde_json::from_value::<DidChangeTextDocumentParams>(notification.params.clone())
                    .expect("could not deserialize notification");
            files.update(
                parameters.text_document.uri.path(),
                &parameters.content_changes.last().unwrap().text,
            );
        }
        lsp_types::notification::DidSaveTextDocument::METHOD => {
            let parameters =
                serde_json::from_value::<DidSaveTextDocumentParams>(notification.params.clone())
                    .expect("could not deserialize notification");
            files.update(
                parameters.text_document.uri.path(),
                &parameters.text.unwrap(),
            );
        }
        lsp_types::notification::DidCloseTextDocument::METHOD => {
            let parameters =
                serde_json::from_value::<DidCloseTextDocumentParams>(notification.params.clone())
                    .expect("could not deserialize notification");
            files.remove(parameters.text_document.uri.path());
        }
        _ => panic!("invalid notification '{}'", notification.method),
    }
}
pub fn on_text_document_sync_notification ( files : & mut VirtualFileSystem , notification : & Notification , ) { match notification . method . as_str ( ) { lsp_types :: notification :: DidOpenTextDocument :: METHOD => { let parameters = serde_json :: from_value :: < DidOpenTextDocumentParams > ( notification . params . clone ( ) ) . expect ( " " ) ; files . update ( parameters . text_document . uri . path ( ) , & parameters . text_document . text , ) ; } lsp_types :: notification :: DidChangeTextDocument :: METHOD => { let parameters = serde_json :: from_value :: < DidChangeTextDocumentParams > ( notification . params . clone ( ) ) . expect ( " " ) ; files . update ( parameters . text_document . uri . path ( ) , & parameters . content_changes . last ( ) . unwrap ( ) . text , ) ; } lsp_types :: notification :: DidSaveTextDocument :: METHOD => { let parameters = serde_json :: from_value :: < DidSaveTextDocumentParams > ( notification . params . clone ( ) ) . expect ( " " ) ; files . update ( parameters . text_document . uri . path ( ) , & parameters . text . unwrap ( ) , ) ; } lsp_types :: notification :: DidCloseTextDocument :: METHOD => { let parameters = serde_json :: from_value :: < DidCloseTextDocumentParams > ( notification . params . clone ( ) ) . expect ( " " ) ; files . remove ( parameters . text_document . uri . path ( ) ) ; } _ => panic ! ( " " notification method ) , } }
Updates the given virtual file system based on the text document sync notification that was sent.
Updates the given virtual file system based on the text document sync notification that was sent .
files
&mut VirtualFileSystem
notification
&Notification