Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- descriptor :: PluginId -> PluginDescriptor IdeState
- provider :: FormattingHandler IdeState
- formatText :: MonadIO m => DynFlags -> Maybe FilePath -> FormattingOptions -> Text -> m (Either [BrittanyError] Text)
- getConfFile :: NormalizedFilePath -> IO (Maybe FilePath)
- runBrittany :: Int -> DynFlags -> Maybe FilePath -> Text -> IO (Either [BrittanyError] Text)
- type CMaybe = Option
- opt :: a -> Option a
- fromMaybeT :: Monad m => m a -> MaybeT m a -> m a
- showErr :: BrittanyError -> String
- showExtension :: Extension -> Maybe String
- getExtensions :: DynFlags -> [String]
- pPrintText :: Config -> Text -> IO ([BrittanyError], Text)
- isError :: BrittanyError -> Bool
Documentation
provider :: FormattingHandler IdeState Source #
Formatter provider of Brittany. Formats the given source in either a given Range or the whole Document. If the provider fails an error is returned that can be displayed to the user.
:: MonadIO m | |
=> DynFlags | |
-> Maybe FilePath | Path to configs. If Nothing, default configs will be used. |
-> FormattingOptions | Options for the formatter such as indentation. |
-> Text | Text to format |
-> m (Either [BrittanyError] Text) | Either formatted Text or a error from Brittany. |
Primitive to format text with the given option. May not throw exceptions but return a Left value. Errors may be presented to the user.
getConfFile :: NormalizedFilePath -> IO (Maybe FilePath) Source #
Recursively search in every directory of the given filepath for brittany.yaml. If no such file has been found, return Nothing.
:: Int | tab size |
-> DynFlags | |
-> Maybe FilePath | local config file |
-> Text | text to format |
-> IO (Either [BrittanyError] Text) |
Run Brittany on the given text with the given tab size and a configuration path. If no configuration path is given, a default configuration is chosen. The configuration may overwrite tab size parameter.
Returns either a list of Brittany Errors or the reformatted text. May not throw an exception.
fromMaybeT :: Monad m => m a -> MaybeT m a -> m a Source #
showErr :: BrittanyError -> String Source #
getExtensions :: DynFlags -> [String] Source #
:: Config | global program config |
-> Text | input text |
-> IO ([BrittanyError], Text) | list of errors/warnings & result text |
This is a temporary fix that allows us to format the text if brittany throws warnings during pretty printing.
It should be removed when our PR to brittany is merged + released. See: - https://github.com/haskell/haskell-language-server/issues/2005 - https://github.com/lspitzner/brittany/pull/351
isError :: BrittanyError -> Bool Source #