haskell-language-server-2.7.0.0: LSP server for GHC

Safe Haskell | None
Language | GHC2021

Ide.Plugin.Cabal.Completion.Completer.Module

Synopsis

- modulesCompleter :: (Maybe StanzaName -> GenericPackageDescription -> [FilePath]) -> Completer
- filePathsForExposedModules :: Recorder (WithPriority Log) -> [FilePath] -> CabalPrefixInfo -> IO [Text]
- mkExposedModulePathCompletion :: PathCompletionInfo -> FilePath -> IO Text
- fpToExposedModulePath :: FilePath -> FilePath -> Text
- exposedModulePathToFp :: Text -> FilePath

# Documentation

modulesCompleter :: (Maybe StanzaName -> GenericPackageDescription -> [FilePath]) -> Completer #

Completer to be used when module paths can be completed for the field.

Takes an extraction function which extracts the source directories to be used by the completer.

filePathsForExposedModules :: Recorder (WithPriority Log) -> [FilePath] -> CabalPrefixInfo -> IO [Text] #

Takes a list of source directories and returns a list of path completions relative to any of the passed source directories which fit the passed prefix info.

mkExposedModulePathCompletion :: PathCompletionInfo -> FilePath -> IO Text #

Takes a pathCompletionInfo and a path segment and generates the whole filepath to be written on completion including a possibly already written prefix; using the cabal syntax for exposed modules.

Examples: When the partial directory path `Dir.Dir2.` is stored in the PathCompletionInfo and the completed file `hs` is passed along with that PathCompletionInfo, the result would be `HaskellFile`

When the partial directory path `Dir.` is stored in the PathCompletionInfo and the completed directory `Dir2` is passed along with that PathCompletionInfo, the result would be `Dir1.Dir2.`

fpToExposedModulePath :: FilePath -> FilePath -> Text #

Takes a source directory path and a module path and returns the module path relative to the source directory in exposed module syntax where the separators are `.` and the file ending is removed.

Synopsis: ``fpToExposedModulePath` sourceDir modPath`.

exposedModulePathToFp :: Text -> FilePath #

Takes a path in the exposed module syntax and translates it to a platform-compatible file path.