unison-cli-0.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Unison.LSP.Queries

Description

Rewrites of some codebase queries, but which check the scratch file for info first.

Synopsis

Documentation

markdownDocsForFQN :: Uri -> HashQualified Name -> Lsp [Text] Source #

Renders all docs for a given FQN to markdown.

getTypeOfReferent :: Uri -> Referent -> MaybeT Lsp (Type Symbol Ann) Source #

Gets the type of a reference from either the parsed file or the codebase.

getTypeDeclaration :: Uri -> Id -> MaybeT Lsp (Decl Symbol Ann) Source #

Gets a decl from either the parsed file or the codebase.

refAtPosition :: Uri -> Position -> MaybeT Lsp LabeledDependency Source #

Returns a reference to whatever the symbol at the given position refers to.

nodeAtPosition :: Uri -> Position -> MaybeT Lsp (SourceNode Ann) Source #

Returns the ABT node at the provided position. Does not return Decl nodes.

refInTerm :: Term v a -> Maybe LabeledDependency Source #

Returns the reference a given term node refers to, if any.

findSmallestEnclosingNode :: Pos -> Term Symbol Ann -> Maybe (SourceNode Ann) Source #

Find the node in a term which contains the specified position, but none of its children contain that position.

findSmallestEnclosingType :: Pos -> Type Symbol Ann -> Maybe (Type Symbol Ann) Source #

Find the node in a type which contains the specified position, but none of its children contain that position. This is helpful for finding the specific type reference of a given argument within a type arrow that a position references.

refInDecl :: Pos -> Decl Symbol Ann -> Maybe TypeReference Source #

Returns the type reference the given position applies to within a Decl, if any.

I.e. if the cursor is over a type reference within a constructor signature or ability request signature, that type reference will be returned.

data SourceNode a Source #

Instances

Instances details
Functor SourceNode Source # 
Instance details

Defined in Unison.LSP.Queries

Methods

fmap :: (a -> b) -> SourceNode a -> SourceNode b #

(<$) :: a -> SourceNode b -> SourceNode a #

Show (SourceNode a) Source # 
Instance details

Defined in Unison.LSP.Queries

Eq a => Eq (SourceNode a) Source # 
Instance details

Defined in Unison.LSP.Queries

Methods

(==) :: SourceNode a -> SourceNode a -> Bool #

(/=) :: SourceNode a -> SourceNode a -> Bool #