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

schema: Implement EmptyCompletionData for AnyExpression #246

Merged
merged 1 commit into from
Apr 6, 2023

Conversation

radeksimko
Copy link
Member

I'm not sure if this is the best solution, but it mostly mimics the existing behaviours of TraversalExpr (legacy Reference) and LiteralTypeExpr (legacy LiteralType).

That is, we produce pre-filling, when enabled:
2023-04-05 20 13 48

the (perhaps undesirable?) side effect though is that we also pre-fill on attribute completion:
2023-04-05 20 14 27

where it might be more appropriate to trigger completion and bring up functions/references:
2023-04-05 20 14 56


So one better solution I can think of would involve attaching another context value somewhere here

if attr.Constraint != nil {
cData := attr.Constraint.EmptyCompletionData(ctx, 1, 0)
snippet = fmt.Sprintf("%s = %s", name, cData.Snippet)
triggerSuggest = cData.TriggerSuggest
and add that to the condition, such that for LiteralType-like behaviour (pre-filling empty values) we not only expect the prefilling to be toggled on, but also to not be providing completion for an attribute.

@radeksimko radeksimko added the enhancement New feature or request label Apr 5, 2023
@radeksimko radeksimko self-assigned this Apr 5, 2023
@radeksimko radeksimko marked this pull request as ready for review April 5, 2023 19:20
@radeksimko radeksimko requested a review from a team as a code owner April 5, 2023 19:20
Copy link
Member

@dbanck dbanck left a comment

Choose a reason for hiding this comment

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

👍 I think mimicking the existing behavior is fine for now

@radeksimko radeksimko merged commit dff3d2c into main Apr 6, 2023
@radeksimko radeksimko deleted the f-any-expr-emptycompletiondata branch April 6, 2023 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants