Skip to content

update from main#8

Merged
Turupawn merged 434 commits intoTurupawn:masterfrom
argotorg:master
Dec 9, 2025
Merged

update from main#8
Turupawn merged 434 commits intoTurupawn:masterfrom
argotorg:master

Conversation

@Turupawn
Copy link
Owner

@Turupawn Turupawn commented Dec 9, 2025

No description provided.

sbillig and others added 30 commits September 10, 2025 07:53
Improve diagnostics for qualified path errors
Co-authored-by: Grant  Wuerker <grantwuerker@pop-os.localdomain>
Add support for associated consts
micahscopes and others added 29 commits December 7, 2025 21:49
Local variables and parameters should shadow module-level items with
the same name. Modified PathView::target() and target_at() to check
local bindings first before falling back to module-level resolution.

Updated test snapshots to reflect correct behavior where parameters
and local bindings now resolve as locals instead of incorrectly
resolving to module paths or value references.

Added locals.fe test case to verify local shadowing works correctly,
including parameter shadowing by let bindings.
When renaming Bar in Foo::Bar, the entire path was being replaced
with just the new name instead of producing Foo::Baz.

Added PathView::last_segment_span() to get only the identifier span
of the last segment. Added ReferenceView::rename_span() that delegates
to last_segment_span for paths while returning normal spans for other
reference types. Updated rename handler to use rename_span() instead
of span() for text edits.

This preserves goto-definition behavior (which needs full path spans
to detect intermediate segment clicks) while fixing rename to only
replace the actual referenced item.
Added goto_path_segments.fe to verify all intermediate path segments
are resolvable for goto-definition (e.g. clicking on 'stuff' in
'stuff::calculations::ambiguous' resolves correctly).

Added goto_where_clause.fe to verify trait bounds in where clauses
are resolvable (e.g. clicking on 'MyTrait' in 'where T: MyTrait'
resolves to the trait definition).

Both tests cover inline module resolution. Cross-ingot resolution
is blocked pending PR #1146 which adds ingot initialization when
opening .fe files.
When use statements with braces like `use foo::{ bar, baz }` are
decomposed into separate Use HIR items, they share identical item spans
pointing to the original source. This caused find_enclosing_item to
return only the first matching use, breaking goto for subsequent items.

Changed find_enclosing_item to find_enclosing_items (returning all
items with the smallest span) and reference_at now tries each candidate
until finding one whose references match the cursor position.

This handles decomposed uses naturally without special-casing.
Scope graphs don't include edges to child file modules, only to items
declared in the file itself. This caused use statements like `use stuff::`
to fail when `stuff` is a child file module (stuff.fe).

Added fallback in UsePathView::target to check the module tree for child
file modules when normal name resolution fails. This allows resolving the
first segment of use paths to child file modules.
Extended the semantic traversal API to handle ambiguous references where
a path can resolve to multiple items (e.g., both a module and function
with the same name).

API design:
- target() / target_at() - returns first/best match (existing behavior)
- target_candidates() / target_candidates_at() - returns all candidates

This provides a coherent API where:
- Simple cases use the singular methods
- Ambiguous resolution uses the plural methods
- LSP handlers can return arrays for multiple goto targets
- All ambiguity handling is encapsulated in the HIR semantic layer

The goto handler now returns GotoDefinitionResponse::Array when multiple
targets exist, allowing editors to present all options to the user.
When navigating to TopLevelMod (file modules), we were incorrectly using
file.path(db) which returns a relative path, then formatting it as a file://
URL. This created invalid URLs like 'file://src/stuff.fe' instead of valid
absolute file:// URLs.

Fixed by using file.url(db) which returns the proper absolute file:// URL.

This fixes goto-definition not working when clicking on root path segments
that resolve to file modules (e.g., clicking 'stuff' in 'use stuff::calculations').

crates/language-server/src/util.rs:66
- Fix UsePathView to start resolution from the use item's scope instead of
  its parent scope. This fixes resolution of file module references in use paths.

- Add UsePathView::target_at for cursor-aware segment resolution in use paths

- Update ReferenceView::target_at to delegate to UsePathView::target_at for use paths

- Improve hover display for ambiguous references:
  - Change header from 'Ambiguous reference' to 'Multiple definitions'
  - Remove candidate numbering for cleaner display
  - Add horizontal rules between candidates
  - Include docstrings for all candidates

- Remove duplicate goto_path_segments test (covered by goto_ambiguous)

crates/hir/src/core/semantic/reference/mod.rs:372
crates/hir/src/core/semantic/reference/mod.rs:420
crates/hir/src/core/semantic/reference/mod.rs:498
crates/language-server/src/functionality/hover.rs:39
Improved reference <> definition support
@Turupawn Turupawn merged commit 0df8d04 into Turupawn:master Dec 9, 2025
4 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.

5 participants