Skip to content

[#1694] Disallow looking for defs from stdlib in rename/definition/type

Motivation and Context

Prevent users from trying to rename things in the stdlib, or trying to open the stdlib (which should not be available in the user's PC).

Related issues

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

If we find that some file is "", we return None in the requests for definition, type definition, and prepare rename. This disallows renaming and trying to open this empty file.

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

The LSP previously allowed the users to try to see the definition of things defined in the stdlib. However, the stdlib is not available on the user's computer, so there is nothing to show.

To make things worse, the user could try to rename stdlib definitions and the LSP would try (but only rename local usages, not the definition).

For now, these operations are disallowed.

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