Merge branch 'master' into pastedCodeSafety

pull/5344/head
Liana Husikyan 3 weeks ago committed by GitHub
commit def0f7d0d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      apps/remix-dapp/src/locales/en/udapp.json
  2. 2
      apps/remix-dapp/src/locales/zh/udapp.json
  3. 15
      apps/remix-ide-e2e/src/commands/selectContract.ts
  4. 6
      apps/remix-ide-e2e/src/tests/terminal.test.ts
  5. 84
      apps/remix-ide/src/app.ts
  6. 2
      apps/remix-ide/src/app/components/main-panel.tsx
  7. 2
      apps/remix-ide/src/app/components/plugin-manager-component.js
  8. 2
      apps/remix-ide/src/app/components/popup-panel.tsx
  9. 4
      apps/remix-ide/src/app/editor/editor.js
  10. 2
      apps/remix-ide/src/app/files/dgitProvider.ts
  11. 2
      apps/remix-ide/src/app/files/fileManager.ts
  12. 2
      apps/remix-ide/src/app/files/remixDProvider.js
  13. 2
      apps/remix-ide/src/app/files/workspaceFileProvider.js
  14. 2
      apps/remix-ide/src/app/panels/file-panel.js
  15. 2
      apps/remix-ide/src/app/panels/layout.ts
  16. 2
      apps/remix-ide/src/app/panels/tab-proxy.js
  17. 3
      apps/remix-ide/src/app/panels/terminal.tsx
  18. 2
      apps/remix-ide/src/app/tabs/analysis-tab.js
  19. 2
      apps/remix-ide/src/app/tabs/compile-tab.js
  20. 2
      apps/remix-ide/src/app/tabs/debugger-tab.js
  21. 2
      apps/remix-ide/src/app/tabs/settings-tab.tsx
  22. 2
      apps/remix-ide/src/app/tabs/test-tab.js
  23. 22
      libs/remix-ui/plugin-manager/src/types.d.ts
  24. 2
      libs/remix-ui/run-tab/src/lib/actions/deploy.ts
  25. 4
      libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx
  26. 4
      libs/remix-ui/search/src/lib/context/context.tsx
  27. 7
      libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx
  28. 12
      libs/remix-ui/workspace/src/lib/types/index.ts

@ -26,7 +26,7 @@
"udapp.contractOptionsTitle2": "Select a compiled contract to deploy or to use with At Address.", "udapp.contractOptionsTitle2": "Select a compiled contract to deploy or to use with At Address.",
"udapp.contractOptionsTitle3": "Select and compile *.sol file to deploy or access a contract.", "udapp.contractOptionsTitle3": "Select and compile *.sol file to deploy or access a contract.",
"udapp.contractOptionsTitle4": "When there is a compiled .sol file, choose the contract to deploy or to use with At Address.", "udapp.contractOptionsTitle4": "When there is a compiled .sol file, choose the contract to deploy or to use with At Address.",
"udapp.checkSumWarning": "It seems you are not using a checksumed address.A checksummed address is an address that contains uppercase letters, as specified in {a}.Checksummed addresses are meant to help prevent users from sending transactions to the wrong address.", "udapp.checkSumWarning": "It seems you are not using a checksummed address.A checksummed address is an address that contains uppercase letters, as specified in {a}.Checksummed addresses are meant to help prevent users from sending transactions to the wrong address.",
"udapp.isOverSizePromptEip170": "Contract creation initialization returns data with length of more than 24576 bytes. The deployment will likely fail if the current network has activated the eip 170. More info: {a}", "udapp.isOverSizePromptEip170": "Contract creation initialization returns data with length of more than 24576 bytes. The deployment will likely fail if the current network has activated the eip 170. More info: {a}",
"udapp.isOverSizePromptEip3860": "Contract creation init code exceeds the allowed max code size of 49152 bytes. The deployment will likely fail if the current network has activated the eip 3860. More info: {a}", "udapp.isOverSizePromptEip3860": "Contract creation init code exceeds the allowed max code size of 49152 bytes. The deployment will likely fail if the current network has activated the eip 3860. More info: {a}",
"udapp.thisContractMayBeAbstract": "This contract may be abstract, it may not implement an abstract parent's methods completely or it may not invoke an inherited contract's constructor correctly.", "udapp.thisContractMayBeAbstract": "This contract may be abstract, it may not implement an abstract parent's methods completely or it may not invoke an inherited contract's constructor correctly.",

@ -23,7 +23,7 @@
"udapp.contractOptionsTitle2": "选择要部署或与 At Address 一起使用的已编译合约。", "udapp.contractOptionsTitle2": "选择要部署或与 At Address 一起使用的已编译合约。",
"udapp.contractOptionsTitle3": "选择并编译 *.sol 文件以部署或访问合约。", "udapp.contractOptionsTitle3": "选择并编译 *.sol 文件以部署或访问合约。",
"udapp.contractOptionsTitle4": "当有编译的 .sol 文件时,选择 {br} 合约进行部署或与 AtAddress 一起使用。", "udapp.contractOptionsTitle4": "当有编译的 .sol 文件时,选择 {br} 合约进行部署或与 AtAddress 一起使用。",
"udapp.checkSumWarning": "您似乎没有使用 checksumed address 。{br} checksumed address 是包含大写字母的地址,如 {a} 中所指定。{br} checksumed address 旨在帮助防止用户将交易发送到错误地址。", "udapp.checkSumWarning": "您似乎没有使用 checksummed address 。{br} checksummed address 是包含大写字母的地址,如 {a} 中所指定。{br} checksummed address 旨在帮助防止用户将交易发送到错误地址。",
"udapp.isOverSizePromptEip170": "合约创建初始化返回长度超过24576字节的数据。部署可能会失败。 {br}更多信息:{a}", "udapp.isOverSizePromptEip170": "合约创建初始化返回长度超过24576字节的数据。部署可能会失败。 {br}更多信息:{a}",
"udapp.isOverSizePromptEip3860": "合约创建初始化代码超出了允许的最大代码大小 49152 字节。如果当前网络已激活 eip 3860,则部署可能会失败。更多信息:{a}", "udapp.isOverSizePromptEip3860": "合约创建初始化代码超出了允许的最大代码大小 49152 字节。如果当前网络已激活 eip 3860,则部署可能会失败。更多信息:{a}",
"udapp.thisContractMayBeAbstract": "这个合约可能是抽象的,它可能没有完全实现抽象父类的方法,或者它可能没有正确调用继承合约的构造函数。", "udapp.thisContractMayBeAbstract": "这个合约可能是抽象的,它可能没有完全实现抽象父类的方法,或者它可能没有正确调用继承合约的构造函数。",

@ -5,18 +5,13 @@ const selector = '.udapp_contractNames'
class SelectContract extends EventEmitter { class SelectContract extends EventEmitter {
command(this: NightwatchBrowser, contractName: string): NightwatchBrowser { command(this: NightwatchBrowser, contractName: string): NightwatchBrowser {
this.api.waitForElementVisible(selector).perform((done) => { this.api
selectContract(this.api, contractName, () => { .waitForElementVisible(selector)
done() .waitForElementPresent(`${selector} option[value="${contractName}"]`)
this.emit('complete') .click(`${selector} option[value="${contractName}"]`)
}) .perform(() => this.emit('complete'))
})
return this return this
} }
} }
function selectContract (browser: NightwatchBrowser, contractName: string, callback: VoidFunction) {
browser.click(`${selector} option[value="${contractName}"]`).perform(() => callback())
}
module.exports = SelectContract module.exports = SelectContract

