Skip to content

Question: Why do certain API calls leave a [Scratch] buffer after they finish? #3045

@ngpong

Description

@ngpong
Contributor

Description

Hi there!

I’ve noticed that after calling certain APIs, such as full-name.lua and Api.node.show_info_popup, a [Scratch] buffer remains in the buffer list. When I open the buffer list using :ls!, I see many [Scratch] buffers, which makes me a bit confused.

I’ve found that some plugins (but not all) also use this approach, but I don’t fully understand the purpose behind it. At the same time, I’m somewhat concerned that if there are a large number of [Scratch] buffers, it might impact performance (though this is just my speculation, and I don’t have actual benchmark data to support it).

This question is more of a discussion threads, so if you don't think it's quite right, I can move it to the discussion area. In any case, have a great life and thanks to everyone in the community for their hard work!

Best wishes!

Activity

alex-courtis

alex-courtis commented on Jan 13, 2025

@alex-courtis
Member

Many thanks for raising this one - it is a bug and should be fixed.

It's a subset of scratch buffers that persist e.g. help buffer is wiped:

--- close the window and delete the buffer, if they exist

A pull request to fix this would be most gratefully appreciated, see CONTRIBUTING.md

added
PR pleasenvim-tree team does not have the bandwidth to implement; a PR will be gratefully appreciated
on Jan 13, 2025
ngpong

ngpong commented on Jan 13, 2025

@ngpong
ContributorAuthor

A pull request to fix this would be most gratefully appreciated

Absolutely sure 😊. It was a pleasure to work with you and I'll submit it later.

added a commit that references this issue on Jan 17, 2025
fca0b67
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    PR pleasenvim-tree team does not have the bandwidth to implement; a PR will be gratefully appreciatedbugSomething isn't workingreproducedIssue confirmed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @alex-courtis@ngpong

      Issue actions

        Question: Why do certain API calls leave a [Scratch] buffer after they finish? · Issue #3045 · nvim-tree/nvim-tree.lua