diff --git a/packages/literate-elm/src/program.ts b/packages/literate-elm/src/program.ts index f4054e9..048b1ce 100644 --- a/packages/literate-elm/src/program.ts +++ b/packages/literate-elm/src/program.ts @@ -375,6 +375,14 @@ const convertErrorsToMessages = ( }; const getErrorMessageText = (error): string => { + if (error.title === "UNKNOWN IMPORT") { + // Unknown imports form a special case. It is not reasonable to suggest looking into elm.json and source-directories + // as this is causing confusion in the literate-elm environment. + const failedImport = _.get(error, ["message", 1, "string"]); + if (failedImport) { + return `Could not ${failedImport}. Please make sure you have specified all dependencies on third-party Elm modules.`; + } + } if (_.isArray(error.message)) { const text = error.message .map((chunk) => { diff --git a/packages/litvis/src/document/frontmatter/lintElm.ts b/packages/litvis/src/document/frontmatter/lintElm.ts index c583e71..1710ea4 100644 --- a/packages/litvis/src/document/frontmatter/lintElm.ts +++ b/packages/litvis/src/document/frontmatter/lintElm.ts @@ -31,5 +31,16 @@ export default (dataWithPosition, document: LitvisDocument): void => { ); }); } + if (dataWithPosition.dependencies && (!elm || !elm.dependencies)) { + const elmPosition = getPosition(dataWithPosition.elm); + const dependenciesPosition = getPosition(dataWithPosition.dependencies); + if (dependenciesPosition.start.line > elmPosition.end.line) { + document.message( + `It seems that you are missing indentation before ‘dependencies’ and its sub-nodes. Without leading spaces, the value is not considered as a child node of ‘elm’.`, + dependenciesPosition, + "litvis:frontmatter:elm:dependencies", + ); + } + } } };