Skip to content
Snippets Groups Projects
Commit 6ce36f5e authored by Michele Alberti's avatar Michele Alberti
Browse files

[ivette] Fix ASTinfo behavior on server stop/reset.

parent 7d945bce
No related branches found
No related tags found
No related merge requests found
...@@ -79,19 +79,19 @@ const ASTinfo = () => { ...@@ -79,19 +79,19 @@ const ASTinfo = () => {
const buffer = React.useMemo(() => new RichTextBuffer(), []); const buffer = React.useMemo(() => new RichTextBuffer(), []);
const [select, setSelect] = States.useSelection(); const [select, setSelect] = States.useSelection();
const marker = select && select.marker; const marker = select && select.marker;
const data = States.useRequest('kernel.ast.info', marker || ''); const data = States.useRequest('kernel.ast.info', marker);
React.useEffect(() => { React.useEffect(() => {
buffer.clear();
if (data) { if (data) {
buffer.clear();
parseInfo(buffer, data); parseInfo(buffer, data);
} }
}, [buffer, data]); }, [buffer, data]);
// Callbacks // Callbacks
function onSelection(mark: any) { function onSelection(name: string) {
// For now, the only markers are functions. // For now, the only markers are functions.
setSelect({ function: mark }); setSelect({ function: name });
} }
// Component // Component
......
...@@ -33,7 +33,7 @@ const PP = new Dome.PP('AST View'); ...@@ -33,7 +33,7 @@ const PP = new Dome.PP('AST View');
// --- Rich Text Printer // --- Rich Text Printer
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
const printAST = (buffer: any, text: string) => { const printAST = (buffer: RichTextBuffer, text: string) => {
if (Array.isArray(text)) { if (Array.isArray(text)) {
const tag = text.shift(); const tag = text.shift();
if (tag !== '') { if (tag !== '') {
...@@ -48,7 +48,9 @@ const printAST = (buffer: any, text: string) => { ...@@ -48,7 +48,9 @@ const printAST = (buffer: any, text: string) => {
} }
}; };
async function loadAST(buffer: any, theFunction?: string, theMarker?: string) { async function loadAST(
buffer: RichTextBuffer, theFunction?: string, theMarker?: string,
) {
buffer.clear(); buffer.clear();
if (theFunction) { if (theFunction) {
buffer.log('// Loading', theFunction, ''); buffer.log('// Loading', theFunction, '');
...@@ -124,7 +126,6 @@ const ASTview = () => { ...@@ -124,7 +126,6 @@ const ASTview = () => {
} }
// Theme Popup // Theme Popup
const selectTheme = (id?: string) => id && setTheme(id); const selectTheme = (id?: string) => id && setTheme(id);
const checkTheme = const checkTheme =
(th: { id: string }) => ({ checked: th.id === theme, ...th }); (th: { id: string }) => ({ checked: th.id === theme, ...th });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment