ghcide-2.7.0.0: The core of an IDE

Safe Haskell | None
Language | GHC2021

Development.IDE.Spans.Common

Synopsis

- unqualIEWrapName :: IEWrappedName GhcPs -> Text
- safeTyThingId :: TyThing -> Maybe Id
- safeTyThingType :: TyThing -> Maybe Type
- data SpanDoc
  - = SpanDocString [HsDocString] SpanDocUris
  - | SpanDocText [Text] SpanDocUris
- data SpanDocUris = SpanDocUris {
  - spanDocUriDoc :: Maybe Text
  - spanDocUriSrc :: Maybe Text
  }
- emptySpanDoc :: SpanDoc
- spanDocToMarkdown :: SpanDoc -> [Text]
- spanDocToMarkdownForTest :: String -> String
- type DocMap = NameEnv SpanDoc
- type TyThingMap = NameEnv TyThing

# Documentation

unqualIEWrapName :: IEWrappedName GhcPs -> Text #

Shows IEWrappedName, without any modifier, qualifier or unique identifier.

safeTyThingId :: TyThing -> Maybe Id #

safeTyThingType :: TyThing -> Maybe Type #

data SpanDoc #

Constructors

SpanDocString [HsDocString] SpanDocUris |
SpanDocText [Text] SpanDocUris |

#### Instances

Instances details

Generic SpanDoc # |

Instance details

Defined in Development.IDE.Spans.Common

Associated Types

type Rep SpanDoc |

Instance details

Defined in Development.IDE.Spans.Common

type Rep SpanDoc = D1 ('MetaData "SpanDoc" "Development.IDE.Spans.Common" "ghcide-2.7.0.0-4RFlm38cSV494413rRqzNs" 'False) (C1 ('MetaCons "SpanDocString" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [HsDocString]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SpanDocUris)) :+: C1 ('MetaCons "SpanDocText" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Text]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SpanDocUris)))

Methods

from :: SpanDoc -> Rep SpanDoc x #

to :: Rep SpanDoc x -> SpanDoc #

Show SpanDoc # |
Instance details Defined in Development.IDE.Spans.Common Methods showsPrec :: Int -> SpanDoc -> ShowS # show :: SpanDoc -> String # showList :: [SpanDoc] -> ShowS #
NFData SpanDoc # |
Instance details Defined in Development.IDE.Spans.Common Methods rnf :: SpanDoc -> () #
Eq SpanDoc # |
Instance details Defined in Development.IDE.Spans.Common Methods (==) :: SpanDoc -> SpanDoc -> Bool # (/=) :: SpanDoc -> SpanDoc -> Bool #
type Rep SpanDoc # |

Instance details

Defined in Development.IDE.Spans.Common

type Rep SpanDoc = D1 ('MetaData "SpanDoc" "Development.IDE.Spans.Common" "ghcide-2.7.0.0-4RFlm38cSV494413rRqzNs" 'False) (C1 ('MetaCons "SpanDocString" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [HsDocString]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SpanDocUris)) :+: C1 ('MetaCons "SpanDocText" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Text]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SpanDocUris)))

data SpanDocUris #

Constructors

SpanDocUris |

Fields

- spanDocUriDoc :: Maybe Text

  The haddock html page

- spanDocUriSrc :: Maybe Text

  The hyperlinked source html page

#### Instances

Instances details

Generic SpanDocUris # |

Instance details

Defined in Development.IDE.Spans.Common

Associated Types

type Rep SpanDocUris |

Instance details

Defined in Development.IDE.Spans.Common

type Rep SpanDocUris = D1 ('MetaData "SpanDocUris" "Development.IDE.Spans.Common" "ghcide-2.7.0.0-4RFlm38cSV494413rRqzNs" 'False) (C1 ('MetaCons "SpanDocUris" 'PrefixI 'True) (S1 ('MetaSel ('Just "spanDocUriDoc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "spanDocUriSrc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text))))

Methods

from :: SpanDocUris -> Rep SpanDocUris x #

to :: Rep SpanDocUris x -> SpanDocUris #

Show SpanDocUris # |
Instance details Defined in Development.IDE.Spans.Common Methods showsPrec :: Int -> SpanDocUris -> ShowS # show :: SpanDocUris -> String # showList :: [SpanDocUris] -> ShowS #
NFData SpanDocUris # |
Instance details Defined in Development.IDE.Spans.Common Methods rnf :: SpanDocUris -> () #
Eq SpanDocUris # |
Instance details Defined in Development.IDE.Spans.Common Methods (==) :: SpanDocUris -> SpanDocUris -> Bool # (/=) :: SpanDocUris -> SpanDocUris -> Bool #
type Rep SpanDocUris # |

Instance details

Defined in Development.IDE.Spans.Common

type Rep SpanDocUris = D1 ('MetaData "SpanDocUris" "Development.IDE.Spans.Common" "ghcide-2.7.0.0-4RFlm38cSV494413rRqzNs" 'False) (C1 ('MetaCons "SpanDocUris" 'PrefixI 'True) (S1 ('MetaSel ('Just "spanDocUriDoc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "spanDocUriSrc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text))))

emptySpanDoc :: SpanDoc #

spanDocToMarkdown :: SpanDoc -> [Text] #

Convert `SpanDoc` to Markdown format.

Return a list `Text` includes haddock, document uri and source code uri, each item can be empty and must end with '\n' if exist. This is to prevent subsequent render problem caused by the missing newline.

Example:

For return value ["xxxx","yyyy"], if we concat the list with inserting a separate line(note by "---n"), it will result "xxxx---nyyyy" and can't be rendered as a normal doc. Therefore we check every item in the value to make sure they all end with '\n', this makes "xxxxn---nyyyn" and can be rendered correctly.

Notes:

To insert a new line in Markdown, we need two '\n', like ("\n\n"), or a section symbol with one '\n', like ("***\n").

spanDocToMarkdownForTest :: String -> String #

type DocMap = NameEnv SpanDoc #

type TyThingMap = NameEnv TyThing #