ghcide-2.9.0.0: The core of an IDE

Safe Haskell | None
Language | GHC2021

Development.IDE.Plugin.Completions.Types

Synopsis

- data CompItem = CI {
  - compKind :: CompletionItemKind
  - insertText :: Text
  - provenance :: Provenance
  - label :: Text
  - typeText :: Maybe Text
  - isInfix :: Maybe Backtick
  - isTypeCompl :: Bool
  - additionalTextEdits :: Maybe ExtendImport
  - nameDetails :: Maybe NameDetails
  - isLocalCompletion :: Bool
  }
- data CompletionsConfig = CompletionsConfig {
  - enableSnippets :: Bool
  - enableAutoExtend :: Bool
  - maxCompletions :: Int
  }
- data CachedCompletions = CC {
  - allModNamesAsNS :: [Text]
  - unqualCompls :: [CompItem]
  - qualCompls :: QualCompls
  - anyQualCompls :: [Maybe Text -> CompItem]
  - importableModules :: [Text]
  }
- data ExtendImport = ExtendImport {
  - doc :: !Uri
  - newThing :: !Text
  - thingParent :: !(Maybe Text)
  - importName :: !Text
  - importQual :: !(Maybe Text)
  }
- properties :: Properties '['PropertyKey "autoExtendOn" 'TBoolean, 'PropertyKey "snippetsOn" 'TBoolean]
- data LocalCompletions = LocalCompletions
- data NonLocalCompletions = NonLocalCompletions
- data Backtick
  - = Surrounded
  - | LeftSide
- extendImportCommandId :: Text
- data Provenance
  - = ImportedFrom Text
  - | DefinedIn Text
  - | Local SrcSpan
- data NameDetails = NameDetails Module OccName
- newtype QualCompls = QualCompls {
  - getQualCompls :: Map Text [CompItem]
  }
- data PosPrefixInfo = PosPrefixInfo {
  - fullLine :: !Text
  - prefixScope :: !Text
  - prefixText :: !Text
  - cursorPos :: !Position
  }
- nsJSON :: NameSpace -> Value
- parseNs :: Value -> Parser NameSpace
- data CompletionResolveData = CompletionResolveData {
  - itemFile :: Uri
  - itemNeedsType :: Bool
  - itemName :: NameDetails
  }

# Documentation

data CompItem #

Constructors

CI |
Fields compKind :: CompletionItemKind insertText :: Text Snippet for the completion provenance :: Provenance From where this item is imported from. label :: Text Label to display to the user. typeText :: Maybe Text isInfix :: Maybe Backtick Did the completion happen in the context of an infix notation. isTypeCompl :: Bool additionalTextEdits :: Maybe ExtendImport nameDetails :: Maybe NameDetails For resolving purposes isLocalCompletion :: Bool Is it from this module?

#### Instances

Instances details

Show CompItem # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods showsPrec :: Int -> CompItem -> ShowS # show :: CompItem -> String # showList :: [CompItem] -> ShowS #
Eq CompItem # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods (==) :: CompItem -> CompItem -> Bool # (/=) :: CompItem -> CompItem -> Bool #

data CompletionsConfig #

Constructors

CompletionsConfig |
Fields enableSnippets :: Bool enableAutoExtend :: Bool maxCompletions :: Int

data CachedCompletions #

End result of the completions

Constructors

CC |
Fields allModNamesAsNS :: [Text] All module names in scope. Prelude is a single module unqualCompls :: [CompItem] Unqualified completion items qualCompls :: QualCompls Completion items associated to to a specific module name. anyQualCompls :: [Maybe Text -> CompItem] Items associated to any qualifier importableModules :: [Text] All modules that may be imported.

#### Instances

Instances details

NFData CachedCompletions # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods rnf :: CachedCompletions -> () #
Monoid CachedCompletions # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods mempty :: CachedCompletions # mappend :: CachedCompletions -> CachedCompletions -> CachedCompletions # mconcat :: [CachedCompletions] -> CachedCompletions #
Semigroup CachedCompletions # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods (<>) :: CachedCompletions -> CachedCompletions -> CachedCompletions # sconcat :: NonEmpty CachedCompletions -> CachedCompletions # stimes :: Integral b => b -> CachedCompletions -> CachedCompletions #
Show CachedCompletions # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods showsPrec :: Int -> CachedCompletions -> ShowS # show :: CachedCompletions -> String # showList :: [CachedCompletions] -> ShowS #

data ExtendImport #

Constructors

ExtendImport |
Fields doc :: !Uri newThing :: !Text thingParent :: !(Maybe Text) importName :: !Text importQual :: !(Maybe Text)

#### Instances

Instances details

FromJSON ExtendImport # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods parseJSON :: Value -> Parser ExtendImport # parseJSONList :: Value -> Parser [ExtendImport] # omittedField :: Maybe ExtendImport #
ToJSON ExtendImport # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods toJSON :: ExtendImport -> Value # toEncoding :: ExtendImport -> Encoding # toJSONList :: [ExtendImport] -> Value # toEncodingList :: [ExtendImport] -> Encoding # omitField :: ExtendImport -> Bool #
Generic ExtendImport # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Associated Types
type Rep ExtendImport |
Instance details Defined in Development.IDE.Plugin.Completions.Types type Rep ExtendImport = D1 ('MetaData "ExtendImport" "Development.IDE.Plugin.Completions.Types" "ghcide-2.9.0.0-1G3u1vh8JKWDpMQ8kfXrG1" 'False) (C1 ('MetaCons "ExtendImport" 'PrefixI 'True) ((S1 ('MetaSel ('Just "doc") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Uri) :*: S1 ('MetaSel ('Just "newThing") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)) :*: (S1 ('MetaSel ('Just "thingParent") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe Text)) :*: (S1 ('MetaSel ('Just "importName") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "importQual") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe Text))))))
Methods from :: ExtendImport -> Rep ExtendImport x # to :: Rep ExtendImport x -> ExtendImport #
Show ExtendImport # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods showsPrec :: Int -> ExtendImport -> ShowS # show :: ExtendImport -> String # showList :: [ExtendImport] -> ShowS #
Eq ExtendImport # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods (==) :: ExtendImport -> ExtendImport -> Bool # (/=) :: ExtendImport -> ExtendImport -> Bool #
type Rep ExtendImport # |
Instance details Defined in Development.IDE.Plugin.Completions.Types type Rep ExtendImport = D1 ('MetaData "ExtendImport" "Development.IDE.Plugin.Completions.Types" "ghcide-2.9.0.0-1G3u1vh8JKWDpMQ8kfXrG1" 'False) (C1 ('MetaCons "ExtendImport" 'PrefixI 'True) ((S1 ('MetaSel ('Just "doc") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Uri) :*: S1 ('MetaSel ('Just "newThing") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)) :*: (S1 ('MetaSel ('Just "thingParent") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe Text)) :*: (S1 ('MetaSel ('Just "importName") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "importQual") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe Text))))))

properties :: Properties '['PropertyKey "autoExtendOn" 'TBoolean, 'PropertyKey "snippetsOn" 'TBoolean] #

data LocalCompletions #

Constructors

LocalCompletions |

#### Instances

Instances details

NFData LocalCompletions # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods rnf :: LocalCompletions -> () #
Generic LocalCompletions # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Associated Types
type Rep LocalCompletions |
Instance details Defined in Development.IDE.Plugin.Completions.Types type Rep LocalCompletions = D1 ('MetaData "LocalCompletions" "Development.IDE.Plugin.Completions.Types" "ghcide-2.9.0.0-1G3u1vh8JKWDpMQ8kfXrG1" 'False) (C1 ('MetaCons "LocalCompletions" 'PrefixI 'False) (U1 :: Type -> Type))
Methods from :: LocalCompletions -> Rep LocalCompletions x # to :: Rep LocalCompletions x -> LocalCompletions #
Show LocalCompletions # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods showsPrec :: Int -> LocalCompletions -> ShowS # show :: LocalCompletions -> String # showList :: [LocalCompletions] -> ShowS #
Eq LocalCompletions # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods (==) :: LocalCompletions -> LocalCompletions -> Bool # (/=) :: LocalCompletions -> LocalCompletions -> Bool #
Hashable LocalCompletions # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods hashWithSalt :: Int -> LocalCompletions -> Int # hash :: LocalCompletions -> Int #
type Rep LocalCompletions # |
Instance details Defined in Development.IDE.Plugin.Completions.Types type Rep LocalCompletions = D1 ('MetaData "LocalCompletions" "Development.IDE.Plugin.Completions.Types" "ghcide-2.9.0.0-1G3u1vh8JKWDpMQ8kfXrG1" 'False) (C1 ('MetaCons "LocalCompletions" 'PrefixI 'False) (U1 :: Type -> Type))
type RuleResult LocalCompletions # | Produce completions info for a file
Instance details Defined in Development.IDE.Plugin.Completions.Types type RuleResult LocalCompletions = CachedCompletions

data NonLocalCompletions #

Constructors

NonLocalCompletions |

#### Instances

Instances details

NFData NonLocalCompletions # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods rnf :: NonLocalCompletions -> () #
Generic NonLocalCompletions # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Associated Types
type Rep NonLocalCompletions |
Instance details Defined in Development.IDE.Plugin.Completions.Types type Rep NonLocalCompletions = D1 ('MetaData "NonLocalCompletions" "Development.IDE.Plugin.Completions.Types" "ghcide-2.9.0.0-1G3u1vh8JKWDpMQ8kfXrG1" 'False) (C1 ('MetaCons "NonLocalCompletions" 'PrefixI 'False) (U1 :: Type -> Type))
Methods from :: NonLocalCompletions -> Rep NonLocalCompletions x # to :: Rep NonLocalCompletions x -> NonLocalCompletions #
Show NonLocalCompletions # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods showsPrec :: Int -> NonLocalCompletions -> ShowS # show :: NonLocalCompletions -> String # showList :: [NonLocalCompletions] -> ShowS #
Eq NonLocalCompletions # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods (==) :: NonLocalCompletions -> NonLocalCompletions -> Bool # (/=) :: NonLocalCompletions -> NonLocalCompletions -> Bool #
Hashable NonLocalCompletions # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods hashWithSalt :: Int -> NonLocalCompletions -> Int # hash :: NonLocalCompletions -> Int #
type Rep NonLocalCompletions # |
Instance details Defined in Development.IDE.Plugin.Completions.Types type Rep NonLocalCompletions = D1 ('MetaData "NonLocalCompletions" "Development.IDE.Plugin.Completions.Types" "ghcide-2.9.0.0-1G3u1vh8JKWDpMQ8kfXrG1" 'False) (C1 ('MetaCons "NonLocalCompletions" 'PrefixI 'False) (U1 :: Type -> Type))
type RuleResult NonLocalCompletions # |
Instance details Defined in Development.IDE.Plugin.Completions.Types type RuleResult NonLocalCompletions = CachedCompletions

data Backtick #

Constructors

Surrounded |
LeftSide |

#### Instances

Instances details

Show Backtick # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods showsPrec :: Int -> Backtick -> ShowS # show :: Backtick -> String # showList :: [Backtick] -> ShowS #
Eq Backtick # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods (==) :: Backtick -> Backtick -> Bool # (/=) :: Backtick -> Backtick -> Bool #
Ord Backtick # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods compare :: Backtick -> Backtick -> Ordering # (<) :: Backtick -> Backtick -> Bool # (<=) :: Backtick -> Backtick -> Bool # (>) :: Backtick -> Backtick -> Bool # (>=) :: Backtick -> Backtick -> Bool # max :: Backtick -> Backtick -> Backtick # min :: Backtick -> Backtick -> Backtick #

extendImportCommandId :: Text #

data Provenance #

Constructors

ImportedFrom Text |
DefinedIn Text |
Local SrcSpan |

#### Instances

Instances details

Show Provenance # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods showsPrec :: Int -> Provenance -> ShowS # show :: Provenance -> String # showList :: [Provenance] -> ShowS #
Eq Provenance # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods (==) :: Provenance -> Provenance -> Bool # (/=) :: Provenance -> Provenance -> Bool #
Ord Provenance # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods compare :: Provenance -> Provenance -> Ordering # (<) :: Provenance -> Provenance -> Bool # (<=) :: Provenance -> Provenance -> Bool # (>) :: Provenance -> Provenance -> Bool # (>=) :: Provenance -> Provenance -> Bool # max :: Provenance -> Provenance -> Provenance # min :: Provenance -> Provenance -> Provenance #

data NameDetails #

This is a JSON serialisable representation of a GHC Name that we include in completion responses so that we can recover the original name corresponding to the completion item. This is used to resolve additional details on demand about the item like its type and documentation.

Constructors

NameDetails Module OccName |

#### Instances

Instances details

FromJSON NameDetails # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods parseJSON :: Value -> Parser NameDetails # parseJSONList :: Value -> Parser [NameDetails] # omittedField :: Maybe NameDetails #
ToJSON NameDetails # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods toJSON :: NameDetails -> Value # toEncoding :: NameDetails -> Encoding # toJSONList :: [NameDetails] -> Value # toEncodingList :: [NameDetails] -> Encoding # omitField :: NameDetails -> Bool #
Show NameDetails # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods showsPrec :: Int -> NameDetails -> ShowS # show :: NameDetails -> String # showList :: [NameDetails] -> ShowS #
Eq NameDetails # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods (==) :: NameDetails -> NameDetails -> Bool # (/=) :: NameDetails -> NameDetails -> Bool #

newtype QualCompls #

Constructors

QualCompls |
Fields getQualCompls :: Map Text [CompItem]

#### Instances

Instances details

Monoid QualCompls # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods mempty :: QualCompls # mappend :: QualCompls -> QualCompls -> QualCompls # mconcat :: [QualCompls] -> QualCompls #
Semigroup QualCompls # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods (<>) :: QualCompls -> QualCompls -> QualCompls # sconcat :: NonEmpty QualCompls -> QualCompls # stimes :: Integral b => b -> QualCompls -> QualCompls #
Show QualCompls # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods showsPrec :: Int -> QualCompls -> ShowS # show :: QualCompls -> String # showList :: [QualCompls] -> ShowS #

data PosPrefixInfo #

Describes the line at the current cursor position

Constructors

PosPrefixInfo |
Fields fullLine :: !Text The full contents of the line the cursor is at prefixScope :: !Text If any, the module name that was typed right before the cursor position. For example, if the user has typed "Data.Maybe.from", then this property will be Data.Maybe If OverloadedRecordDot is enabled, "Shape.rect.width" will be "Shape.rect" prefixText :: !Text The word right before the cursor position, after removing the module part. For example if the user has typed "Data.Maybe.from", then this property will be "from" cursorPos :: !Position The cursor position

#### Instances

Instances details

Show PosPrefixInfo # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods showsPrec :: Int -> PosPrefixInfo -> ShowS # show :: PosPrefixInfo -> String # showList :: [PosPrefixInfo] -> ShowS #
Eq PosPrefixInfo # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods (==) :: PosPrefixInfo -> PosPrefixInfo -> Bool # (/=) :: PosPrefixInfo -> PosPrefixInfo -> Bool #

nsJSON :: NameSpace -> Value #

parseNs :: Value -> Parser NameSpace #

data CompletionResolveData #

The data that is actually sent for resolve support We need the URI to be able to reconstruct the GHC environment in the file the completion was triggered in.

Constructors

CompletionResolveData |
Fields itemFile :: Uri itemNeedsType :: Bool Do we need to lookup a type for this item? itemName :: NameDetails

#### Instances

Instances details

FromJSON CompletionResolveData # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods parseJSON :: Value -> Parser CompletionResolveData # parseJSONList :: Value -> Parser [CompletionResolveData] # omittedField :: Maybe CompletionResolveData #
ToJSON CompletionResolveData # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Methods toJSON :: CompletionResolveData -> Value # toEncoding :: CompletionResolveData -> Encoding # toJSONList :: [CompletionResolveData] -> Value # toEncodingList :: [CompletionResolveData] -> Encoding # omitField :: CompletionResolveData -> Bool #
Generic CompletionResolveData # |
Instance details Defined in Development.IDE.Plugin.Completions.Types Associated Types
type Rep CompletionResolveData |
Instance details Defined in Development.IDE.Plugin.Completions.Types type Rep CompletionResolveData = D1 ('MetaData "CompletionResolveData" "Development.IDE.Plugin.Completions.Types" "ghcide-2.9.0.0-1G3u1vh8JKWDpMQ8kfXrG1" 'False) (C1 ('MetaCons "CompletionResolveData" 'PrefixI 'True) (S1 ('MetaSel ('Just "itemFile") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Uri) :*: (S1 ('MetaSel ('Just "itemNeedsType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "itemName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NameDetails))))
Methods from :: CompletionResolveData -> Rep CompletionResolveData x # to :: Rep CompletionResolveData x -> CompletionResolveData #
type Rep CompletionResolveData # |
Instance details Defined in Development.IDE.Plugin.Completions.Types type Rep CompletionResolveData = D1 ('MetaData "CompletionResolveData" "Development.IDE.Plugin.Completions.Types" "ghcide-2.9.0.0-1G3u1vh8JKWDpMQ8kfXrG1" 'False) (C1 ('MetaCons "CompletionResolveData" 'PrefixI 'True) (S1 ('MetaSel ('Just "itemFile") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Uri) :*: (S1 ('MetaSel ('Just "itemNeedsType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "itemName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NameDetails))))