diff --git a/ghcide/src/Development/IDE/Plugin/Completions/Logic.hs b/ghcide/src/Development/IDE/Plugin/Completions/Logic.hs
index 9ce4c80cd6fdf009ad0b79b98fbd3c1d2b7fb20a..f1017eea93eb0cdeda938f125f2f2348e3ec0967 100644
--- a/ghcide/src/Development/IDE/Plugin/Completions/Logic.hs
+++ b/ghcide/src/Development/IDE/Plugin/Completions/Logic.hs
@@ -31,6 +31,7 @@ import           Data.Function                            (on)
 import           Data.Functor
 import qualified Data.HashMap.Strict                      as HM
 import qualified Data.HashSet                             as HashSet
+import           Data.Monoid                              (First(..))
 import           Data.Ord                                 (Down (Down))
 import qualified Data.Set                                 as Set
 import           Development.IDE.Core.Compile
@@ -757,12 +758,8 @@ openingBacktick line prefixModule prefixText Position { _character=(fromIntegral
     -}
 -- TODO: Turn this into an alex lexer that discards prefixes as if they were whitespace.
 stripPrefix :: T.Text -> T.Text
-stripPrefix name = T.takeWhile (/=':') $ go prefixes
-  where
-    go [] = name
-    go (p:ps)
-      | T.isPrefixOf p name = T.drop (T.length p) name
-      | otherwise = go ps
+stripPrefix name = T.takeWhile (/=':') $ fromMaybe name $
+  getFirst $ foldMap (First . (`T.stripPrefix` name)) prefixes
 
 -- | Prefixes that can occur in a GHC OccName
 prefixes :: [T.Text]