Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Unison.LSP.Queries
Description
Rewrites of some codebase queries, but which check the scratch file for info first.
Synopsis
- markdownDocsForFQN :: Lspish m => Uri -> HashQualified Name -> m [Text]
- getTypeOfReferent :: Lspish m => Uri -> Referent -> MaybeT m (Type Symbol Ann)
- getTypeDeclaration :: forall m. Lspish m => Uri -> Id -> MaybeT m (Decl Symbol Ann)
- refAtPosition :: forall m. Lspish m => Uri -> Position -> MaybeT m LabeledDependency
- nodeAtPosition :: Lspish m => Uri -> Position -> MaybeT m (SourceNode Ann)
- nodeAtPositionMatching :: Lspish m => Uri -> Position -> (SourceNode Ann -> MaybeT m a) -> MaybeT m a
- refInTerm :: Term v a -> Maybe LabeledDependency
- refInType :: Type v a -> Maybe TypeReference
- findSmallestEnclosingNode :: Pos -> Term Symbol Ann -> Maybe (SourceNode Ann)
- findSmallestEnclosingType :: Pos -> Type Symbol Ann -> Maybe (Type Symbol Ann)
- findSmallestEnclosingTypeMatching :: Alternative m => Pos -> (Type Symbol Ann -> m a) -> Type Symbol Ann -> m a
- findSmallestEnclosingNodeMatching :: forall m a. MonadPlus m => Pos -> (SourceNode Ann -> m a) -> Term Symbol Ann -> m a
- findSmallestEnclosingPattern :: Pos -> Pattern Ann -> Maybe (Pattern Ann)
- findSmallestEnclosingPatternMatching :: forall m a. Alternative m => Pos -> (Pattern Ann -> m a) -> Pattern Ann -> m a
- refInDecl :: Pos -> Decl Symbol Ann -> Maybe TypeReference
- data SourceNode a
Documentation
markdownDocsForFQN :: Lspish m => Uri -> HashQualified Name -> m [Text] Source #
Renders all docs for a given FQN to markdown.
getTypeOfReferent :: Lspish m => Uri -> Referent -> MaybeT m (Type Symbol Ann) Source #
Gets the type of a reference from either the parsed file or the codebase.
getTypeDeclaration :: forall m. Lspish m => Uri -> Id -> MaybeT m (Decl Symbol Ann) Source #
Gets a decl from either the parsed file or the codebase.
refAtPosition :: forall m. Lspish m => Uri -> Position -> MaybeT m LabeledDependency Source #
Returns a reference to whatever the symbol at the given position refers to.
nodeAtPosition :: Lspish m => Uri -> Position -> MaybeT m (SourceNode Ann) Source #
Returns the ABT node at the provided position. Does not return Decl nodes.
nodeAtPositionMatching :: Lspish m => Uri -> Position -> (SourceNode Ann -> MaybeT m a) -> MaybeT m a Source #
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.
findSmallestEnclosingTypeMatching :: Alternative m => Pos -> (Type Symbol Ann -> m a) -> Type Symbol Ann -> m a 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.
findSmallestEnclosingNodeMatching :: forall m a. MonadPlus m => Pos -> (SourceNode Ann -> m a) -> Term Symbol Ann -> m a Source #
Find the node in a term which contains the specified position, but none of its children contain that position
findSmallestEnclosingPatternMatching :: forall m a. Alternative m => Pos -> (Pattern Ann -> m a) -> Pattern Ann -> m a Source #
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
Functor SourceNode Source # | |
Defined in Unison.LSP.Queries Methods fmap :: (a -> b) -> SourceNode a -> SourceNode b # (<$) :: a -> SourceNode b -> SourceNode a # | |
Show (SourceNode a) Source # | |
Defined in Unison.LSP.Queries Methods showsPrec :: Int -> SourceNode a -> ShowS # show :: SourceNode a -> String # showList :: [SourceNode a] -> ShowS # | |
Eq a => Eq (SourceNode a) Source # | |
Defined in Unison.LSP.Queries |