Skip to content

[#1741] Set --project-root in files

Motivation and Context

Fix the language server showing file not found when importing packages downloaded from the LIGO registry.

Related issues

Resolves #1741 (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

gen_parser was changed so that it can accept a project root, and the preprocessor was fixed so that when using a raw input, it will properly set a file name for the lexbuf.

For now, the project root is set as the directory of the current file. This is not quite right, and it needs to be dealt with later when we have a project system.

textDocument/prepareRename should not allow renaming things from imported directories. There is currently no way to easily figure it out from scopes, so we use a heuristic: if the definition comes from a path that contains a directory called .ligo, we disallow renaming.

For tests, I committed bigarray to the repo. Unfortunately, I don't think there is a better way to do that right now while still keeping reproducibility.

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

When trying to import packages downloaded from the LIGO registry, the LSP would show that the file was not found. This behavior has been fixed.

Currently, the project root is set as the directory of the currently opened file. This will be resolved in a later issue.

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 Heitor Toledo Lassarote de Paula

Merge request reports