From 41cc23543b9e0c61209b1894441a56c4786eaf1b Mon Sep 17 00:00:00 2001 From: Alexander Bentkamp Date: Thu, 2 Feb 2023 09:35:03 +0100 Subject: [PATCH] fix command line bug --- client/src/components/infoview/CommandLine.tsx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/client/src/components/infoview/CommandLine.tsx b/client/src/components/infoview/CommandLine.tsx index 27e6211..06960e4 100644 --- a/client/src/components/infoview/CommandLine.tsx +++ b/client/src/components/infoview/CommandLine.tsx @@ -28,12 +28,6 @@ export function CommandLine() { const allDiags = React.useContext(LspDiagnosticsContext) const diags = allDiags.get(editor.getModel().uri.toString()) - React.useEffect(() => { - if (hasErrorsOrWarnings(diags)) { - // alert("err") - } - }, []) - React.useEffect(() => { if (commandLineMode) { const endPos = editor.getModel().getFullModelRange().getEndPosition() @@ -50,14 +44,16 @@ export function CommandLine() { const handleSubmit : React.FormEventHandler = (ev) => { ev.preventDefault() + const pos = editor.getPosition() editor.executeEdits("command-line", [{ range: monaco.Selection.fromPositions( - editor.getPosition(), + pos, editor.getModel().getFullModelRange().getEndPosition() ), text: commandInput.current!.value + "\n", forceMoveMarkers: false }]); + editor.setPosition(pos) setProcessing(true) }