Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: close leaked contexts periodically #527

Merged
merged 1 commit into from
Nov 18, 2024

Conversation

apollo1321
Copy link
Contributor

Should fix this issue: #512 (comment)

@@ -69,6 +69,9 @@ end

---@param winid integer
local update_single_context = throttle_by_id(function(winid)
-- Remove leaked contexts firstly.
require('treesitter-context.render').close_leaked_contexts()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is pretty simple, I'm not sure if it worth creating separate throttler for closing leaked contexts.

@apollo1321 apollo1321 marked this pull request as draft November 17, 2024 17:16
@apollo1321 apollo1321 marked this pull request as ready for review November 17, 2024 17:29
@@ -386,6 +386,34 @@ end

local M = {}

-- Contexts may sometimes leak due to reasons like the use of 'noautocmd'.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we should be putting in provisions for handling noautocmd cases. If a bug is caused by noautocmd, then it means it was used incorrectly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly. However, I’m not sure how to reproduce this bug. satellite.nvim has similar protection, which might contribute to its reliability.
https://github.com/lewis6991/satellite.nvim/blob/main/lua/satellite/view.lua#L260

@lewis6991 lewis6991 merged commit 1147c42 into nvim-treesitter:master Nov 18, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants