close rpc sessions properly

pull/43/head
Alexander Bentkamp 4 years ago
parent ad6f907d17
commit 56bf360ef5

@ -25,7 +25,7 @@ function Infoview({ editor, editorApi, leanClient } : {editor: monaco.editor.ISt
const [globalDiagnostics, setGlobalDiagnostics] = useState<any[]>(undefined)
const [uri, setUri] = useState<string>()
console.log(rpcSession)
const fetchInteractiveGoals = () => {
if (editor && rpcSession) {
const pos = toLanguageServerPosition(editor.getPosition())
@ -84,6 +84,7 @@ function Infoview({ editor, editorApi, leanClient } : {editor: monaco.editor.ISt
checkCompleted()
const t = editor.onDidChangeModel((ev) => {
if (ev.newModelUrl) {
editorApi.closeRpcSession(rpcSession)
setRpcSession(undefined)
setUri(ev.newModelUrl.toString())
editorApi.createRpcSession(ev.newModelUrl.toString()).then((rpcSession) => {

Loading…
Cancel
Save