diff --git a/hls-module-name-plugin.cabal b/hls-module-name-plugin.cabal
--- a/hls-module-name-plugin.cabal
+++ b/hls-module-name-plugin.cabal
@@ -1,6 +1,6 @@
 cabal-version:      2.4
 name:               hls-module-name-plugin
-version:            2.2.0.0
+version:            2.3.0.0
 synopsis:           Module name plugin for Haskell Language Server
 description:
   Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>
@@ -33,8 +33,8 @@
     , containers
     , directory
     , filepath
-    , ghcide                == 2.2.0.0
-    , hls-plugin-api        == 2.2.0.0
+    , ghcide                == 2.3.0.0
+    , hls-plugin-api        == 2.3.0.0
     , lsp
     , text
     , transformers
@@ -53,4 +53,4 @@
     , base
     , filepath
     , hls-module-name-plugin
-    , hls-test-utils          == 2.2.0.0
+    , hls-test-utils          == 2.3.0.0
diff --git a/src/Ide/Plugin/ModuleName.hs b/src/Ide/Plugin/ModuleName.hs
--- a/src/Ide/Plugin/ModuleName.hs
+++ b/src/Ide/Plugin/ModuleName.hs
@@ -25,11 +25,12 @@
 import           Control.Monad.Trans.Except
 import           Control.Monad.Trans.Maybe
 import           Data.Aeson                           (toJSON)
-import           Data.Char                            (isLower)
-import           Data.List                            (intercalate, isPrefixOf,
-                                                       minimumBy)
+import           Data.Char                            (isLower, isUpper)
+import           Data.List                            (intercalate, minimumBy,
+                                                       stripPrefix, uncons)
 import qualified Data.List.NonEmpty                   as NE
 import qualified Data.Map                             as Map
+import           Data.Maybe                           (mapMaybe)
 import           Data.Ord                             (comparing)
 import           Data.String                          (IsString)
 import qualified Data.Text                            as T
@@ -154,15 +155,17 @@
       mdlPath <- liftIO $ makeAbsolute filePath
       logWith recorder Debug (AbsoluteFilePath mdlPath)
 
-      let prefixes = filter (`isPrefixOf` mdlPath) paths
-      pure (map (moduleNameFrom mdlPath) prefixes)
+      let suffixes = mapMaybe (`stripPrefix` mdlPath) paths
+      pure (map moduleNameFrom suffixes)
   where
-    moduleNameFrom mdlPath prefix =
+    moduleNameFrom =
       T.pack
         . intercalate "."
+        -- Do not suggest names whose components start from a lower-case char,
+        -- they are guaranteed to be malformed.
+        . filter (maybe False (isUpper . fst) . uncons)
         . splitDirectories
-        . drop (length prefix)
-        $ dropExtension mdlPath
+        . dropExtension
 
 -- | The module name, as stated in the module
 codeModuleName :: IdeState -> NormalizedFilePath -> IO (Maybe (Range, T.Text))
