Skip to content

Conversation

minestarks
Copy link
Member

@minestarks minestarks commented Aug 5, 2025

This pull request refactors the completion logic for imports and exports to be more robust and accurate.

The completion provider in the language service (global_items.rs) has been rewritten to leverage the GlobalScope and Locals structs already available from the resolver. This allows completions to use the same "view" as the name resolution code, rather than trying to recreate it by manually analyzing imports, enumerating items, etc. All of that work has already been done by the resolver.

The previous implementation for completions had difficulty handling more complex import and export scenarios, such as items re-exported from dependencies or items under aliased namespaces. This could lead to incomplete or incorrect suggestions. The new approach provides a more solid foundation, giving the language service a complete and accurate view of all available symbols.

Fixes #2142

@minestarks minestarks changed the base branch from main to minestarks/imports August 5, 2025 21:18
Base automatically changed from minestarks/imports to main August 7, 2025 20:55
@minestarks minestarks force-pushed the minestarks/completions-imports branch from 2eb1cc8 to 1a47bab Compare August 7, 2025 23:00
@minestarks minestarks marked this pull request as ready for review August 7, 2025 23:01
Copy link

github-actions bot commented Aug 7, 2025

Change in memory usage detected by benchmark.

Memory Report for 1bd3bb8

Test This Branch On Main Difference
compile core + standard lib 24664046 bytes 24532482 bytes 131564 bytes

@minestarks minestarks changed the title Fix completions for import and export statements Fix completions for import and exports Aug 7, 2025
Copy link

Change in memory usage detected by benchmark.

Memory Report for 7b4173c

Test This Branch On Main Difference
compile core + standard lib 24664046 bytes 24532482 bytes 131564 bytes

Copy link

Change in memory usage detected by benchmark.

Memory Report for f97474b

Test This Branch On Main Difference
compile core + standard lib 24664046 bytes 24532482 bytes 131564 bytes

Copy link

Change in memory usage detected by benchmark.

Memory Report for 1056998

Test This Branch On Main Difference
compile core + standard lib 24664046 bytes 24532482 bytes 131564 bytes

@minestarks minestarks added this pull request to the merge queue Aug 12, 2025
Merged via the queue into main with commit ba06f77 Aug 12, 2025
18 checks passed
@minestarks minestarks deleted the minestarks/completions-imports branch August 12, 2025 18:11
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.

Completion list is missing re-exports from dependencies
3 participants