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

Don't show undefined variable errors depending on context #548

Closed
fbricon opened this issue Feb 3, 2022 · 1 comment · Fixed by #619
Closed

Don't show undefined variable errors depending on context #548

fbricon opened this issue Feb 3, 2022 · 1 comment · Fixed by #619
Assignees
Labels
enhancement New feature or request qute
Milestone

Comments

@fbricon
Copy link
Collaborator

fbricon commented Feb 3, 2022

If a template checks a variable exists in a given context, eg. an if or for block, validation should know the variable exists and therefore should not complain about undefined variables.eg.

Screenshot 2022-02-03 at 10 11 37

@fbricon fbricon added enhancement New feature or request qute labels Feb 3, 2022
@angelozerr angelozerr modified the milestone: v0.11.0 Feb 3, 2022
@angelozerr angelozerr self-assigned this Feb 3, 2022
@angelozerr
Copy link
Contributor

To check if an object part is optional you can use ObjectPart#isOptional();

It's the first step to remove the error from name?? in #if

For the second error, {name}, the main idea is to store in a list all optional part in

private class ResolutionContext extends HashMap<String, ResolvedJavaTypeInfo> {

You will need to ad SectionKinf.IF in

return sectionKind == SectionKind.EACH || sectionKind == SectionKind.FOR || sectionKind == SectionKind.LET
to create an instance of ResolutionContext.

@angelozerr angelozerr assigned AlexXuChen and unassigned angelozerr Mar 24, 2022
angelozerr pushed a commit to angelozerr/quarkus-ls that referenced this issue Mar 28, 2022
angelozerr pushed a commit to angelozerr/quarkus-ls that referenced this issue Mar 28, 2022
angelozerr pushed a commit to angelozerr/quarkus-ls that referenced this issue Mar 30, 2022
angelozerr pushed a commit to angelozerr/quarkus-ls that referenced this issue Mar 30, 2022
angelozerr pushed a commit to angelozerr/quarkus-ls that referenced this issue Mar 30, 2022
angelozerr pushed a commit to angelozerr/quarkus-ls that referenced this issue Mar 30, 2022
angelozerr pushed a commit to angelozerr/quarkus-ls that referenced this issue Mar 30, 2022
angelozerr pushed a commit to angelozerr/quarkus-ls that referenced this issue Mar 30, 2022
angelozerr pushed a commit to angelozerr/quarkus-ls that referenced this issue Mar 31, 2022
angelozerr pushed a commit that referenced this issue Mar 31, 2022
Fixes #548

Signed-off-by: azerr <azerr@redhat.com>
@angelozerr angelozerr added this to the v0.12.0 milestone Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request qute
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants