editor fixes

This commit is contained in:
Ruben Fiszel
2022-07-28 23:13:03 +02:00
parent a8d4b7d535
commit 900eb060bc
4 changed files with 35 additions and 15 deletions
+7 -2
View File
@@ -208,7 +208,7 @@
path: null,
tlsCertificate: null,
unsafelyIgnoreCertificateErrors: null,
unstable: false,
unstable: true,
enable: true,
cache: null,
codeLens: {
@@ -312,7 +312,7 @@
uri = `file:///${path}`
const model = monaco.editor.createModel(code, lang, monaco.Uri.parse(uri))
model.updateOptions({ tabSize: 4, insertSpaces: true })
model.updateOptions({ tabSize: 2, insertSpaces: true })
editor = monaco.editor.create(divEl as HTMLDivElement, {
model: model,
value: code,
@@ -370,6 +370,11 @@
}
if (lang == 'typescript') {
monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
target: monaco.languages.typescript.ScriptTarget.Latest,
allowNonTsExtensions: true,
noLib: true
})
if (deno) {
monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
noSemanticValidation: true,
+18 -7
View File
@@ -31,6 +31,8 @@
let websocketAlive = { pyright: false, black: false, deno: false }
let pickableProperties: Object | undefined = undefined
let bigEditor = false
$: schema = $schemasStore[i]
$: shouldPick = mod.value.path === '' && mod.value.language === undefined
$: pickableProperties = getPickableProperties($flowStore?.schema, args, $previewResults, mode, i)
@@ -98,13 +100,22 @@
<div class="p-1 overflow-hidden">
<EditorBar {editor} {websocketAlive} lang={mod.value.language ?? 'deno'} />
</div>
<Editor
bind:websocketAlive
bind:this={editor}
class="h-80 border p-2 rounded"
bind:code={mod.value.content}
deno={mod.value.language === FlowModuleValue.language.DENO}
/>
<div>
<Editor
bind:websocketAlive
bind:this={editor}
class="{bigEditor ? 'h-2/3' : 'h-80'} border p-2 rounded"
bind:code={mod.value.content}
deno={mod.value.language === FlowModuleValue.language.DENO}
automaticLayout={true}
/>
<button
class="w-full text-center"
on:click={() => {
bigEditor = !bigEditor
}}><Icon data={bigEditor ? faChevronUp : faChevronDown} scale={1.0} /></button
>
</div>
<div class="mt-2 mb-8">
<button class="default-primary-button-v2" on:click={() => loadSchema(i)}>
<Icon data={faRobot} class="w-4 h-4 mr-2 -ml-2" />
+7 -6
View File
@@ -51,7 +51,8 @@ export async function main() {
// 1. Get the last saved state
// let state = wmill.getInternalState()
// 2. Get the actual state from the external service
// let newState = useApiToFetchState()
// let newState = await (await fetch('https://hacker-news.firebaseio.com/v0/topstories.json')).json()
// console.log(newState)
// 3. Compare the two states and update the internal state if necessary
// wmill.setInternalState(newState)
// 4. Return the new ros
@@ -64,9 +65,9 @@ export async function main() {
`
export function initialCode(language: 'deno' | 'python3', is_trigger: boolean): string {
return language === 'deno'
? is_trigger
? DENO_INIT_CODE_TRIGGER
: DENO_INIT_CODE
: PYTHON_INIT_CODE
return language === 'deno'
? is_trigger
? DENO_INIT_CODE_TRIGGER
: DENO_INIT_CODE
: PYTHON_INIT_CODE
}
+3
View File
@@ -17,6 +17,9 @@ const config = {
minHeight: {
'1/2': '50vh'
},
height: {
'2/3': '66vh'
},
transitionProperty: {
'height': 'height'
}