Skip to content

Goto dependency - #4973

Open
vidit-od wants to merge 11 commits into
masterfrom
Goto-Dependency
Open

Goto dependency #4973
vidit-od wants to merge 11 commits into
masterfrom
Goto-Dependency

Conversation

@vidit-od

@vidit-od vidit-od commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

This PR contains work for Goto dependency definition, part of GSoC' 26.

Aims to extend support for Goto-dependency-definition feature for external dependencies.

what is Goto-dependency-definition ?

The ability to open and explore code from any third party source files in a single click.

Demo :
20260823-1817-32 5573033 (1)

How to trigger it ?

Hold Ctrl and click on any dependency function you want to explore.

Pre-requisite for this PR.

  • Triggering Goto opens the dependency file like any other file.
  • HLS then persieves these dependency files as other Project files and starts triggering all rules on it
  • This leads to immediate failures.
  • To prevent this, HLS must be taught how to distinguish between different file types and when to trigger what rule.
  • This is Done in Typed-Rules PR

How Goto Dependency Works

  • During startup, HLS indexes dependency .hie files and stores their definitions in HieDb.
  • When Goto Definition is triggered, HLS searches HieDb for the selected symbol.
  • If the dependency source is unavailable, HLS extracts it from the corresponding .hie file.
  • The extracted source is written under .hls/dependencies, and its path is updated in HieDb.
  • HLS returns the definition location, allowing the editor to open the dependency source file.

Credits :

Squashes the Typed-Rules development history.
Extracts Haskell source from HIE files of the third-party dependency and writes them to dependencies folder. also creates entry in hiedb pointing to this source. Mark these files as read-only. when goto dependency on third party is triggered, URI of these source is expected to be returned
Add dependency HIE indexing support for goto-definition.
Construct package-to-module mappings from direct and transitive dependencies and index their HIE files into HieDb.
Add cleanup for stale dependency source mappings and introduce HieFileCheck/checkHieFile for centralized HIE validation.
add support for indexing dependency HIE files in addition to project files. Allows indexing files without real source paths using FakeFile support.
makes sure that the Dependency file indexing logic actually triggers. also fixes cyclic dependencies by modularising HieFile related code to IDE.Core.HieFile
Added a new FromDependency file type and a ReadOnly rule type for files inside .hls/dependencies/ Files are now split into files (all files) and projectFiles (excluding read-only dependency files). GenerateCore and NonLocalCompletions now run only for project files, while GetHieAst runs for all files.
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.

1 participant