Skip to content

Commit

Permalink
fixed documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
VenInf authored and fendor committed May 27, 2024
1 parent 4d0904e commit 7e20540
Showing 1 changed file with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,20 @@ data PathCompletionInfo = PathCompletionInfo
if wasn't present in the original path.
Fix for the issue #3774
Examples of path splitting:
"" -> ("", "") instead of ("./","")
"./" -> ("./", "")
"dir" -> ("", "dir") instead of ("./","dir")
"./dir" -> ("./", "dir")
"dir1/dir2" -> ("dir1/","dir2")
"./dir1/dir2" -> ("./dir1/","dir2")
Examples:
>>> splitFileNameNoTrailingSlash ""
("", "")
>>> splitFileNameNoTrailingSlash "./"
("./", "")
>>> splitFileNameNoTrailingSlash "dir"
("", "dir")
>>> splitFileNameNoTrailingSlash "./dir"
("./", "dir")
>>> splitFileNameNoTrailingSlash "dir1/dir2"
("dir1/","dir2")
>>> splitFileNameNoTrailingSlash "./dir1/dir2"
("./dir1/","dir2")
-}
splitFileNameNoTrailingSlash :: FilePath -> (String, String)
splitFileNameNoTrailingSlash prefix = rmTrailingSlash ("./" `List.isPrefixOf` prefix) (Posix.splitFileName prefix)
Expand All @@ -85,7 +91,7 @@ pathCompletionInfoFromCabalPrefixInfo srcDir prefInfo =
}
where
prefix = T.unpack $ completionPrefix prefInfo
(queryDirectory', pathSegment') = splitFileNameNoTrailingSlash prefix
(queryDirectory', pathSegment') = splitFileNameNoTrailingSlash prefix

-- | Extracts the source directories of the library stanza.
sourceDirsExtractionLibrary :: Maybe StanzaName -> GenericPackageDescription -> [FilePath]
Expand Down

0 comments on commit 7e20540

Please sign in to comment.