Skip to content

Go-to-definition for types in hover #1117

@larsk21

Description

@larsk21

@Kha suggested exploring how go to definition could look like for a type shown in a hover. It seems the front end part of this feature would work quite well, with a few drawbacks.

  1. Markdown code blocks ( ```lean) do not support links, so we would need to switch to language independent HTML code blocks (<code>) for the type in the hover (not for the documentation with possible lean code examples).
  2. This would require enabling HTML in hovers in the client (with a limited set of allowed tags for security reasons), which is currently only support per MarkdownString, i.e. needs to be set for each incoming hover text. This is supposed to change with LSP 3.17 (see this issue).
  3. Although this works in VSCode and other Markdown renderers, I'm not sure if links (of the form []()) are always rendered as such inside HTML code blocks, which might be relevant for other editors or if a renderer is changed.
  4. HTML code blocks do not fill the hover completely and have a slightly darker background, which looks a bit weird.

The benefit, of course, is the possibility of jumping to the definition of a type appearing in the type of an expression in the code, which I find quite useful. What do you all think of it?

grafik

Metadata

Metadata

Assignees

No one assigned

    Labels

    P-mediumWe may work on this issue if we find the timeenhancementNew feature or requestnice to haveCool feature that would be really nice to haveserverAffects the Lean server code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions