hide command line in "other goals"

Fixes #30
pull/43/head
Alexander Bentkamp 2 years ago
parent 278aedb20c
commit 7510b83591

@ -118,13 +118,14 @@ interface GoalProps {
goal: InteractiveGoal goal: InteractiveGoal
filter: GoalFilterState filter: GoalFilterState
showHints?: boolean showHints?: boolean
commandLine: boolean
} }
/** /**
* Displays the hypotheses, target type and optional case label of a goal according to the * Displays the hypotheses, target type and optional case label of a goal according to the
* provided `filter`. */ * provided `filter`. */
export const Goal = React.memo((props: GoalProps) => { export const Goal = React.memo((props: GoalProps) => {
const { goal, filter, showHints } = props const { goal, filter, showHints, commandLine } = props
const filteredList = getFilteredHypotheses(goal.hyps, filter); const filteredList = getFilteredHypotheses(goal.hyps, filter);
const hyps = filter.reverse ? filteredList.slice().reverse() : filteredList; const hyps = filter.reverse ? filteredList.slice().reverse() : filteredList;
@ -159,7 +160,7 @@ export const Goal = React.memo((props: GoalProps) => {
{ assumptionHyps.length > 0 && { assumptionHyps.length > 0 &&
<div className="hyp-group"><div className="hyp-group-title">Assumptions:</div> <div className="hyp-group"><div className="hyp-group-title">Assumptions:</div>
{assumptionHyps.map((h, i) => <Hyp hyp={h} mvarId={goal.mvarId} key={i} />)}</div> } {assumptionHyps.map((h, i) => <Hyp hyp={h} mvarId={goal.mvarId} key={i} />)}</div> }
{commandLineMode && <CommandLine />} {commandLine && commandLineMode && <CommandLine />}
{!filter.reverse && goalLi} {!filter.reverse && goalLi}
{showHints && hints} {showHints && hints}
</div> </div>
@ -175,7 +176,7 @@ export function Goals({ goals, filter }: GoalsProps) {
return <>No goals</> return <>No goals</>
} else { } else {
return <> return <>
{goals.goals.map((g, i) => <Goal key={i} goal={g} filter={filter} />)} {goals.goals.map((g, i) => <Goal commandLine={false} key={i} goal={g} filter={filter} />)}
</> </>
} }
} }

@ -16,6 +16,7 @@ import { PanelWidgetDisplay } from '../../../../node_modules/lean4-infoview/src/
import { RpcContext, useRpcSessionAtPos } from '../../../../node_modules/lean4-infoview/src/infoview/rpcSessions'; import { RpcContext, useRpcSessionAtPos } from '../../../../node_modules/lean4-infoview/src/infoview/rpcSessions';
import { GoalsLocation, Locations, LocationsContext } from '../../../../node_modules/lean4-infoview/src/infoview/goalLocation'; import { GoalsLocation, Locations, LocationsContext } from '../../../../node_modules/lean4-infoview/src/infoview/goalLocation';
import { InteractiveCode } from '../../../../node_modules/lean4-infoview/src/infoview/interactiveCode' import { InteractiveCode } from '../../../../node_modules/lean4-infoview/src/infoview/interactiveCode'
import { Troubleshoot } from '@mui/icons-material';
type InfoStatus = 'updating' | 'error' | 'ready'; type InfoStatus = 'updating' | 'error' | 'ready';
type InfoKind = 'cursor' | 'pin'; type InfoKind = 'cursor' | 'pin';
@ -123,7 +124,7 @@ const InfoDisplayContent = React.memo((props: InfoDisplayContentProps) => {
<div className="goals-section"> <div className="goals-section">
{ goals && goals.goals.length > 0 { goals && goals.goals.length > 0
? <><div className="goals-section-title">Main Goal</div> ? <><div className="goals-section-title">Main Goal</div>
<Goal filter={goalFilter} key='mainGoal' goal={goals.goals[0]} showHints={true} /></> <Goal commandLine={true} filter={goalFilter} key='mainGoal' goal={goals.goals[0]} showHints={true} /></>
: <div className="goals-section-title">No Goals</div> } : <div className="goals-section-title">No Goals</div> }
</div> </div>
</LocationsContext.Provider> </LocationsContext.Provider>
@ -149,7 +150,7 @@ const InfoDisplayContent = React.memo((props: InfoDisplayContentProps) => {
<div className="goals-section-title">Other Goals</div> <div className="goals-section-title">Other Goals</div>
{goals.goals.slice(1).map((goal, i) => {goals.goals.slice(1).map((goal, i) =>
<details key={i}><summary><InteractiveCode fmt={goal.type} /></summary> <Goal filter={goalFilter} goal={goal} /></details>)} <details key={i}><summary><InteractiveCode fmt={goal.type} /></summary> <Goal commandLine={false} filter={goalFilter} goal={goal} /></details>)}
</div>} </div>}
</LocationsContext.Provider> </LocationsContext.Provider>
</> </>

Loading…
Cancel
Save