yi-core-0.19.4: Yi editor core library

License | GPL-2
Maintainer | yi-devel@googlegroups.com
Stability | experimental
Portability | portable
Safe Haskell | None
Language | Haskell2010
Extensions | OverloadedStrings

Yi.Completion

Description

Collection of functions for completion and matching.

Synopsis

- completeInList :: Text -> (Text -> Maybe Text) -> [Text] -> EditorM Text
- completeInList' :: Text -> (Text -> Maybe Text) -> [Text] -> EditorM Text
- completeInListCustomShow :: (Text -> Text) -> Text -> (Text -> Maybe Text) -> [Text] -> EditorM Text
- commonPrefix :: Eq a => [[a]] -> [a]
- prefixMatch :: Text -> Text -> Maybe Text
- infixUptoEndMatch :: Text -> Text -> Maybe Text
- subsequenceMatch :: String -> String -> Bool
- subsequenceTextMatch :: Text -> Text -> Bool
- containsMatch' :: Bool -> Text -> Text -> Maybe Text
- containsMatch :: Text -> Text -> Maybe Text
- containsMatchCaseInsensitive :: Text -> Text -> Maybe Text
- isCasePrefixOf :: Bool -> Text -> Text -> Bool

# Documentation

completeInList Source #

Arguments

:: Text | Input to match on
-> (Text -> Maybe Text) | matcher function
-> [Text] | items to match against
-> EditorM Text |

Complete a string given a user input string, a matching function and a list of possibilites. Matching function should return the part of the string that matches the user string.

completeInList' :: Text -> (Text -> Maybe Text) -> [Text] -> EditorM Text Source #

completeInListCustomShow Source #

Arguments

:: (Text -> Text) | Show function
-> Text | Input to match on
-> (Text -> Maybe Text) | matcher function
-> [Text] | items to match against
-> EditorM Text |

Same as `completeInList`, but maps `showFunction` on possible matches when printing

commonPrefix :: Eq a => [[a]] -> [a] Source #

Return the longest common prefix of a set of lists.

    P(xs) === all (isPrefixOf (commonPrefix xs)) xs
    length s > length (commonPrefix xs) --> not (all (isPrefixOf s) xs)

prefixMatch :: Text -> Text -> Maybe Text Source #

Prefix matching function, for use with `completeInList`

infixUptoEndMatch :: Text -> Text -> Maybe Text Source #

Text from the match up to the end, for use with `completeInList`

subsequenceMatch :: String -> String -> Bool Source #

A simple fuzzy match algorithm. Example: "abc" matches "a1b2c"

subsequenceTextMatch :: Text -> Text -> Bool Source #

A simple fuzzy match algorithm. Example: "abc" matches "a1b2c"

containsMatch' :: Bool -> Text -> Text -> Maybe Text Source #

TODO: this is a terrible function, isn't this just case-insensitive infix? – Fūzetsu

containsMatch :: Text -> Text -> Maybe Text Source #

containsMatchCaseInsensitive :: Text -> Text -> Maybe Text Source #

isCasePrefixOf Source #

Arguments

:: Bool | Is case-sensitive?
-> Text |
-> Text |
-> Bool |

Like usual `isPrefixOf` but user can specify case sensitivity. See `toCaseFold` for exotic unicode gotchas.