Merge pull request #2790 from ethereum/constructorparams

constructor autocomplete
pull/5370/head
bunsenstraat 2 years ago committed by GitHub
commit 574dd0de70
  1. 2
      apps/remix-ide/src/remixAppManager.js
  2. 6
      libs/remix-ui/editor/src/lib/providers/completionProvider.ts

@ -11,7 +11,7 @@ const requiredModules = [ // services + layout views + system views
'filePanel', 'terminal', 'settings', 'pluginManager', 'tabs', 'udapp', 'dGitProvider', 'solidity', 'solidity-logic', 'gistHandler', 'layout', 'filePanel', 'terminal', 'settings', 'pluginManager', 'tabs', 'udapp', 'dGitProvider', 'solidity', 'solidity-logic', 'gistHandler', 'layout',
'notification', 'permissionhandler', 'walkthrough', 'storage', 'restorebackupzip', 'link-libraries', 'deploy-libraries', 'openzeppelin-proxy', 'notification', 'permissionhandler', 'walkthrough', 'storage', 'restorebackupzip', 'link-libraries', 'deploy-libraries', 'openzeppelin-proxy',
'hardhat-provider', 'ganache-provider', 'foundry-provider', 'basic-http-provider', 'injected-optimism-provider', 'injected-arbitrum-one-provider', 'hardhat-provider', 'ganache-provider', 'foundry-provider', 'basic-http-provider', 'injected-optimism-provider', 'injected-arbitrum-one-provider',
'compileAndRun', 'search', 'recorder', 'fileDecorator'] 'compileAndRun', 'search', 'recorder', 'fileDecorator', 'codeParser']
// dependentModules shouldn't be manually activated (e.g hardhat is activated by remixd) // dependentModules shouldn't be manually activated (e.g hardhat is activated by remixd)
const dependentModules = ['hardhat', 'truffle', 'slither'] const dependentModules = ['hardhat', 'truffle', 'slither']

@ -242,8 +242,10 @@ export class RemixCompletionProvider implements languages.CompletionItemProvider
// try to find the real block in the AST and get the nodes in that scope // try to find the real block in the AST and get the nodes in that scope
if (node.nodeType === 'ContractDefinition') { if (node.nodeType === 'ContractDefinition') {
const contractNodes = fileNodes.contracts[node.name].contractNodes const contractNodes = fileNodes.contracts[node.name].contractNodes
for (const contractNode of Object.values(contractNodes)) { for (const contractNode of Object.values(contractNodes)) {
if (contractNode['name'] === ANTLRBlock.name) { if (contractNode['name'] === ANTLRBlock.name
|| (contractNode['kind'] === 'constructor' && ANTLRBlock.name === null )
) {
let nodeOfScope = await this.props.plugin.call('codeParser', 'getNodesWithScope', (contractNode as any).id) let nodeOfScope = await this.props.plugin.call('codeParser', 'getNodesWithScope', (contractNode as any).id)
nodes = [...nodes, ...nodeOfScope] nodes = [...nodes, ...nodeOfScope]
if (contractNode['body']) { if (contractNode['body']) {

Loading…
Cancel
Save