Skip to content

ide+jakttest: Fix hover mislabeling#1619

Merged
alimpfard merged 3 commits into
SerenityOS:mainfrom
cg-jl:ext-fixups-pr
Jul 29, 2025
Merged

ide+jakttest: Fix hover mislabeling#1619
alimpfard merged 3 commits into
SerenityOS:mainfrom
cg-jl:ext-fixups-pr

Conversation

@cg-jl

@cg-jl cg-jl commented Jul 26, 2025

Copy link
Copy Markdown
Contributor

Fixing a couple of bugs I'm seeing while using the extension. These ones are on hover:

  • Loop variable: hover resolves to something related to the range expression.

Before:

loop-var-bad

After:

loop-var-good

Images are from typechecker::typecheck_inline_cpp.

  • Loop variables when range comes from tuple destructuring in outer loop.
    Before:
loop variable from outer loop

After:

loop variable from outer loop, fixed

codegen::codegen_struct

  • Tuple destructure: it's resolving the internal VarDecl with the joined names.
    Before:
loop variable from destructuring, fixed

After:

image

codegen::codegen_enum

  • parameters in is expression are also resolved to the temporaries created within.
    Maybe we want to flag variables as 'autogenerated'?

Before:

temporaries in `is` expr

After:

temporaries in `is` expr, fixed

codegen::codegen_enum_destroy_variant


I guess I could use this opportunity to setup testing. It can be done with shell + jq & get more complex as we need it.

@cg-jl
cg-jl force-pushed the ext-fixups-pr branch 2 times, most recently from c753f06 to 349a629 Compare July 26, 2025 21:18
Comment thread selfhost/typechecker.jakt
} else {
resolved_iterable_result_type = iterable_trait_implementation!.implemented_type_args[0]
}

@cg-jl cg-jl Jul 26, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

diff got messy here. I:

  • removed the comments above the rewrite
  • turned rewritten statement from ParsedStatement::Block into ParsedBlock, so that it can be tagged as coming from for loop typecheck.
  • patched a couple of spans so that ide resolves correctly.

@cg-jl
cg-jl force-pushed the ext-fixups-pr branch 5 times, most recently from aaa473a to 6b2b2ec Compare July 27, 2025 19:04
@cg-jl cg-jl changed the title (draft) ide: Hover-related issues (draft) ide+jakttest: Hover-related issues Jul 27, 2025
@cg-jl cg-jl changed the title (draft) ide+jakttest: Hover-related issues ide+jakttest: Fix hover mislabeling Jul 27, 2025
@cg-jl
cg-jl marked this pull request as ready for review July 27, 2025 20:07
@cg-jl
cg-jl force-pushed the ext-fixups-pr branch 2 times, most recently from 7c97c7d to ac70f66 Compare July 27, 2025 20:13

@alimpfard alimpfard left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

mostly lgtm, just a couple nits:

Comment thread selfhost/typechecker.jakt Outdated
Comment thread selfhost/types.jakt Outdated
cg-jl added 3 commits July 28, 2025 18:12
Previously it would point to something in the range expression (`in
<expr>`)
This lets typechecker mark variables as invisible to IDE, e.g for
variables that were generated through desugaring.

Solves issues regarding hover for bindings declared in `is` and through
tuple destructuring.
This lets us declare tests for hover results.
@alimpfard
alimpfard merged commit 87c1c94 into SerenityOS:main Jul 29, 2025
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants