haskell-language-server-2.9.0.0: LSP server for GHC
Safe HaskellSafe-Inferred
LanguageGHC2021

Ide.Plugin.Cabal.Completion.Completer.Paths

Synopsis

Documentation

data PathCompletionInfo Source #

Information used to query and build path completions.

Note that pathSegment combined with queryDirectory results in the original prefix.

Example: When given the written prefix, dir1/dir2/fi, the resulting PathCompletionInfo would be:

   pathSegment = "fi"
   queryDirectory  = "dir1/dir2/fi"
   ...
 

Constructors

PathCompletionInfo 

Fields

splitFileNameNoTrailingSlash :: FilePath -> (String, String) Source #

Posix.splitFileName modification, that drops trailing ./ if if wasn't present in the original path.

Fix for the issue #3774 Examples:

>>> splitFileNameNoTrailingSlash ""
("", "")
>>> splitFileNameNoTrailingSlash "./"
("./", "")
>>> splitFileNameNoTrailingSlash "dir"
("", "dir")
>>> splitFileNameNoTrailingSlash "./dir"
("./", "dir")
>>> splitFileNameNoTrailingSlash "dir1/dir2"
("dir1/","dir2")
>>> splitFileNameNoTrailingSlash "./dir1/dir2"
("./dir1/","dir2")

pathCompletionInfoFromCabalPrefixInfo :: FilePath -> CabalPrefixInfo -> PathCompletionInfo Source #

Takes an optional source subdirectory and a prefix info and creates a path completion info accordingly.

The source directory represents some subdirectory of the working directory such as a path from the field hs-source-dirs.

If the source subdirectory is empty, then the working directory is simply set to the currently handled cabal file's directory.

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.