Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype Log = LogShake Log
- tacticDesc :: Text -> Text
- tcCommandName :: TacticCommand -> Text
- runIde :: String -> String -> IdeState -> Action a -> IO a
- runIdeAction :: String -> String -> IdeState -> IdeAction a -> IO a
- runCurrentIde :: forall a r. (r ~ RuleResult a, Eq a, Hashable a, Show a, Typeable a, NFData a, Show r, Typeable r, NFData r) => String -> IdeState -> NormalizedFilePath -> a -> MaybeT IO (Tracked 'Current r)
- runStaleIde :: forall a r. (r ~ RuleResult a, Eq a, Hashable a, Show a, Typeable a, NFData a, Show r, Typeable r, NFData r) => String -> IdeState -> NormalizedFilePath -> a -> MaybeT IO (TrackedStale r)
- unsafeRunStaleIde :: forall a r. (r ~ RuleResult a, Eq a, Hashable a, Show a, Typeable a, NFData a, Show r, Typeable r, NFData r) => String -> IdeState -> NormalizedFilePath -> a -> MaybeT IO r
- unsafeRunStaleIdeFast :: forall a r. (r ~ RuleResult a, Eq a, Hashable a, Show a, Typeable a, NFData a, Show r, Typeable r, NFData r) => String -> IdeState -> NormalizedFilePath -> a -> MaybeT IO r
- properties :: Properties '['PropertyKey "hole_severity" ('TEnum (Maybe DiagnosticSeverity)), 'PropertyKey "max_use_ctor_actions" 'TInteger, 'PropertyKey "timeout_duration" 'TInteger, 'PropertyKey "auto_gas" 'TInteger, 'PropertyKey "proofstate_styling" 'TBoolean]
- getTacticConfig :: MonadLsp Config m => PluginId -> m Config
- getIdeDynflags :: IdeState -> NormalizedFilePath -> MaybeT IO DynFlags
- getAllMetaprograms :: Data a => a -> [String]
- judgementForHole :: IdeState -> NormalizedFilePath -> Tracked 'Current Range -> Config -> MaybeT IO HoleJudgment
- holeSortFor :: Maybe Text -> HoleSort
- mkJudgementAndContext :: Config -> Type -> TrackedStale Bindings -> Tracked 'Current RealSrcSpan -> TrackedStale TcGblEnv -> HscEnv -> ExternalPackageState -> Maybe (Judgement, Context)
- getAlreadyDestructed :: Tracked age SrcSpan -> Tracked age (LHsBinds GhcTc) -> Set OccName
- getSpanAndTypeAtHole :: Tracked age Range -> Tracked age (HieASTs Type) -> Maybe (Tracked age RealSrcSpan, Type)
- spliceProvenance :: Hypothesis a -> Hypothesis a -> Hypothesis a
- getRhsPosVals :: Tracked age RealSrcSpan -> Tracked age TypecheckedSource -> Hypothesis CType
- buildTopLevelHypothesis :: OccName -> [PatCompat GhcTc] -> State Int (Hypothesis CType)
- buildPatHy :: Provenance -> PatCompat GhcTc -> State Int (Hypothesis CType)
- mkDerivedRecordHypothesis :: Provenance -> ConLike -> [Type] -> HsRecFields GhcTc (PatCompat GhcTc) -> State Int (Hypothesis CType)
- mkFakeVar :: State Int OccName
- mkDerivedConHypothesis :: Provenance -> ConLike -> [Type] -> [(Int, PatCompat GhcTc)] -> State Int (Hypothesis CType)
- mkIdHypothesis :: Id -> Provenance -> Hypothesis CType
- isRhsHoleWithoutWhere :: Tracked age RealSrcSpan -> Tracked age TypecheckedSource -> Bool
- ufmSeverity :: UserFacingMessage -> MessageType
- mkShowMessageParams :: UserFacingMessage -> ShowMessageParams
- showLspMessage :: MonadLsp cfg m => ShowMessageParams -> m ()
- data WriteDiagnostics = WriteDiagnostics
- data GetMetaprograms = GetMetaprograms
- wingmanRules :: Recorder (WithPriority Log) -> PluginId -> Rules ()
- mkDiagnostic :: DiagnosticSeverity -> Range -> Diagnostic
- mkWorkspaceEdits :: DynFlags -> ClientCapabilities -> Uri -> Annotated ParsedSource -> Graft (Either String) ParsedSource -> Either UserFacingMessage WorkspaceEdit
- annotateMetaprograms :: Data a => a -> Transform a
- getMetaprogramAtSpan :: Tracked age SrcSpan -> Tracked age TcGblEnv -> Maybe Text
Documentation
tacticDesc :: Text -> Text Source #
tcCommandName :: TacticCommand -> Text Source #
The name of the command for the LS.
runCurrentIde :: forall a r. (r ~ RuleResult a, Eq a, Hashable a, Show a, Typeable a, NFData a, Show r, Typeable r, NFData r) => String -> IdeState -> NormalizedFilePath -> a -> MaybeT IO (Tracked 'Current r) Source #
runStaleIde :: forall a r. (r ~ RuleResult a, Eq a, Hashable a, Show a, Typeable a, NFData a, Show r, Typeable r, NFData r) => String -> IdeState -> NormalizedFilePath -> a -> MaybeT IO (TrackedStale r) Source #
unsafeRunStaleIde :: forall a r. (r ~ RuleResult a, Eq a, Hashable a, Show a, Typeable a, NFData a, Show r, Typeable r, NFData r) => String -> IdeState -> NormalizedFilePath -> a -> MaybeT IO r Source #
unsafeRunStaleIdeFast :: forall a r. (r ~ RuleResult a, Eq a, Hashable a, Show a, Typeable a, NFData a, Show r, Typeable r, NFData r) => String -> IdeState -> NormalizedFilePath -> a -> MaybeT IO r Source #
properties :: Properties '['PropertyKey "hole_severity" ('TEnum (Maybe DiagnosticSeverity)), 'PropertyKey "max_use_ctor_actions" 'TInteger, 'PropertyKey "timeout_duration" 'TInteger, 'PropertyKey "auto_gas" 'TInteger, 'PropertyKey "proofstate_styling" 'TBoolean] Source #
getIdeDynflags :: IdeState -> NormalizedFilePath -> MaybeT IO DynFlags Source #
getAllMetaprograms :: Data a => a -> [String] Source #
judgementForHole :: IdeState -> NormalizedFilePath -> Tracked 'Current Range -> Config -> MaybeT IO HoleJudgment Source #
Find the last typechecked module, and find the most specific span, as well as the judgement at the given range.
mkJudgementAndContext :: Config -> Type -> TrackedStale Bindings -> Tracked 'Current RealSrcSpan -> TrackedStale TcGblEnv -> HscEnv -> ExternalPackageState -> Maybe (Judgement, Context) Source #
getAlreadyDestructed :: Tracked age SrcSpan -> Tracked age (LHsBinds GhcTc) -> Set OccName Source #
Determine which bindings have already been destructed by the location of the hole.
getSpanAndTypeAtHole :: Tracked age Range -> Tracked age (HieASTs Type) -> Maybe (Tracked age RealSrcSpan, Type) Source #
:: Hypothesis a | Bindings to keep |
-> Hypothesis a | Bindings to keep if they don't overlap with the first set |
-> Hypothesis a |
Combine two (possibly-overlapping) hypotheses; using the provenance from the first hypothesis if the bindings overlap.
getRhsPosVals :: Tracked age RealSrcSpan -> Tracked age TypecheckedSource -> Hypothesis CType Source #
Compute top-level position vals of a function
buildTopLevelHypothesis Source #
Construct a hypothesis given the patterns from the left side of a HsMatch. These correspond to things that the user put in scope before running tactics.
buildPatHy :: Provenance -> PatCompat GhcTc -> State Int (Hypothesis CType) Source #
Construct a hypothesis for a single pattern, including building sub-hypotheses for constructor pattern matches.
mkDerivedRecordHypothesis Source #
:: Provenance | |
-> ConLike | Destructing constructor |
-> [Type] | Applied type variables |
-> HsRecFields GhcTc (PatCompat GhcTc) | |
-> State Int (Hypothesis CType) |
Like mkDerivedConHypothesis
, but for record patterns.
mkFakeVar :: State Int OccName Source #
Construct a fake variable name. Used to track the provenance of top-level
pattern matches which otherwise wouldn't have anything to attach their
TopLevelArgPrv
to.
mkDerivedConHypothesis Source #
:: Provenance | |
-> ConLike | Destructing constructor |
-> [Type] | Applied type variables |
-> [(Int, PatCompat GhcTc)] | Patterns, and their order in the data con |
-> State Int (Hypothesis CType) |
Construct a fake varible to attach the current Provenance
to, and then
build a sub-hypothesis for the pattern match.
mkIdHypothesis :: Id -> Provenance -> Hypothesis CType Source #
Build a Hypothesis
given an Id
.
isRhsHoleWithoutWhere :: Tracked age RealSrcSpan -> Tracked age TypecheckedSource -> Bool Source #
Is this hole immediately to the right of an equals sign --- and is there no where clause attached to it?
It's important that there is no where clause because otherwise it gets clobbered. See #2183 for an example.
This isn't a perfect check, and produces some ugly code. But it's much much better than the alternative, which is to destructively modify the user's AST.
showLspMessage :: MonadLsp cfg m => ShowMessageParams -> m () Source #
data WriteDiagnostics Source #
Instances
Eq WriteDiagnostics Source # | |
Defined in Wingman.LanguageServer (==) :: WriteDiagnostics -> WriteDiagnostics -> Bool # (/=) :: WriteDiagnostics -> WriteDiagnostics -> Bool # | |
Show WriteDiagnostics Source # | |
Defined in Wingman.LanguageServer showsPrec :: Int -> WriteDiagnostics -> ShowS # show :: WriteDiagnostics -> String # showList :: [WriteDiagnostics] -> ShowS # | |
Generic WriteDiagnostics Source # | |
Defined in Wingman.LanguageServer type Rep WriteDiagnostics :: Type -> Type # from :: WriteDiagnostics -> Rep WriteDiagnostics x # to :: Rep WriteDiagnostics x -> WriteDiagnostics # | |
Hashable WriteDiagnostics Source # | |
Defined in Wingman.LanguageServer hashWithSalt :: Int -> WriteDiagnostics -> Int # hash :: WriteDiagnostics -> Int # | |
NFData WriteDiagnostics Source # | |
Defined in Wingman.LanguageServer rnf :: WriteDiagnostics -> () # | |
type Rep WriteDiagnostics Source # | |
type RuleResult WriteDiagnostics Source # | |
Defined in Wingman.LanguageServer |
data GetMetaprograms Source #
Instances
Eq GetMetaprograms Source # | |
Defined in Wingman.LanguageServer (==) :: GetMetaprograms -> GetMetaprograms -> Bool # (/=) :: GetMetaprograms -> GetMetaprograms -> Bool # | |
Show GetMetaprograms Source # | |
Defined in Wingman.LanguageServer showsPrec :: Int -> GetMetaprograms -> ShowS # show :: GetMetaprograms -> String # showList :: [GetMetaprograms] -> ShowS # | |
Generic GetMetaprograms Source # | |
Defined in Wingman.LanguageServer type Rep GetMetaprograms :: Type -> Type # from :: GetMetaprograms -> Rep GetMetaprograms x # to :: Rep GetMetaprograms x -> GetMetaprograms # | |
Hashable GetMetaprograms Source # | |
Defined in Wingman.LanguageServer hashWithSalt :: Int -> GetMetaprograms -> Int # hash :: GetMetaprograms -> Int # | |
NFData GetMetaprograms Source # | |
Defined in Wingman.LanguageServer rnf :: GetMetaprograms -> () # | |
type Rep GetMetaprograms Source # | |
type RuleResult GetMetaprograms Source # | |
Defined in Wingman.LanguageServer |
wingmanRules :: Recorder (WithPriority Log) -> PluginId -> Rules () Source #
mkDiagnostic :: DiagnosticSeverity -> Range -> Diagnostic Source #
mkWorkspaceEdits :: DynFlags -> ClientCapabilities -> Uri -> Annotated ParsedSource -> Graft (Either String) ParsedSource -> Either UserFacingMessage WorkspaceEdit Source #
Transform a Graft
over the AST into a WorkspaceEdit
.
annotateMetaprograms :: Data a => a -> Transform a Source #
Add ExactPrint annotations to every metaprogram in the source tree. Usually the ExactPrint module can do this for us, but we've enabled QuasiQuotes, so the round-trip print/parse journey will crash.