mirror of
https://github.com/bendtherules/completion-viz.git
synced 2026-08-18 21:52:36 +00:00
Add empty CompletionViewer
This commit is contained in:
+5
-2
@@ -14,13 +14,16 @@ World!\`; abc()`;
|
|||||||
function App() {
|
function App() {
|
||||||
const [inputCode, setInputCode] = useState<string>(sampleInputCode);
|
const [inputCode, setInputCode] = useState<string>(sampleInputCode);
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
// useLayoutEffect(() => {
|
||||||
runEngine(inputCode);
|
runEngine(inputCode);
|
||||||
}, [inputCode]);
|
// }, [inputCode]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<SourceViewer code={inputCode} onChangeCode={setInputCode} />
|
<SourceViewer code={inputCode} onChangeCode={setInputCode} />
|
||||||
|
<CompletionViewer
|
||||||
|
completionDetails={completionMapping.completionDetails}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1,7 @@
|
|||||||
export function CompletionViewer() {}
|
import { ICompletionDetail } from "../../logic/completionMapping";
|
||||||
|
|
||||||
|
export function CompletionViewer(props: {
|
||||||
|
completionDetails: ICompletionDetail[];
|
||||||
|
}) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Node } from "acorn";
|
import { Node } from "acorn";
|
||||||
import { inspect } from "../../engine262/dist/engine262";
|
import { inspect } from "../engine262/dist/engine262";
|
||||||
|
|
||||||
import { CompletionRecord, CompletionTypes } from "../types/engine262-stubs";
|
import { CompletionRecord, CompletionTypes } from "../types/engine262-stubs";
|
||||||
|
|
||||||
@@ -7,7 +7,7 @@ export interface ICompletionDetail {
|
|||||||
start: number;
|
start: number;
|
||||||
end: number;
|
end: number;
|
||||||
completionType: CompletionTypes;
|
completionType: CompletionTypes;
|
||||||
completionValueString: string;
|
completionValueString: string | undefined;
|
||||||
completionTargetString: string | undefined;
|
completionTargetString: string | undefined;
|
||||||
completionValue: any;
|
completionValue: any;
|
||||||
}
|
}
|
||||||
@@ -26,7 +26,8 @@ export const completionMapping: {
|
|||||||
Target: completionTarget,
|
Target: completionTarget,
|
||||||
} = result;
|
} = result;
|
||||||
|
|
||||||
const completionValueString: string = inspect(completionValue);
|
const completionValueString: string | undefined =
|
||||||
|
completionValue !== undefined ? inspect(completionValue) : undefined;
|
||||||
const completionTargetString: string | undefined =
|
const completionTargetString: string | undefined =
|
||||||
completionTarget !== undefined
|
completionTarget !== undefined
|
||||||
? inspect(completionTarget)
|
? inspect(completionTarget)
|
||||||
|
|||||||
Reference in New Issue
Block a user