Skip to content

dhall-docs jump to definition of names introduced by Lam and Pi constructor #1978

Open
@german1608

Description

@german1608

I'd like to work on this, but currently the Lam and Pi constructor don't have the Src or SourcePos of the parsed label.

There are two ways to solve this:

  • Record the whitespace on Lam and Pi bindings similar to what we do on Binding. This will help in the context of dhall-format removes comments #145
    The new constructors would look roughly like this:
    data FunctionBinding = FunctionBinding {...}
    data Expr s a
        = ...
        | Lam (Maybe s, Text) (Expr s a) (Expr s a)
        | Pi (Maybe s, Text) (Expr s a) (Expr s a)
        ....
  • Use the parent Note Src of the Lam or Pi expression and run a parser to get the relative location of the label in the src and add it to the srcStart. This would only affect dhall-docs and it's somewhat similar to how dhall-lsp-server computes the source spans for source code messages.

What do you think is the best way to tackle this? cc: @sjakobi @Gabriel439 @Profpatsch

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions