diff --git a/client/src/components/Infoview.tsx b/client/src/components/Infoview.tsx index c4dd6f8..4f016c7 100644 --- a/client/src/components/Infoview.tsx +++ b/client/src/components/Infoview.tsx @@ -16,6 +16,14 @@ function Infoview({ editor, editorApi, leanClient } : {editor: monaco.editor.ISt const [goals, setGoals] = useState(null) const [completed, setCompleted] = useState(false) const [diagnostics, setDiagnostics] = useState(undefined) + + /* `globalDiagnostics` is a work-around to show something when the proof is complete + but had previous subgoals with `sorry` or errors. + + It is displayed whenever there are no goals and no (error)-messages present and the proof + isn't complete. */ + const [globalDiagnostics, setGlobalDiagnostics] = useState(undefined) + const [uri, setUri] = useState() console.log(rpcSession) const fetchInteractiveGoals = () => { @@ -40,6 +48,10 @@ function Infoview({ editor, editorApi, leanClient } : {editor: monaco.editor.ISt "textDocument":{uri}, "position": pos }).then((res) => { + + /* Workaround to not display the error `unsolved goals` */ + if (res) {res = res.filter(x => x.message.trim() !== 'unsolved goals')} + setDiagnostics(res ? res : undefined) console.log(res) }).catch((err) => { @@ -60,6 +72,7 @@ function Infoview({ editor, editorApi, leanClient } : {editor: monaco.editor.ISt }).then((res) => { // Check that there are no errors and no warnings setCompleted(!res.some(({severity}) => severity <= 2)) + setGlobalDiagnostics(res) }).catch((err) => { console.error(err) }) @@ -100,7 +113,8 @@ function Infoview({ editor, editorApi, leanClient } : {editor: monaco.editor.ISt }, [editor, leanClient, rpcSession]) return (
- +
) } diff --git a/client/src/components/TacticState.tsx b/client/src/components/TacticState.tsx index 0409b3e..d7c4488 100644 --- a/client/src/components/TacticState.tsx +++ b/client/src/components/TacticState.tsx @@ -96,10 +96,16 @@ function OtherGoal({ goal }) { ) } -function TacticState({ goals, diagnostics, completed }) { - const hasError = typeof diagnostics === "object" && diagnostics.length > 0 +function TacticState({ goals, diagnostics, completed, globalDiagnostics }) { const hasGoal = goals !== null && goals.length > 0 const hasManyGoal = hasGoal && goals.length > 1 + + if (!(hasGoal || completed) && globalDiagnostics) { + diagnostics = [{"severity" : 4, "message": "Showing global messages:"}, ...globalDiagnostics] + } + + const hasError = typeof diagnostics === "object" && diagnostics.length > 0 + return ( {completed && Level completed ! 🎉}