Skip to content

Commit

Permalink
Merge #222
Browse files Browse the repository at this point in the history
222: dada-web: show diagnostics in output r=nikomatsakis a=vemoo

In #221 I found out that diagnostics were not being shown in the playground.

Co-authored-by: Bernardo Uriarte <berublan@gmail.com>
  • Loading branch information
bors[bot] and vemoo authored Oct 13, 2022
2 parents 79e34a4 + ebc9e4e commit 38663e8
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions book/src/components/Ide/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import Col from "react-bootstrap/Col";
import Row from "react-bootstrap/Row";
import { default as AnsiUp } from "ansi_up";
import Container from "react-bootstrap/Container";
import Stack from "react-bootstrap/Stack";
import Button from "react-bootstrap/Button";

import dadaWeb, { compiler } from "dada-web";
Expand Down Expand Up @@ -153,7 +152,6 @@ function Ide(props: { mini: boolean; sourceText: string }) {
const [cursor, setCursor] = useState<Cursor>({ row: 0, column: 0 });
const [source, setSource] = useState<string>(props.sourceText);
const [status, setStatus] = useState<string>("");
const [diagnostics, setDiagnostics] = useState<string>("");
const [output, setOutput] = useState<string>("");
const [heaps, setHeaps] = useState<[string, string]>(["", ""]);
useEffect(() => {
Expand All @@ -175,10 +173,9 @@ function Ide(props: { mini: boolean; sourceText: string }) {
await dada.execute();
break;
}
const html = new AnsiUp().ansi_to_html(dada.output);
const html = new AnsiUp().ansi_to_html(dada.diagnostics + dada.output);
setOutput(html);
setHeaps([dada.heaps[0], dada.heaps[1]]);
setDiagnostics(dada.diagnostics);
});
}, [cursor, dada, source, outputMode]);

Expand Down

0 comments on commit 38663e8

Please sign in to comment.