@ -209,11 +209,7 @@ module.exports = {
.createContract('') .createContract('')
.getAddressAtPosition(0, (address) => { .getAddressAtPosition(0, (address) => {
addressRef = address addressRef = address
})
.perform((done) => {
browser.addFile('scripts/test_filtering_event.ts', { content: test_filtering_event.replace('<ADDRESS>', addressRef) }) browser.addFile('scripts/test_filtering_event.ts', { content: test_filtering_event.replace('<ADDRESS>', addressRef) })
.perform(() => done())
})
.executeScriptInTerminal('remix.execute(\'scripts/test_filtering_event.ts\')') .executeScriptInTerminal('remix.execute(\'scripts/test_filtering_event.ts\')')
.pause(1000) .pause(1000)
.waitForElementContainsText('*[data-id="terminalJournal"]', '1') .waitForElementContainsText('*[data-id="terminalJournal"]', '1')
@ -221,6 +217,8 @@ module.exports = {
.executeScriptInTerminal('remix.execute(\'scripts/test_filtering_event.ts\')') // re-emit the event .executeScriptInTerminal('remix.execute(\'scripts/test_filtering_event.ts\')') // re-emit the event
.waitForElementContainsText('*[data-id="terminalJournal"]', '2') .waitForElementContainsText('*[data-id="terminalJournal"]', '2')
.waitForElementContainsText('*[data-id="terminalJournal"]', 'false') .waitForElementContainsText('*[data-id="terminalJournal"]', 'false')
})
}, },
'Should display auto-complete menu #group4': function (browser: NightwatchBrowser) { 'Should display auto-complete menu #group4': function (browser: NightwatchBrowser) {

@ -72,9 +72,9 @@ import { Matomo } from './app/plugins/matomo'
import { TemplatesSelectionPlugin } from './app/plugins/templates-selection/templates-selection-plugin' import { TemplatesSelectionPlugin } from './app/plugins/templates-selection/templates-selection-plugin'
const isElectron = require('is-electron') import isElectron from 'is-electron'
const remixLib = require('@remix-project/remix-lib') import * as remixLib from '@remix-project/remix-lib'
import { QueryParams } from '@remix-project/remix-lib' import { QueryParams } from '@remix-project/remix-lib'
import { SearchPlugin } from './app/tabs/search' import { SearchPlugin } from './app/tabs/search'
@ -82,27 +82,27 @@ import { ScriptRunnerUIPlugin } from './app/tabs/script-runner-ui'
import { ElectronProvider } from './app/files/electronProvider' import { ElectronProvider } from './app/files/electronProvider'
const Storage = remixLib.Storage const Storage = remixLib.Storage
const RemixDProvider = require('./app/files/remixDProvider') import RemixDProvider from './app/files/remixDProvider'
const Config = require('./config') import Config from './config'
const FileManager = require('./app/files/fileManager') import FileManager from './app/files/fileManager'
import FileProvider from "./app/files/fileProvider" import FileProvider from "./app/files/fileProvider"
import { appPlatformTypes } from '@remix-ui/app' import { appPlatformTypes } from '@remix-ui/app'
const DGitProvider = require('./app/files/dgitProvider') import DGitProvider from './app/files/dgitProvider'
const WorkspaceFileProvider = require('./app/files/workspaceFileProvider') import WorkspaceFileProvider from './app/files/workspaceFileProvider'
const PluginManagerComponent = require('./app/components/plugin-manager-component') import PluginManagerComponent from './app/components/plugin-manager-component'
const CompileTab = require('./app/tabs/compile-tab') import CompileTab from './app/tabs/compile-tab'
const SettingsTab = require('./app/tabs/settings-tab') import SettingsTab from './app/tabs/settings-tab'
const AnalysisTab = require('./app/tabs/analysis-tab') import AnalysisTab from './app/tabs/analysis-tab'
const { DebuggerTab } = require('./app/tabs/debugger-tab') import DebuggerTab from './app/tabs/debugger-tab'
const TestTab = require('./app/tabs/test-tab') import TestTab from './app/tabs/test-tab'
const FilePanel = require('./app/panels/file-panel') import Filepanel from './app/panels/file-panel'
const Editor = require('./app/editor/editor') import Editor from './app/editor/editor'
const Terminal = require('./app/panels/terminal') import Terminal from './app/panels/terminal'
const { TabProxy } = require('./app/panels/tab-proxy.js') import TabProxy from './app/panels/tab-proxy.js'
const _paq = (window._paq = window._paq || []) const _paq = (window._paq = window._paq || [])
@ -115,16 +115,49 @@ export class platformApi {
} }
} }
type Components = {
filesProviders: {
browser?: any
localhost?: any
workspace?: any
electron?: any
}
}
class AppComponent { class AppComponent {
appManager: RemixAppManager
queryParams: QueryParams
private _components: Components
panels: any
workspace: any
engine: RemixEngine
matomoConfAlreadySet: any
matomoCurrentSetting: any
showMatomo: boolean
walkthroughService: WalkthroughService
platform: 'desktop' | 'web'
gistHandler: GistHandler
themeModule: ThemeModule
localeModule: LocaleModule
notification: NotificationPlugin
layout: Layout
mainview: any
menuicons: VerticalIcons
sidePanel: SidePanel
hiddenPanel: HiddenPanel
pinnedPanel: PinnedPanel
popupPanel: PopupPanel
statusBar: StatusBar
settings: SettingsTab
constructor() { constructor() {
const PlatFormAPi = new platformApi() const PlatFormAPi = new platformApi()
Registry.getInstance().put({ Registry.getInstance().put({
api: PlatFormAPi, api: PlatFormAPi,
name: 'platform' name: 'platform'
}) })
this.appManager = new RemixAppManager({}) this.appManager = new RemixAppManager()
this.queryParams = new QueryParams() this.queryParams = new QueryParams()
this._components = {} this._components = {} as Components
// setup storage // setup storage
const configStorage = new Storage('config-v0.8:') const configStorage = new Storage('config-v0.8:')
@ -161,7 +194,6 @@ class AppComponent {
name: 'fileproviders' name: 'fileproviders'
}) })
} }
async run() { async run() {
@ -184,7 +216,7 @@ class AppComponent {
this.matomoConfAlreadySet = Registry.getInstance().get('config').api.exists('settings/matomo-analytics') this.matomoConfAlreadySet = Registry.getInstance().get('config').api.exists('settings/matomo-analytics')
this.matomoCurrentSetting = Registry.getInstance().get('config').api.get('settings/matomo-analytics') this.matomoCurrentSetting = Registry.getInstance().get('config').api.get('settings/matomo-analytics')
let electronTracking = window.electronAPI ? await window.electronAPI.canTrackMatomo() : false const electronTracking = (window as any).electronAPI ? await (window as any).electronAPI.canTrackMatomo() : false
const lastMatomoCheck = window.localStorage.getItem('matomo-analytics-consent') const lastMatomoCheck = window.localStorage.getItem('matomo-analytics-consent')
const sixMonthsAgo = new Date(); const sixMonthsAgo = new Date();
@ -456,10 +488,10 @@ class AppComponent {
this.popupPanel = new PopupPanel() this.popupPanel = new PopupPanel()
const pluginManagerComponent = new PluginManagerComponent(appManager, this.engine) const pluginManagerComponent = new PluginManagerComponent(appManager, this.engine)
const filePanel = new FilePanel(appManager, contentImport) const filePanel = new Filepanel(appManager, contentImport)
this.statusBar = new StatusBar(filePanel, this.menuicons) this.statusBar = new StatusBar(filePanel, this.menuicons)
const landingPage = new LandingPage(appManager, this.menuicons, fileManager, filePanel, contentImport) const landingPage = new LandingPage(appManager, this.menuicons, fileManager, filePanel, contentImport)
this.settings = new SettingsTab(Registry.getInstance().get('config').api, editor, appManager) this.settings = new SettingsTab(Registry.getInstance().get('config').api, editor)//, appManager)
this.engine.register([this.menuicons, landingPage, this.hiddenPanel, this.sidePanel, this.statusBar, filePanel, pluginManagerComponent, this.settings, this.pinnedPanel, this.popupPanel]) this.engine.register([this.menuicons, landingPage, this.hiddenPanel, this.sidePanel, this.statusBar, filePanel, pluginManagerComponent, this.settings, this.pinnedPanel, this.popupPanel])
@ -514,7 +546,7 @@ class AppComponent {
async activate() { async activate() {
const queryParams = new QueryParams() const queryParams = new QueryParams()
const params = queryParams.get() const params: any = queryParams.get()
try { try {
this.engine.register(await this.appManager.registeredPlugins()) this.engine.register(await this.appManager.registeredPlugins())
@ -610,10 +642,11 @@ class AppComponent {
} }
if (params.call) { if (params.call) {
const callDetails = params.call.split('//') const callDetails: any = params.call.split('//')
if (callDetails.length > 1) { if (callDetails.length > 1) {
this.appManager.call('notification', 'toast', `initiating ${callDetails[0]} and calling "${callDetails[1]}" ...`) this.appManager.call('notification', 'toast', `initiating ${callDetails[0]} and calling "${callDetails[1]}" ...`)
// @todo(remove the timeout when activatePlugin is on 0.3.0) // @todo(remove the timeout when activatePlugin is on 0.3.0)
//@ts-ignore
await this.appManager.call(...callDetails).catch(console.error) await this.appManager.call(...callDetails).catch(console.error)
} }
} }
@ -629,6 +662,7 @@ class AppComponent {
// @todo(remove the timeout when activatePlugin is on 0.3.0) // @todo(remove the timeout when activatePlugin is on 0.3.0)
try { try {
//@ts-ignore
await this.appManager.call(...callDetails) await this.appManager.call(...callDetails)
} catch (e) { } catch (e) {
console.error(e) console.error(e)

@ -15,7 +15,7 @@ const profile = {
export class MainPanel extends AbstractPanel { export class MainPanel extends AbstractPanel {
element: HTMLDivElement element: HTMLDivElement
dispatch: React.Dispatch<any> = () => {} dispatch: React.Dispatch<any> = () => {}
constructor(config) { constructor(config = null) {
super(profile) super(profile)
this.element = document.createElement('div') this.element = document.createElement('div')
this.element.setAttribute('data-id', 'mainPanelPluginsContainer') this.element.setAttribute('data-id', 'mainPanelPluginsContainer')

@ -19,7 +19,7 @@ const profile = {
maintainedBy: "Remix" maintainedBy: "Remix"
} }
class PluginManagerComponent extends ViewPlugin { export default class PluginManagerComponent extends ViewPlugin {
constructor (appManager, engine) { constructor (appManager, engine) {
super(profile) super(profile)
this.appManager = appManager this.appManager = appManager

@ -24,7 +24,7 @@ export class PopupPanel extends AbstractPanel {
dispatch: React.Dispatch<any> = () => { } dispatch: React.Dispatch<any> = () => { }
appStateDispatch: React.Dispatch<AppAction> = () => { } appStateDispatch: React.Dispatch<AppAction> = () => { }
constructor(config) { constructor(config = null) {
super(profile) super(profile)
this.event = new EventEmitter() this.event = new EventEmitter()
} }

@ -16,7 +16,7 @@ const profile = {
methods: ['highlight', 'discardHighlight', 'clearAnnotations', 'addLineText', 'discardLineTexts', 'addAnnotation', 'gotoLine', 'revealRange', 'getCursorPosition', 'open', 'addModel','addErrorMarker', 'clearErrorMarkers', 'getText', 'getPositionAt', 'openReadOnly'], methods: ['highlight', 'discardHighlight', 'clearAnnotations', 'addLineText', 'discardLineTexts', 'addAnnotation', 'gotoLine', 'revealRange', 'getCursorPosition', 'open', 'addModel','addErrorMarker', 'clearErrorMarkers', 'getText', 'getPositionAt', 'openReadOnly'],
} }
class Editor extends Plugin { export default class Editor extends Plugin {
constructor () { constructor () {
super(profile) super(profile)
@ -601,5 +601,3 @@ class Editor extends Plugin {
return this.api.getPositionAt(offset) return this.api.getPositionAt(offset)
} }
} }
module.exports = Editor

@ -28,7 +28,7 @@ const profile: LibraryProfile = {
, 'getGitHubUser', 'remotebranches', 'remotecommits', 'repositories', 'getCommitChanges', 'compareBranches'], , 'getGitHubUser', 'remotebranches', 'remotecommits', 'repositories', 'getCommitChanges', 'compareBranches'],
kind: 'file-system' kind: 'file-system'
} }
class DGitProvider extends Plugin<any, CustomRemixApi> { export default class DGitProvider extends Plugin<any, CustomRemixApi> {
constructor() { constructor() {
super(profile) super(profile)
} }

@ -40,7 +40,7 @@ const errorMsg = {
const createError = (err) => { const createError = (err) => {
return new Error(`${errorMsg[err.code]} ${err.message || ''}`) return new Error(`${errorMsg[err.code]} ${err.message || ''}`)
} }
class FileManager extends Plugin { export default class FileManager extends Plugin {
mode: string mode: string
openedFiles: any openedFiles: any
editor: any editor: any

@ -1,7 +1,7 @@
'use strict' 'use strict'
import FileProvider from "./fileProvider" import FileProvider from "./fileProvider"
module.exports = class RemixDProvider extends FileProvider { export default class RemixDProvider extends FileProvider {
constructor (appManager) { constructor (appManager) {
super('localhost') super('localhost')
this._appManager = appManager this._appManager = appManager

@ -3,7 +3,7 @@
const EventManager = require('events') const EventManager = require('events')
import FileProvider from "./fileProvider" import FileProvider from "./fileProvider"
class WorkspaceFileProvider extends FileProvider { export default class WorkspaceFileProvider extends FileProvider {
constructor () { constructor () {
super('') super('')
this.workspacesPath = '.workspaces' this.workspacesPath = '.workspaces'

@ -55,7 +55,7 @@ const profile = {
version: packageJson.version, version: packageJson.version,
maintainedBy: 'Remix' maintainedBy: 'Remix'
} }
module.exports = class Filepanel extends ViewPlugin { export default class Filepanel extends ViewPlugin {
constructor(appManager, contentImport) { constructor(appManager, contentImport) {
super(profile) super(profile)
this.registry = Registry.getInstance() this.registry = Registry.getInstance()

@ -12,7 +12,7 @@ const profile: Profile = {
interface panelState { interface panelState {
active: boolean active: boolean
plugin: Plugin plugin: Plugin
minimized: boolean minimized?: boolean
} }
interface panels { interface panels {
tabs: panelState tabs: panelState

@ -10,7 +10,7 @@ const profile = {
kind: 'other' kind: 'other'
} }
export class TabProxy extends Plugin { export default class TabProxy extends Plugin {
constructor (fileManager, editor) { constructor (fileManager, editor) {
super(profile) super(profile)
this.event = new EventEmitter() this.event = new EventEmitter()

@ -24,7 +24,7 @@ const profile = {
version: packageJson.version version: packageJson.version
} }
class Terminal extends Plugin { export default class Terminal extends Plugin {
fileImport: CompilerImports fileImport: CompilerImports
event: any event: any
globalRegistry: Registry globalRegistry: Registry
@ -163,4 +163,3 @@ class Terminal extends Plugin {
} }
} }
module.exports = Terminal

@ -22,7 +22,7 @@ const profile = {
maintainedBy: 'Remix' maintainedBy: 'Remix'
} }
class AnalysisTab extends ViewPlugin { export default class AnalysisTab extends ViewPlugin {
constructor () { constructor () {
super(profile) super(profile)
this.event = new EventManager() this.event = new EventManager()

@ -28,7 +28,7 @@ const profile = {
// - events: ['compilationFinished'], // - events: ['compilationFinished'],
// - methods: ['getCompilationResult'] // - methods: ['getCompilationResult']
class CompileTab extends CompilerApiMixin(ViewPlugin) { // implements ICompilerApi export default class CompileTab extends CompilerApiMixin(ViewPlugin) { // implements ICompilerApi
constructor (config, fileManager) { constructor (config, fileManager) {
super(profile) super(profile)
this.fileManager = fileManager this.fileManager = fileManager

@ -22,7 +22,7 @@ const profile = {
maintainedBy: 'Remix' maintainedBy: 'Remix'
} }
export class DebuggerTab extends DebuggerApiMixin(ViewPlugin) { export default class DebuggerTab extends DebuggerApiMixin(ViewPlugin) {
constructor () { constructor () {
super(profile) super(profile)
this.el = document.createElement('div') this.el = document.createElement('div')

@ -27,7 +27,7 @@ const profile = {
maintainedBy: 'Remix' maintainedBy: 'Remix'
} }
module.exports = class SettingsTab extends ViewPlugin { export default class SettingsTab extends ViewPlugin {
config: any = {} config: any = {}
editor: any editor: any
private _deps: { private _deps: {

@ -22,7 +22,7 @@ const profile = {
maintainedBy: 'Remix' maintainedBy: 'Remix'
} }
module.exports = class TestTab extends ViewPlugin { export default class TestTab extends ViewPlugin {
constructor (fileManager, offsetToLineColumnConverter, filePanel, compileTab, appManager, contentImport) { constructor (fileManager, offsetToLineColumnConverter, filePanel, compileTab, appManager, contentImport) {
super(profile) super(profile)
this.compileTab = compileTab this.compileTab = compileTab

@ -34,14 +34,11 @@ export class RemixAppManager extends PluginManager {
event: EventEmitter event: EventEmitter
pluginsDirectory: string pluginsDirectory: string
pluginLoader: PluginLoader // eslint-disable-line no-use-before-define pluginLoader: PluginLoader // eslint-disable-line no-use-before-define
permissionHandler: PermissionHandler
getAll(): import('@remixproject/plugin-utils').Profile<any>[] getAll(): import('@remixproject/plugin-utils').Profile<any>[]
getIds(): string[] getIds(): string[]
isDependent(name: any): any isDependent(name: any): any
isRequired(name: any): any isRequired(name: any): any
registeredPlugins(): Promise<any> registeredPlugins(): Promise<any>
turnPluginOn(name: string | string[])
turnPluginOff(name: string)
} }
export class PluginManagerSettings { export class PluginManagerSettings {
@ -67,7 +64,7 @@ export type PluginPermissions = {
} }
} }
export class PluginManagerComponent extends ViewPlugin extends Plugin implements PluginBase { export class PluginManagerComponent extends ViewPlugin implements PluginBase {
constructor(appManager: RemixAppManager, engine: Engine) constructor(appManager: RemixAppManager, engine: Engine)
appManager: RemixAppManager appManager: RemixAppManager
pluginSettings: PluginManagerSettings pluginSettings: PluginManagerSettings
@ -154,14 +151,6 @@ declare class PluginLoader {
set(plugin: any, actives: any): void set(plugin: any, actives: any): void
get(): any get(): any
} }
// eslint-disable-next-line no-redeclare
export type PluginManagerSettings = {
openDialog: () => void
onValidation: () => void
clearPermission: (from: any, to: any, method: any) => void
settings: () => HTMLElement
render: () => HTMLElement
}
export interface DefaultLocalPlugin extends Profile { export interface DefaultLocalPlugin extends Profile {
name: string name: string
@ -198,14 +187,5 @@ export type PluginManagerProfile = Profile & {
type: 'iframe' | 'ws' type: 'iframe' | 'ws'
hash: string hash: string
} }
// eslint-disable-next-line no-redeclare
export type LocalPlugin = {
create: () => Profile
updateName: (target: string) => void
updateDisplayName: (displayName: string) => void
updateProfile: (key: string, e: Event) => void
updateMethods: (target: any) => void
form: () => HTMLElement
}
export { } export { }

@ -42,7 +42,7 @@ const loadContractFromAddress = (plugin: RunTab, address, confirmCb, cb) => {
export const getSelectedContract = (contractName: string, compiler: CompilerAbstractType): ContractData => { export const getSelectedContract = (contractName: string, compiler: CompilerAbstractType): ContractData => {
if (!contractName) return null if (!contractName) return null
// const compiler = plugin.compilersArtefacts[compilerAtributeName] // const compiler = plugin.compilersArtefacts[compilerAttributeName]
if (!compiler) return null if (!compiler) return null

@ -13,10 +13,10 @@ interface ResultSummaryProps {
export const ResultSummary = (props: ResultSummaryProps) => { export const ResultSummary = (props: ResultSummaryProps) => {
const intl = useIntl() const intl = useIntl()
const { hightLightInPath, replaceText, state } = useContext(SearchContext) const { highlightInPath, replaceText, state } = useContext(SearchContext)
const { modal } = useDialogDispatchers() const { modal } = useDialogDispatchers()
const selectLine = async (line: SearchResultLineLine) => { const selectLine = async (line: SearchResultLineLine) => {
await hightLightInPath(props.searchResult, line) await highlightInPath(props.searchResult, line)
} }
const confirmReplace = async (line: SearchResultLineLine) => { const confirmReplace = async (line: SearchResultLineLine) => {

@ -19,7 +19,7 @@ export interface SearchingStateInterface {
setWholeWord: (value: boolean) => void setWholeWord: (value: boolean) => void
setSearchResults: (value: SearchResult[]) => void setSearchResults: (value: SearchResult[]) => void
findText: (path: string) => Promise<SearchResultLine[]> findText: (path: string) => Promise<SearchResultLine[]>
hightLightInPath: (result: SearchResult, line: SearchResultLineLine) => void highlightInPath: (result: SearchResult, line: SearchResultLineLine) => void
replaceText: (result: SearchResult, line: SearchResultLineLine) => Promise<void> replaceText: (result: SearchResult, line: SearchResultLineLine) => Promise<void>
reloadFile: (file: string) => void reloadFile: (file: string) => void
toggleCaseSensitive: () => void toggleCaseSensitive: () => void
@ -194,7 +194,7 @@ export const SearchProvider = ({ children = [], reducer = SearchReducer, initial
// do nothing // do nothing
} }
}, },
hightLightInPath: async (result: SearchResult, line: SearchResultLineLine) => { highlightInPath: async (result: SearchResult, line: SearchResultLineLine) => {
await plugin.call('editor', 'discardHighlight') await plugin.call('editor', 'discardHighlight')
await plugin.call('editor', 'highlight', line.position, result.path) await plugin.call('editor', 'highlight', line.position, result.path)
await plugin.call('editor', 'revealRange', line.position.start.line, line.position.start.column, line.position.end.line, line.position.end.column) await plugin.call('editor', 'revealRange', line.position.start.line, line.position.start.column, line.position.end.line, line.position.end.column)

@ -88,7 +88,12 @@ export const TabsUI = (props: TabsUIProps) => {
const getAI = async () => { const getAI = async () => {
try { try {
return await props.plugin.call('settings', 'getCopilotSetting') const init_state = await props.plugin.call('settings', 'getCopilotSetting')
if (init_state === undefined || init_state === null) {
await props.plugin.call('settings', 'updateCopilotChoice', ai_switch)
return ai_switch
}
return init_state
} catch (e) { } catch (e) {
return false return false
} }

@ -70,7 +70,7 @@ export interface FilePanelType extends ViewPlugin {
setWorkspace: ({ name, isLocalhost }, setEvent: boolean) => void setWorkspace: ({ name, isLocalhost }, setEvent: boolean) => void
createWorkspace: (name: string, workspaceTemplateName: string) => void createWorkspace: (name: string, workspaceTemplateName: string) => void
renameWorkspace: (oldName: string, newName: string) => void renameWorkspace: (oldName: string, newName: string) => void
compileContractForUml: (path: string) => void compileContractForUml?: (path: string) => void
workspaceRenamed: ({ name }) => void workspaceRenamed: ({ name }) => void
workspaceCreated: ({ name }) => void workspaceCreated: ({ name }) => void
workspaceDeleted: ({ name }) => void workspaceDeleted: ({ name }) => void
@ -81,7 +81,7 @@ export interface FilePanelType extends ViewPlugin {
appManager: RemixAppManager appManager: RemixAppManager
registry?: any // registry registry?: any // registry
pluginApi?: any pluginApi?: any
request: { request?: {
createWorkspace: () => void createWorkspace: () => void
setWorkspace: (workspaceName: string) => void setWorkspace: (workspaceName: string) => void
createNewFile: () => void createNewFile: () => void
@ -89,10 +89,10 @@ export interface FilePanelType extends ViewPlugin {
getCurrentWorkspace: () => void getCurrentWorkspace: () => void
} // api request, } // api request,
workspaces: any workspaces: any
registeredMenuItems: MenuItems // menu items registeredMenuItems?: MenuItems // menu items
removedMenuItems: MenuItems removedMenuItems?: MenuItems
initialWorkspace: string initialWorkspace?: string
resetNewFile: () => void resetNewFile?: () => void
getWorkspaces: () => string[] getWorkspaces: () => string[]
expandPath: string[] expandPath: string[]
} }

Loading…
Cancel
Save