This commit is contained in:
Ruben Fiszel
2023-12-22 07:59:13 +01:00
parent d634764b34
commit 279a5686d1
9 changed files with 35 additions and 29 deletions
+15 -13
View File
@@ -96,19 +96,21 @@ export const setupTypeAcquisition = (config: ATABootstrapConfig) => {
// Make it so it won't get re-downloaded
depsToGet.forEach((dep) => moduleMap.set(dep.raw, { state: 'loading' }))
const relativeDeps = depsToGet.filter((f) => isRelativePath(f.raw))
relativeDeps.forEach(async (f) => {
let path = f.raw.startsWith('/')
? ''
: '/' + config.scriptPath + (f.raw.startsWith('../') ? '/../' : '/.') + f.raw
let url = config.root + path
console.log('path', config.scriptPath, path, url)
const res = await fetch(url)
if (res.ok) {
config.delegate.localFile?.(await res.text(), f.raw)
}
})
depsToGet = depsToGet.filter((f) => !isRelativePath(f.raw))
if (depth == 0) {
const relativeDeps = depsToGet.filter((f) => isRelativePath(f.raw))
relativeDeps.forEach(async (f) => {
let path = f.raw.startsWith('/')
? ''
: '/' + config.scriptPath + (f.raw.startsWith('../') ? '/../' : '/.') + f.raw
let url = config.root + path
console.log('path', config.scriptPath, path, url)
const res = await fetch(url)
if (res.ok) {
config.delegate.localFile?.(await res.text(), f.raw)
}
})
depsToGet = depsToGet.filter((f) => !isRelativePath(f.raw))
}
// Grab the module trees which gives us a list of files to download
const trees = await Promise.all(
+10 -3
View File
@@ -770,7 +770,11 @@
const path = 'file://' + _path
let uri = mUri.parse(path)
languages.typescript.javascriptDefaults.addExtraLib(code, path)
await vscode.workspace.fs.writeFile(uri, new TextEncoder().encode(code))
try {
await vscode.workspace.fs.writeFile(uri, new TextEncoder().encode(code))
} catch (e) {
console.log('error writing file', e)
}
}
const addLocalFile = async (code: string, _path: string) => {
@@ -982,7 +986,7 @@
websocketInterval && clearInterval(websocketInterval)
}
let widgets: HTMLElement | undefined = document.getElementById('monaco-widgets-root') ?? undefined
// let widgets: HTMLElement | undefined = document.getElementById('monaco-widgets-root') ?? undefined
let model: meditor.ITextModel | undefined = undefined
let monacoBinding: MonacoBinding | undefined = undefined
@@ -1089,7 +1093,7 @@
...editorConfig(code, lang, automaticLayout, fixedOverflowWidgets),
model,
fontSize: !small ? 14 : 12,
overflowWidgetsDomNode: widgets,
// overflowWidgetsDomNode: widgets,
tabSize: lang == 'python' ? 4 : 2,
folding
})
@@ -1114,10 +1118,12 @@
})
editor.onDidBlurEditorText(() => {
console.log('blur')
dispatch('blur')
})
editor.onDidFocusEditorText(() => {
console.log('focus')
dispatch('focus')
editor.addCommand(KeyMod.CtrlCmd | KeyCode.KeyS, function () {
@@ -1207,6 +1213,7 @@
let root = hostname + '/api/scripts_u/tokened_raw/' + $workspaceStore + '/' + token
return root
}
console.log('FOO')
</script>
<EditorTheme />
@@ -94,10 +94,7 @@
)
arg.type = 'javascript'
propertyType = 'static'
console.log('A')
} else {
console.log('B')
if (arg.type === 'javascript' && propertyType === 'static') {
arg.type = 'static'
}
@@ -162,13 +162,13 @@
model = nmodel
}
model.updateOptions(updateOptions)
let widgets: HTMLElement | undefined =
document.getElementById('monaco-widgets-root') ?? undefined
// let widgets: HTMLElement | undefined =
// document.getElementById('monaco-widgets-root') ?? undefined
editor = meditor.create(divEl as HTMLDivElement, {
...editorConfig(code, lang, automaticLayout, fixedOverflowWidgets),
model,
overflowWidgetsDomNode: widgets,
// overflowWidgetsDomNode: widgets,
fontSize: small ? 12 : 14
})
@@ -407,7 +407,7 @@
let extraModel
let width = 0
let widgets: HTMLElement | undefined = document.getElementById('monaco-widgets-root') ?? undefined
// let widgets: HTMLElement | undefined = document.getElementById('monaco-widgets-root') ?? undefined
let initialized = false
@@ -447,7 +447,7 @@
editor = meditor.create(divEl as HTMLDivElement, {
...editorConfig(code, lang, automaticLayout, fixedOverflowWidgets),
model,
overflowWidgetsDomNode: widgets,
// overflowWidgetsDomNode: widgets,
lineNumbers: 'off',
fontSize,
suggestOnTriggerCharacters: true,
@@ -165,6 +165,8 @@
</Button>
</div>
</ConfirmationModal>
<!-- <div id="monaco-widgets-root" class="monaco-editor" style="z-index: 1200;" /> -->
<Drawer
bind:this={scriptEditorDrawer}
size="1200px"
@@ -188,7 +190,7 @@
noSyncFromGithub
lang={script.language}
path={script.path}
fixedOverflowWidgets={true}
fixedOverflowWidgets={false}
bind:code={script.content}
bind:schema={script.schema}
tag={undefined}
@@ -161,8 +161,6 @@
nodes = layered.nodes
console.log(flatNodes, nodes)
let hfull = Math.max(layered.height, minHeight)
fullWidth = layered.width
height = fullSize ? hfull : Math.min(hfull, maxHeight ?? window.innerHeight * 1.5)
@@ -116,7 +116,7 @@
let flowBuilder: FlowBuilder | undefined = undefined
</script>
<div id="monaco-widgets-root" class="monaco-editor" style="z-index: 1200;" />
<!-- <div id="monaco-widgets-root" class="monaco-editor" style="z-index: 1200;" /> -->
<FlowBuilder
on:saveInitial={(e) => {
@@ -189,7 +189,7 @@
}
</script>
<div id="monaco-widgets-root" class="monaco-editor" style="z-index: 1200;" />
<!-- <div id="monaco-widgets-root" class="monaco-editor" style="z-index: 1200;" /> -->
<DiffDrawer bind:this={diffDrawer} {restoreDeployed} {restoreDraft} />
<FlowBuilder