diff --git a/apps/remix-ide/src/app/editor/editor.js b/apps/remix-ide/src/app/editor/editor.js index 247adbf391..9fe194eeab 100644 --- a/apps/remix-ide/src/app/editor/editor.js +++ b/apps/remix-ide/src/app/editor/editor.js @@ -48,7 +48,8 @@ class Editor extends Plugin { json: 'json', abi: 'json', rs: 'rust', - cairo: 'cairo' + cairo: 'cairo', + ts: 'typescript' } this.activated = false diff --git a/apps/remix-ide/src/remixAppManager.js b/apps/remix-ide/src/remixAppManager.js index eccf1690b5..2e21cdd66e 100644 --- a/apps/remix-ide/src/remixAppManager.js +++ b/apps/remix-ide/src/remixAppManager.js @@ -132,6 +132,7 @@ export class RemixAppManager extends PluginManager { } } return plugins.map(plugin => { + if (plugin.name === 'scriptRunner') plugin.url = 'http://127.0.0.1:8081' return new IframePlugin(plugin) // return new IframeReactPlugin(plugin) }) diff --git a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx index a684a411b7..da85eadf54 100644 --- a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx +++ b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx @@ -4,7 +4,7 @@ import Editor, { loader } from '@monaco-editor/react' import { reducerActions, reducerListener, initialState } from './actions/editor' import { language, conf } from './syntax' import { cairoLang, cairoConf } from './cairoSyntax' - +import { ethers } from 'ethers' import './remix-ui-editor.css' type cursorPosition = { @@ -223,6 +223,7 @@ export const EditorUI = (props: EditorUIProps) => { useEffect(() => { if (!monacoRef.current) return defineAndSetTheme(monacoRef.current) + monacoRef.current.languages.typescript.typescriptDefaults.addExtraLib('declare function require(module: string): any;') }) diff --git a/libs/remix-ui/workspace/src/lib/actions/index.ts b/libs/remix-ui/workspace/src/lib/actions/index.ts index ae248d6fa8..7e1a47e43a 100644 --- a/libs/remix-ui/workspace/src/lib/actions/index.ts +++ b/libs/remix-ui/workspace/src/lib/actions/index.ts @@ -252,7 +252,7 @@ export const runScript = async (path: string) => { if (error) { return dispatch(displayPopUp(error)) } - plugin.call('scriptRunner', 'execute', content) + plugin.call('scriptRunner', 'execute', content, path) }) } diff --git a/libs/remix-ui/workspace/src/lib/utils/index.ts b/libs/remix-ui/workspace/src/lib/utils/index.ts index 0dd70b14bc..ee3addda51 100644 --- a/libs/remix-ui/workspace/src/lib/utils/index.ts +++ b/libs/remix-ui/workspace/src/lib/utils/index.ts @@ -27,7 +27,7 @@ export const contextMenuActions: MenuItems = [{ }, { id: 'run', name: 'Run', - extension: ['.js'], + extension: ['.js', '.ts'], multiselect: false, label: '' }, {