Skip to content

[#1698][#1674] Make LSP hovers prettier

Sorokin-Anton requested to merge Sorokin-Anton/#1698-pretty-hovers into dev

Motivation and Context

As in #1698 (closed), LSP hovers can be too big, or can even contain invalid code.

As in #1674 (closed) they could be prettier.

Related issues

Resolves #1698 (closed). Resolves #1674 (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
  • 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

  • Use e.g. x : int or type t = int instead of just int for hovers
  • Change the untyper so it could use var names to construct morec ompact types e.g. a -> b instead of (A of int) -> (B of bool) when type a = A of int and type b = B of bool
  • Send hovers in MarkedString, as described in modern LSP protocol docs
  • Improve the decompiler so it can create the Ast_unified.type_expression from ASt_core.type_expression even when the first expression contain quantifiers
  • Improve the decompiler for CameLIGO so the hover could be int -> int -> int instead of int -> (int -> int)

TODO: two hovers simultaneosly in case of orig_var like x : bool and type x = True | False Looks impossible to implement before #1943 is resolved and looks like go-to-type-definition is enough to understgand meaning of a type variable.

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

Improve the LSP hovers

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 Sorokin-Anton

Merge request reports

Loading