Skip to content

[#1701] Fix searching of references in other files

Motivation and Context

Fixes a problem that references in included/imported files would not be found.

Related issues

Resolves #1701 (closed).

Checklist for the LIGO Language Server

  • I checked whether I need to update the README.md file for the plugin and did so if necessary:
    • If I implemented a new LSP request, I added it to the list of supported features that may be disabled
    • If I implemented a new LSP method, I added it to the list of supported functionality
  • I checked that my changes work in Emacs, Vim, and Visual Studio Code
  • (Before merging) The commit history is squashed and prettified, and follows the Serokell commit policy, or the MR is set to squash the commits

Description

The module would do an equality check in searched files that the reference matched the same URI as the opened file. Hence, it would only find only definitions if the file has been opened previously.

Note that the issue originally asked to fix the normalization of the file paths. This is not the case as the file paths are already normalized.

Component

  • compiler
  • website
  • webide
  • vscode-plugin
  • debugger

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Performance improvement (non-breaking change that improves performance)
  • None (change with no changelog)

Changelog

Fixed a bug where references would not be found sometimes in included/imported files. For example, suppose we have two contracts:

included.mligo:

let x = 1

includer/includer.mligo:

#include "../included.mligo"
let y = x

Then opening includer/includer.mligo and looking for references of x would only find it in this file unless included.mligo has been opened previously. It will now find it in both.

Note that this fix does not allow "back-includes" yet; looking for x in included.mligo will find it in includer/includer.mligo if and only if that file has been previously opened as well.

Checklist:

  • Changes follow the existing coding style (use dune @fmt to check).
  • Tests for the changes have been added (for bug fixes / feature).
  • Documentation has been updated.
  • Changelog description has been added (if appropriate).
  • Start titles under ## Changelog section with #### (if appropriate).
  • There is no image or uploaded file in changelog
  • Examples in changed behaviour have been added to the changelog (for breaking change / feature).
Edited by Laurent Canis

Merge request reports