-
Notifications
You must be signed in to change notification settings - Fork 212
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: avoid propagating empty context_lines #433
Conversation
@@ -106,7 +106,10 @@ local update = throttle(function() | |||
return | |||
end | |||
|
|||
assert(context_lines) | |||
if not context_lines or #context_lines == 0 then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The block above should catch this. context_lines
should be nil
is context
is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get this response from get_context
as an example:
context_ranges: { { 74, 0, 73, -1 } }
context_lines: { {} }
context_lines (flatten): {}
After investigating a bit it seems that the trim_contexts
is the problem:
print(vim.inspect(context_ranges), vim.inspect(context_lines))
trim_contexts(context_ranges, context_lines, trim, config.trim_scope == 'outer')
print(vim.inspect(context_ranges), vim.inspect(context_lines))
---
{ { 62, 0, 62, -1 }, { 64, 0, 64, -1 }, { 74, 0, 73, -1 } } | { { "impl TaskManager {" }, { " pub fn new(" }, {} }
-> trim
{ { 74, 0, 73, -1 } } { {} }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lewis6991 After some tests I think that the problem rely in the cleaning of the contexts
Hey @lewis6991 ! Any chance to make this problem fix in some way? It is pretty annoying on a daily basis ahah. |
Signed-off-by: Simon Paitrault <simon.paitrault@gmail.com>
I've done some changes recently is this still an issue? If so do you have a way to reproduce the problem? |
@lewis6991 I'll update and let you know if I encounter the issue again, thanks ! |
I'll assume this isn't an issue any more. Let me know if it is. |
Description
This PR fixes an issue where sometime the
ctx_lines
used to define theheight
were empty, triggering an error about invalid height:The fix is checking if the
context_lines
are not empty, if it is, theclose
method is called.PR Checklist: