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

Ide.Plugin.Cabal.Completion.Completer.FilePath

Synopsis

Documentation

filePathCompleter :: Completer #

Completer to be used when a file path can be completed for a field. Completes file paths as well as directories.

directoryCompleter :: Completer #

Completer to be used when a directory can be completed for the field. Only completes directories.

listFileCompletions :: Recorder (WithPriority Log) -> PathCompletionInfo -> IO [FilePath] #

Takes a PathCompletionInfo and returns the list of files and directories in the directory which match the path completion info in posix style.

The directories end with a posix trailing path separator. Since this is used for completions to be written to the cabal file, we use posix separators here. See Note [Using correct file path separators].

listDirectoryCompletions :: Recorder (WithPriority Log) -> PathCompletionInfo -> IO [FilePath] #

Returns a list of all (and only) directories in the directory described by path completion info.

mkCompletionDirectory :: PathCompletionInfo -> FilePath #

Returns the directory where files and directories can be queried from for the passed PathCompletionInfo.

Returns the full path to the directory pointed to by the path prefix by combining it with the working directory.

Since this is used for querying paths we use platform compatible separators here. See Note [Using correct file path separators].

mkDirFromCWD :: PathCompletionInfo -> FilePath -> FilePath #

Returns the full path for the given path segment by combining the working directory with the path prefix and the path segment.

Since this is used for querying paths we use platform compatible separators here. See Note [Using correct file path separators].

mkPathCompletionDir :: PathCompletionInfo -> Text -> Text #

Takes a PathCompletionInfo and a directory and returns the complete cabal path to be written on completion action by combining the previously written path prefix and the completed path segment.

Since this is used for completions we use posix separators here. See Note [Using correct file path separators].

mkFilePathCompletion :: PathCompletionInfo -> Text -> IO Text #

Takes a PathCompletionInfo and a completed path segment and generates the whole filepath to be completed.

The returned text combines the completion with a relative path generated from a possible previously written path prefix and is relative to the cabal file location.

If the completion results in a filepath, we know this is a completed path and can thus apply wrapping of apostrophes if needed.