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

Base "generate missing member" CodeActions on if the type is a source or binary file #676

Closed
datho7561 opened this issue Jul 27, 2022 · 1 comment · Fixed by #686
Closed
Assignees
Labels
Milestone

Comments

@datho7561
Copy link
Contributor

The "add field" and "add getter" code actions for missing members in Qute templates should not appear if the Java type is a binary, since the source for the class can't be modified.

The "add to existing template extensions" and "add to new template extensions" code actions for missing members in Qute templates should not appear if the Java type is a source file, since it makes more sense to add it as a field or getter to the source file.

If we know if the type is a source file or a binary file before we generate the text edits associated with the code action, we can generate only the code actions that are needed.

See #671 (comment)

@datho7561 datho7561 added enhancement New feature or request code action qute labels Jul 27, 2022
@angelozerr
Copy link
Contributor

To support that I suggest that you add in https://github.com/redhat-developer/quarkus-ls/blob/8a52980f2a999e80a0367f301f8962dfaf4f84b7/qute.jdt/com.redhat.qute.jdt/src/main/java/com/redhat/qute/commons/ResolvedJavaTypeInfo.java

private Boolean source;

...

public boolean isSource() {
    return source != null && source.booleanValue();
}

like isTerable:

datho7561 added a commit to datho7561/quarkus-ls that referenced this issue Jul 28, 2022
When generating CodeActions for missing properties that are referenced
in a Qute template, don't suggest adding a field or adding a getter when
the type that is being referred to is a binary type (i.e. built-in class
or class from an external library).

Fixes redhat-developer#676

Signed-off-by: David Thompson <davthomp@redhat.com>
datho7561 added a commit to datho7561/quarkus-ls that referenced this issue Jul 28, 2022
When generating CodeActions for missing properties that are referenced
in a Qute template, don't suggest adding a field or adding a getter when
the type that is being referred to is a binary type (i.e. built-in class
or class from an external library).

Fixes redhat-developer#676

Signed-off-by: David Thompson <davthomp@redhat.com>
@datho7561 datho7561 self-assigned this Jul 28, 2022
@datho7561 datho7561 added this to the 0.13.0 milestone Jul 28, 2022
datho7561 added a commit to datho7561/quarkus-ls that referenced this issue Jul 29, 2022
When generating CodeActions for missing properties that are referenced
in a Qute template, don't suggest adding a field or adding a getter when
the type that is being referred to is a binary type (i.e. built-in class
or class from an external library).

Fixes redhat-developer#676

Signed-off-by: David Thompson <davthomp@redhat.com>
angelozerr pushed a commit that referenced this issue Jul 29, 2022
When generating CodeActions for missing properties that are referenced
in a Qute template, don't suggest adding a field or adding a getter when
the type that is being referred to is a binary type (i.e. built-in class
or class from an external library).

Fixes #676

Signed-off-by: David Thompson <davthomp@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants