Skip to content

Commit

Permalink
watch for language changes and update the editor
Browse files Browse the repository at this point in the history
  • Loading branch information
sadnub committed Oct 29, 2023
1 parent 57bd8ba commit 7dc2f5a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/scripts/ScriptFormModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@

<script setup lang="ts">
// composable imports
import { ref, reactive, computed, onMounted } from "vue";
import { ref, reactive, watch, computed, onMounted } from "vue";
import { useStore } from "vuex";
import { useQuasar, useDialogPluginComponent } from "quasar";
import { saveScript, editScript, downloadScript } from "@/api/scripts";
Expand Down Expand Up @@ -392,6 +392,11 @@ function loadEditor() {
script.script_body = r.code;
editor.setValue(r.code);
});
// watch for changes in language
watch(lang, () => {
monaco.editor.setModelLanguage(model, lang.value);
});
}
function unloadEditor() {
Expand Down

0 comments on commit 7dc2f5a

Please sign in to comment.