From 1cba96c40a79ae5bed0754f25f55f4b089289857 Mon Sep 17 00:00:00 2001
From: Jakob Stendahl <jakobste@uio.no>
Date: Thu, 21 Oct 2021 19:29:00 +0200
Subject: :construction: Fix tab width of editor

---
 src_frontend/Components/Editor/Editor.svelte | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

(limited to 'src_frontend/Components/Editor/Editor.svelte')

diff --git a/src_frontend/Components/Editor/Editor.svelte b/src_frontend/Components/Editor/Editor.svelte
index 1876bf6..fc5d589 100644
--- a/src_frontend/Components/Editor/Editor.svelte
+++ b/src_frontend/Components/Editor/Editor.svelte
@@ -4,13 +4,15 @@
 <script>
     import { onDestroy } from "svelte";
 	import { pop } from "svelte-spa-router";
-    import { EditorState, EditorView, basicSetup } from "@codemirror/basic-setup"
+    import { EditorState, basicSetup } from "@codemirror/basic-setup"
+    import { EditorView, keymap } from "@codemirror/view"
+    import { indentWithTab } from "@codemirror/commands"
+    import { indentUnit } from '@codemirror/language'
     import { python } from "@codemirror/lang-python"
     import { HighlightStyle, tags as t } from "@codemirror/highlight"
     import { notif } from "../../stores/notifs";
     import TopBar from "./TopBar.svelte";
     import Pane from "./Pane.svelte";
-    import ControlComponents from "../MainControls/ControlComponents.svelte";
     import Controls from "./Controls.svelte";
     import Output from "./Output.svelte";
     import Simulation from "./Simulation.svelte";
@@ -53,8 +55,10 @@
         codeEditorView = new EditorView({
             state: EditorState.create({
                 extensions: [
-                    basicSetup, 
+                    basicSetup,
+                    keymap.of([indentWithTab]),
                     python(),
+                    indentUnit.of("    "),
                     EditorView.updateListener.of(update => {
                         if (update.docChanged) {
                             codeEditorHasChanges = true;
-- 
cgit v1.2.3

