Spaces:
Paused
Paused
Commit
·
a02eccd
1
Parent(s):
3406d52
Update app/editor/index.tsx
Browse files- app/editor/index.tsx +14 -0
app/editor/index.tsx
CHANGED
@@ -4,6 +4,13 @@ import * as monaco from 'monaco-editor/esm/vs/editor/editor.api'
|
|
4 |
import { createConfiguredEditor } from 'vscode/monaco'
|
5 |
import './setup'
|
6 |
import 'monaco-editor/esm/vs/language/typescript/monaco.contribution'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
|
9 |
jsx: monaco.languages.typescript.JsxEmit.Preserve,
|
@@ -23,6 +30,13 @@ export default function Editor({ defaultValue }: { defaultValue: string }) {
|
|
23 |
automaticLayout: true,
|
24 |
})
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
return () => {
|
27 |
model.dispose()
|
28 |
editor.dispose()
|
|
|
4 |
import { createConfiguredEditor } from 'vscode/monaco'
|
5 |
import './setup'
|
6 |
import 'monaco-editor/esm/vs/language/typescript/monaco.contribution'
|
7 |
+
import MonacoEditorCopilot from './copilot';
|
8 |
+
|
9 |
+
const config = [
|
10 |
+
{
|
11 |
+
testName: 'example with dispose'
|
12 |
+
},
|
13 |
+
]
|
14 |
|
15 |
monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
|
16 |
jsx: monaco.languages.typescript.JsxEmit.Preserve,
|
|
|
30 |
automaticLayout: true,
|
31 |
})
|
32 |
|
33 |
+
const dispose = MonacoEditorCopilot(editor, { testName: 'basic example'} as any);
|
34 |
+
if (config[0]?.testName === 'example with dispose') {
|
35 |
+
setTimeout(() => {
|
36 |
+
dispose();
|
37 |
+
}, 1000);
|
38 |
+
}
|
39 |
+
|
40 |
return () => {
|
41 |
model.dispose()
|
42 |
editor.dispose()
|