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

Qute completion returns both fields and accessors #929

Open
fbricon opened this issue Sep 8, 2023 · 8 comments
Open

Qute completion returns both fields and accessors #929

fbricon opened this issue Sep 8, 2023 · 8 comments
Labels
completion enhancement New feature or request qute

Comments

@fbricon
Copy link
Collaborator

fbricon commented Sep 8, 2023

That looks awkward:

Screenshot 2023-09-08 at 15 19 54 Screenshot 2023-09-08 at 15 27 36

@mkouba @ia3andy @FroMage should completion show the accessors (e.g. defaultColumn() for a record, getName() for a class/interface)?

@fbricon fbricon added enhancement New feature or request completion qute labels Sep 8, 2023
@FroMage
Copy link

FroMage commented Sep 8, 2023

That's a question for @mkouba but I suspect that the .name form will actually invoke both .getName() or .name() if it exists, making the longer forms not useful to complete.

@mkouba
Copy link
Collaborator

mkouba commented Sep 8, 2023

So for accessor methods it's possible to use the method name or the property name. For example, if a class Foo declares a method X getName() then in a template you can use {foo.name}, {foo.getName} or even {foo.getName()}. For boolean isActive() it's active, isActive and isActive(). For boolean hasFriends() it's friends, hasFriends and hasFriends(). Ofc the last variant with brackets is useless.

should completion show the accessors (e.g. defaultColumn() for a record,

I would recommned not to show the defaultColumn() variant.

getName() for a class/interface?

The same probably applies here, name is enough.

@fbricon
Copy link
Collaborator Author

fbricon commented Sep 8, 2023

@mkouba thanks, that's what I thought. Validation will still accept all possible variants, but completion should be less bloated

@angelozerr
Copy link
Contributor

@fbricon I decided to show all possibilities in completion because when I read samples sometimes they were foo.name and sometimes foo.getName().

My idea was to provide a settings to show completion items .name or / and getName() or / and getName()

What do you think about that?

@FroMage
Copy link

FroMage commented Sep 12, 2023

Not sure I understand. But I agree the default should only show .name variants.

@angelozerr
Copy link
Contributor

Not sure I understand. But I agree the default should only show .name variants.

I mean have a settings which drives the completion result to show or not .name / .getName() / .getName. By default the settings will be configured to show only .name

@fbricon
Copy link
Collaborator Author

fbricon commented Sep 14, 2023

@angelozerr I think that'd bring unnecessary complexity. I'd rather wait for some user to complain and request it

@angelozerr
Copy link
Contributor

@angelozerr I think that'd bring unnecessary complexity. I'd rather wait for some user to complain and request it

Ok as it is just a filter matter, I think we could implement this setting internally and don't expose it to the user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
completion enhancement New feature or request qute
Projects
None yet
Development

No branches or pull requests

4 participants