hls-cabal-plugin-2.1.0.0: Cabal integration plugin with Haskell Language Server
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ide.Plugin.Cabal.Completion.Completer.Module

Synopsis

Documentation

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

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.

sourceDirsExtractionLibrary :: Maybe StanzaName -> GenericPackageDescription -> [FilePath] Source #

Extracts the source directories of the library stanza.

sourceDirsExtractionExecutable :: Maybe StanzaName -> GenericPackageDescription -> [FilePath] Source #

Extracts the source directories of the executable stanza with the given name.

sourceDirsExtractionTestSuite :: Maybe StanzaName -> GenericPackageDescription -> [FilePath] Source #

Extracts the source directories of the test suite stanza with the given name.

sourceDirsExtractionBenchmark :: Maybe StanzaName -> GenericPackageDescription -> [FilePath] Source #

Extracts the source directories of benchmark stanza with the given name.

extractRelativeDirsFromStanza :: Maybe StanzaName -> GenericPackageDescription -> (GenericPackageDescription -> [(UnqualComponentName, CondTree b c a)]) -> (a -> BuildInfo) -> [FilePath] Source #

Takes a possible stanza name, a GenericPackageDescription, a function to access the stanza information we are interested in and a function to access the build info from the specific stanza.

Returns a list of relative source directory paths specified for the extracted stanza.

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

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 Source #

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 Source #

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 Source #

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