@@ -36,7 +36,7 @@ data Exit
38data Problem
38data Problem
39− = ModuleNotFound Origin Module.Raw -- TODO suggest other names
39+ = ModuleNotFound Origin Module.Raw [FilePath]
40 | ModuleAmbiguous Origin Module.Raw [FilePath] [Pkg.Package]
40 | ModuleAmbiguous Origin Module.Raw [FilePath] [Pkg.Package]
41 | BadHeader FilePath Time.UTCTime BS.ByteString Compiler.Error
41 | BadHeader FilePath Time.UTCTime BS.ByteString Compiler.Error
42 | ModuleNameReservedForKernel Origin Module.Raw
42 | ModuleNameReservedForKernel Origin Module.Raw
@@ -113,8 +113,8 @@ toReport exit =
113problemToReport :: Problem -> Help.Report
113problemToReport :: Problem -> Help.Report
114problemToReport problem =
114problemToReport problem =
115 case problem of
115 case problem of
116− ModuleNotFound origin name ->
116+ ModuleNotFound origin name dirs ->
117− notFoundToDoc origin name
117+ notFoundToDoc origin name dirs
119 ModuleAmbiguous origin child paths pkgs ->
119 ModuleAmbiguous origin child paths pkgs ->
120 ambiguousToDoc origin child paths pkgs
120 ambiguousToDoc origin child paths pkgs
@@ -194,33 +194,34 @@ namelessToDoc path name =
197−notFoundToDoc :: Origin -> Module.Raw -> Help.Report
197+notFoundToDoc :: Origin -> Module.Raw -> [FilePath] -> Help.Report
198−notFoundToDoc origin child =
198+notFoundToDoc origin child dirs =
199 case origin of
199 case origin of
200 ElmJson ->
200 ElmJson ->
201− Help.report "MODULE NOT FOUND" Nothing
201+ Help.report "MODULE NOT FOUND" (Just "elm.json")
202 "Your elm.json says your project has the following module:"
202 "Your elm.json says your project has the following module:"
203− [ P.indent 4 $ P.dullyellow $ P.text $ Module.nameToString child
203+ [ P.indent 4 $ P.red $ P.text $ Module.nameToString child
204 , Help.reflow $
204 , Help.reflow $
205+ "When creating packages, all modules must live in the\
205− "I cannot find it though! Is there a typo in the module name?"
206+ \ src/ directory, but I cannot find it there."
208 File path ->
209 File path ->
209 Help.report "UNKNOWN IMPORT" (Just path)
210 Help.report "UNKNOWN IMPORT" (Just path)
210 ("I cannot find a `" ++ Module.nameToString child ++ "` module to import.")
211 ("I cannot find a `" ++ Module.nameToString child ++ "` module to import.")
211− (notFoundDetails child)
212+ (notFoundDetails child dirs)
213 Module path parent ->
214 Module path parent ->
214 Help.report "UNKNOWN IMPORT" (Just path)
215 Help.report "UNKNOWN IMPORT" (Just path)
215 ("The " ++ Module.nameToString parent ++ " module has a bad import:")
216 ("The " ++ Module.nameToString parent ++ " module has a bad import:")
216− (notFoundDetails child)
217+ (notFoundDetails child dirs)
219−notFoundDetails :: Module.Raw -> [P.Doc]
220+notFoundDetails :: Module.Raw -> [FilePath] -> [P.Doc]
220−notFoundDetails child =
221+notFoundDetails child dirs =
222 simulatedCode =
223 simulatedCode =
223− P.indent 4 $ P.dullyellow $ P.text $ "import " ++ Module.nameToString child
224+ P.indent 4 $ P.red $ P.text $ "import " ++ Module.nameToString child
225 case Map.lookup child Pkg.suggestions of
226 case Map.lookup child Pkg.suggestions of
226 Just pkg ->
227 Just pkg ->
@@ -245,8 +246,19 @@ notFoundDetails child =
245 ,"that","package","yet?"
246 ,"that","package","yet?"
247 , Help.reflow $
248 , Help.reflow $
248− "Is it a local file? Maybe it lives in some directory, but I cannot find that\
249+ case dirs of
251+ "Is it a local file? I look in directories listed in the \"source-directories\"\
252+ \ field of your elm.json, so maybe you need to add a \"src\" directory there?"
255+ "Is it a local file? I look in directories listed in the \"source-directories\"\
256+ \ field of your elm.json, but it is not in the " ++ dir ++ " directory."
249− \ directory unless it is listed in the \"source-directories\" field of your elm.json!"
259+ "Is it a local file? I look in directories listed in the \"source-directories\"\
260+ \ field of your elm.json (like the " ++ dir ++ " directory) but I do not see it\