fix command line bug

pull/43/head
Alexander Bentkamp 2 years ago
parent 73a44bd057
commit 41cc23543b

@ -28,12 +28,6 @@ export function CommandLine() {
const allDiags = React.useContext(LspDiagnosticsContext) const allDiags = React.useContext(LspDiagnosticsContext)
const diags = allDiags.get(editor.getModel().uri.toString()) const diags = allDiags.get(editor.getModel().uri.toString())
React.useEffect(() => {
if (hasErrorsOrWarnings(diags)) {
// alert("err")
}
}, [])
React.useEffect(() => { React.useEffect(() => {
if (commandLineMode) { if (commandLineMode) {
const endPos = editor.getModel().getFullModelRange().getEndPosition() const endPos = editor.getModel().getFullModelRange().getEndPosition()
@ -50,14 +44,16 @@ export function CommandLine() {
const handleSubmit : React.FormEventHandler<HTMLFormElement> = (ev) => { const handleSubmit : React.FormEventHandler<HTMLFormElement> = (ev) => {
ev.preventDefault() ev.preventDefault()
const pos = editor.getPosition()
editor.executeEdits("command-line", [{ editor.executeEdits("command-line", [{
range: monaco.Selection.fromPositions( range: monaco.Selection.fromPositions(
editor.getPosition(), pos,
editor.getModel().getFullModelRange().getEndPosition() editor.getModel().getFullModelRange().getEndPosition()
), ),
text: commandInput.current!.value + "\n", text: commandInput.current!.value + "\n",
forceMoveMarkers: false forceMoveMarkers: false
}]); }]);
editor.setPosition(pos)
setProcessing(true) setProcessing(true)
} }

Loading…
Cancel
Save