Skip to content

Commit

Permalink
checkpoint loading imports
Browse files Browse the repository at this point in the history
  • Loading branch information
seveibar committed Oct 7, 2024
1 parent 1f0347b commit 9b00431
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
Binary file modified bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"@tscircuit/3d-viewer": "^0.0.32",
"@tscircuit/pcb-viewer": "^1.10.5",
"@types/ms": "^0.7.34",
"@typescript/ata": "^0.9.7",
"@valtown/codemirror-ts": "^2.2.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
Expand Down
33 changes: 29 additions & 4 deletions src/components/CodeEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,44 @@ export const CodeEditor = ({
if (!editorRef.current) return

const fsMap = new Map<string, string>()
fsMap.set("index.ts", code)
fsMap.set("index.tsx", code)

// fsMap.set(
// "tscircuit-core.d.ts",
// `

// declare global {
// namespace JSX {
// interface IntrinsicElements {
// board: any
// }
// }
// }

// `.trim(),
// )

const system = createSystem(fsMap)
const env = createVirtualTypeScriptEnvironment(system, [], ts, {})
const env = createVirtualTypeScriptEnvironment(system, [], ts, {
jsx: ts.JsxEmit.ReactJSX,
// jsxFactory: "React.createElement",
})

// const program = ts.createProgram({
// rootNames: ["index.tsx"],
// options: {
// jsx: ts.JsxEmit.ReactJSX,
// },
// })

const path = "index.ts"
// program.emit()

const state = EditorState.create({
doc: code,
extensions: [
basicSetup,
javascript({ typescript: true, jsx: true }),
tsFacet.of({ env, path }),
tsFacet.of({ env, path: "index.tsx" }),
tsSync(),
tsLinter(),
autocompletion({ override: [tsAutocomplete()] }),
Expand Down

0 comments on commit 9b00431

Please sign in to comment.