kkharji/xbase

[nvim] build log correct height

github-actions opened this issue · 0 comments

https://github.com/tami5/xbase/blob/26ffb3291f3e6c005aede3c66a05d9c50fc7bc09/src/nvim/logger.rs#L60

        })
    }

    /// Consume bulid logs via logging them to client
    pub async fn consume_build_logs(
        &mut self,
        mut xclogger: XCLogger,
        clear: bool,
        open: bool,
    ) -> Result<bool> {
        let mut success = true;
        // TODO(nvim): close log buffer if it is open for new direction
        // Currently the buffer direction will be ignored if the buffer is opened already
        if clear {
            self.clear_content().await?;
        }

        // TODO(nvim): build log correct height
        if open {
            self.open_win().await?;
        }

        self.set_running(false).await?;

        while let Some(line) = xclogger.next().await {
            line.contains("FAILED").then(|| success = false);

            self.append(line.to_string()).await?;
        }

        self.set_status_end(success, open).await?;

        Ok(success)
    }

    // TODO(logger): always show current new logs in middle of the window
    pub async fn append(&mut self, msg: String) -> Result<()> {
        tracing::trace!("{msg}");