pub fn take_session_info(&mut self) -> Result<SessionInfo, LspSessionInfoError> {
        // Verify that we're dealing with an initialize request
        match self.0.get("method") {
            Some(value) if value == "initialize" => {}
            _ => return Err(LspSessionInfoError::NotInitializeRequest),
        }

        // Attempt to grab the distant initialization options
        match self.strip_session_params() {
            Some((Some(host), Some(port), Some(key))) => {
                let host = host
                    .as_str()
                    .ok_or(LspSessionInfoError::InvalidSessionInfoParams)?;
                let port = port
                    .as_u64()
                    .ok_or(LspSessionInfoError::InvalidSessionInfoParams)?;
                let key = key
                    .as_str()
                    .ok_or(LspSessionInfoError::InvalidSessionInfoParams)?;
                Ok(format!("DISTANT CONNECT {} {} {}", host, port, key).parse()?)
            }
            _ => Err(LspSessionInfoError::MissingSessionInfoParams),
        }
    }
/// Creates a session's info by inspecting the content for session parameters, removing the
/// session parameters from the content
Creates a session's info by inspecting the content for session parameters, removing the
session parameters from the content
Creates a session ' s info by inspecting the content for session parameters removing the session parameters from the content
pub fn take_session_info(&mut self) -> Result<SessionInfo, LspSessionInfoError> {
        // Verify that we're dealing with an initialize request
        match self.0.get("method") {
            Some(value) if value == "initialize" => {}
            _ => return Err(LspSessionInfoError::NotInitializeRequest),
        }
        // Attempt to grab the distant initialization options
        match self.strip_session_params() {
            Some((Some(host), Some(port), Some(key))) => {
                let host = host
                    .as_str()
                    .ok_or(LspSessionInfoError::InvalidSessionInfoParams)?;
                let port = port
                    .as_u64()
                    .ok_or(LspSessionInfoError::InvalidSessionInfoParams)?;
                let key = key
                    .as_str()
                    .ok_or(LspSessionInfoError::InvalidSessionInfoParams)?;
                Ok(format!("DISTANT CONNECT {} {} {}", host, port, key).parse()?)
            }
            _ => Err(LspSessionInfoError::MissingSessionInfoParams),
        }
    }
pub fn take_session_info ( & mut self ) -> Result < SessionInfo , LspSessionInfoError > { // Verify that we're dealing with an initialize request match self . 0 . get ( " " ) { Some ( value ) if value == " " => { } _ => return Err ( LspSessionInfoError :: NotInitializeRequest ) , } // Attempt to grab the distant initialization options match self . strip_session_params ( ) { Some ( ( Some ( host ) , Some ( port ) , Some ( key ) ) ) => { let host = host . as_str ( ) . ok_or ( LspSessionInfoError :: InvalidSessionInfoParams ) ? ; let port = port . as_u64 ( ) . ok_or ( LspSessionInfoError :: InvalidSessionInfoParams ) ? ; let key = key . as_str ( ) . ok_or ( LspSessionInfoError :: InvalidSessionInfoParams ) ? ; Ok ( format ! ( " " host port key ) . parse ( ) ? ) } _ => Err ( LspSessionInfoError :: MissingSessionInfoParams ) , } }
Creates a session's info by inspecting the content for session parameters, removing the
session parameters from the content
Creates a session ' s info by inspecting the content for session parameters removing the session parameters from the content
&mut self