infoview
This commit is contained in:
@@ -12,6 +12,10 @@ import InputZone from './InputZone';
|
|||||||
import Message from './Message';
|
import Message from './Message';
|
||||||
import TacticState from './TacticState';
|
import TacticState from './TacticState';
|
||||||
import { LeanClient } from 'lean4web/client/src/editor/leanclient';
|
import { LeanClient } from 'lean4web/client/src/editor/leanclient';
|
||||||
|
import { AbbreviationProvider } from 'lean4web/client/src/editor/abbreviation/AbbreviationProvider';
|
||||||
|
import { AbbreviationRewriter } from 'lean4web/client/src/editor/abbreviation/rewriter/AbbreviationRewriter';
|
||||||
|
import { InfoProvider } from 'lean4web/client/src/editor/infoview';
|
||||||
|
import { renderInfoview } from '@leanprover/infoview'
|
||||||
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api.js'
|
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api.js'
|
||||||
|
|
||||||
interface LevelProps {
|
interface LevelProps {
|
||||||
@@ -33,6 +37,7 @@ function Level({ leanClient, nbLevels, level, setCurLevel, setLevelTitle, setFin
|
|||||||
const [lastTactic, setLastTactic] = useState("")
|
const [lastTactic, setLastTactic] = useState("")
|
||||||
const [errors, setErrors] = useState([])
|
const [errors, setErrors] = useState([])
|
||||||
const codeviewRef = useRef<HTMLDivElement>(null)
|
const codeviewRef = useRef<HTMLDivElement>(null)
|
||||||
|
const infoviewRef = useRef<HTMLDivElement>(null)
|
||||||
|
|
||||||
const [message, setMessage] = useState("")
|
const [message, setMessage] = useState("")
|
||||||
const [messageOpen, setMessageOpen] = useState(false)
|
const [messageOpen, setMessageOpen] = useState(false)
|
||||||
@@ -74,12 +79,13 @@ function Level({ leanClient, nbLevels, level, setCurLevel, setLevelTitle, setFin
|
|||||||
theme: 'vs-code-theme-converted'
|
theme: 'vs-code-theme-converted'
|
||||||
})
|
})
|
||||||
// setEditor(editor)
|
// setEditor(editor)
|
||||||
// new AbbreviationRewriter(new AbbreviationProvider(), model, editor)
|
new AbbreviationRewriter(new AbbreviationProvider(), model, editor)
|
||||||
|
|
||||||
|
const infoProvider = new InfoProvider(leanClient)
|
||||||
// const infoProvider = new InfoProvider(leanClient)
|
const div: HTMLElement = infoviewRef.current!
|
||||||
// const div: HTMLElement = infoviewRef.current!
|
const infoviewApi = renderInfoview(infoProvider.getApi(), div)
|
||||||
// const infoviewApi = renderInfoview(infoProvider.getApi(), div)
|
infoviewApi.serverRestarted(leanClient.initializeResult)
|
||||||
|
infoProvider.openPreview(editor, infoviewApi)
|
||||||
// setInfoProvider(infoProvider)
|
// setInfoProvider(infoProvider)
|
||||||
// setInfoviewApi(infoviewApi)
|
// setInfoviewApi(infoviewApi)
|
||||||
|
|
||||||
@@ -138,6 +144,7 @@ function Level({ leanClient, nbLevels, level, setCurLevel, setLevelTitle, setFin
|
|||||||
<Message isOpen={messageOpen} content={message} close={closeMessage} />
|
<Message isOpen={messageOpen} content={message} close={closeMessage} />
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid xs={4}>
|
<Grid xs={4}>
|
||||||
|
<div ref={infoviewRef} className="infoview"></div>
|
||||||
<TacticState goals={leanData.goals} errors={errors} lastTactic={lastTactic} completed={completed} />
|
<TacticState goals={leanData.goals} errors={errors} lastTactic={lastTactic} completed={completed} />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
Reference in New Issue
Block a user