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

Ensure the rendered autocompletion is not empty (fixes #2003) #2007

Merged
merged 2 commits into from
Aug 8, 2024

Conversation

mkondratek
Copy link
Contributor

@mkondratek mkondratek commented Aug 7, 2024

Fixes CODY-3189

The check was originally there - we lost it at some point:
4f50796#diff-cb6c461805813f1dff589b6e691cded2a165241943810513c716325ad1fe25baR310

If the text to be rendered is empty let's skip the rendering.

Test plan

Hard to repro. Probably requires a python project.

@mkondratek mkondratek self-assigned this Aug 7, 2024
@@ -434,6 +434,7 @@ class CodyAutocompleteManager {
if (lines.size > 1) {
val text =
(if (startsInline) lines.drop(1) else lines).dropWhile { it.isBlank() }.joinToString("\n")
if (text.isEmpty()) return
Copy link
Contributor

@pkukielka pkukielka Aug 8, 2024

Choose a reason for hiding this comment

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

Shouldn't we also check for an empty line few line above?

completionText.lines().first(), items, editor, AutocompleteRendererType.INLINE)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe the previous place is already assured by the check before:

    if (completionText.trim().isBlank()) return

https://github.com/sourcegraph/jetbrains/pull/2007/files#diff-cb6c461805813f1dff589b6e691cded2a165241943810513c716325ad1fe25baR420

Copy link
Contributor Author

Choose a reason for hiding this comment

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

whoops, sorry - you are right - I fixed the remaining cases

Copy link
Contributor

@pkukielka pkukielka left a comment

Choose a reason for hiding this comment

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

LGTM

@mkondratek mkondratek enabled auto-merge (squash) August 8, 2024 09:44
@mkondratek mkondratek merged commit 0fe8183 into main Aug 8, 2024
6 of 7 checks passed
@mkondratek mkondratek deleted the mkondratek/fix/npe-from-ac-renderer branch August 8, 2024 09:48
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