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

Make it possible to show code hint and code completion at the same time #85436

Merged
merged 1 commit into from
Dec 19, 2023

Conversation

chocola-mint
Copy link
Contributor

@chocola-mint chocola-mint commented Nov 27, 2023

Fixes #85401

See below demo: (When code completion appears above, code hint is moved below, and vice versa. When there is no code completion, the value of code_hint_draw_below is used to determine where the code hint is)

godot_issue-85401-below.mp4
godot_issue-85401-above.mp4

@chocola-mint chocola-mint requested a review from a team as a code owner November 27, 2023 15:59
@KoBeWi KoBeWi added this to the 4.3 milestone Nov 27, 2023
@KoBeWi
Copy link
Member

KoBeWi commented Nov 27, 2023

I think it would be better if the code hint did not change position, but always appear at the opposite side from the completion popup. So it would be at the top by default.

@chocola-mint
Copy link
Contributor Author

The completion popup is contextual and doesn't necessarily appear where there is a code hint, so it's not a good idea to define code hint's position in terms of the completion popup's position.

If the code hint always appears at the top, then we may have to deprecate set_code_hint_draw_below, as it won't have any effect anymore. Fixing code hint's position also means the position of the code completion is fixed, and won't automatically reposition itself to stay on the screen. So instead, here's a different solution that is hopefully easier on the eyes:

In Visual Studio, the code hint is always placed above, while the code completion automatically repositions itself and may be placed between the edited line and the code hint:
image

Taking inspiration from Visual Studio, I've made it so the code completion can reposition itself below or above the code hint to fit inside the screen. set_code_hint_draw_below is still used to decide the code hint's position. See below.

godot_issue-85401-below-v2.mp4
godot_issue-85401-above-v2.mp4

@chocola-mint chocola-mint force-pushed the fix-#85401 branch 2 times, most recently from 27fa1d2 to e76a4c6 Compare November 28, 2023 08:08
Copy link
Member

@Paulb23 Paulb23 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the contribution!

scene/gui/code_edit.cpp Outdated Show resolved Hide resolved
scene/gui/code_edit.cpp Show resolved Hide resolved
scene/gui/code_edit.cpp Show resolved Hide resolved
scene/gui/code_edit.cpp Show resolved Hide resolved
scene/gui/code_edit.cpp Show resolved Hide resolved
scene/gui/code_edit.cpp Outdated Show resolved Hide resolved
Make code completion position more consistent

Add whitespace before if
@YuriSizov
Copy link
Contributor

Applied suggestions and rebased on your behalf.

@YuriSizov YuriSizov merged commit 7182c47 into godotengine:master Dec 19, 2023
15 checks passed
@YuriSizov
Copy link
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Argument autocompletion hides the argument list
5 participants