From 20055f378a1309df25b4f77ac193b9d2352c2abf Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Mon, 22 Aug 2022 10:59:41 +0200 Subject: [PATCH 1/4] fixes --- apps/remix-ide/src/remixAppManager.js | 2 +- .../editor/src/lib/providers/completionProvider.ts | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/remix-ide/src/remixAppManager.js b/apps/remix-ide/src/remixAppManager.js index fcf96659ec..3f02d4e716 100644 --- a/apps/remix-ide/src/remixAppManager.js +++ b/apps/remix-ide/src/remixAppManager.js @@ -11,7 +11,7 @@ const requiredModules = [ // services + layout views + system views 'filePanel', 'terminal', 'settings', 'pluginManager', 'tabs', 'udapp', 'dGitProvider', 'solidity', 'solidity-logic', 'gistHandler', 'layout', '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', - 'compileAndRun', 'search', 'recorder', 'fileDecorator'] + 'compileAndRun', 'search', 'recorder', 'fileDecorator', 'codeParser'] // dependentModules shouldn't be manually activated (e.g hardhat is activated by remixd) const dependentModules = ['hardhat', 'truffle', 'slither'] diff --git a/libs/remix-ui/editor/src/lib/providers/completionProvider.ts b/libs/remix-ui/editor/src/lib/providers/completionProvider.ts index 6021e22ae5..2182d4409b 100644 --- a/libs/remix-ui/editor/src/lib/providers/completionProvider.ts +++ b/libs/remix-ui/editor/src/lib/providers/completionProvider.ts @@ -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 if (node.nodeType === 'ContractDefinition') { const contractNodes = fileNodes.contracts[node.name].contractNodes - for (const contractNode of Object.values(contractNodes)) { - if (contractNode['name'] === ANTLRBlock.name) { + for (const contractNode of Object.values(contractNodes)) { + if (contractNode['name'] === ANTLRBlock.name + || (contractNode['kind'] === 'constructor' && ANTLRBlock.name === null ) + ) { let nodeOfScope = await this.props.plugin.call('codeParser', 'getNodesWithScope', (contractNode as any).id) nodes = [...nodes, ...nodeOfScope] if (contractNode['body']) { @@ -308,7 +310,8 @@ export class RemixCompletionProvider implements languages.CompletionItemProvider nodes = [...Object.values(fileNodes.imports), ...nodes] // at the nodes at the block itself nodes = [...nodes, ...await this.getBlockNodesAtPosition(position)] - // filter private nodes, only allow them when contract ID is the same as the current contract + console.log(await this.getBlockNodesAtPosition(position)) + // filter private nodes, only allow them when contract ID is the same as the current contract nodes = nodes.filter(node => { if (node.visibility) { if (node.visibility === 'private') { From 70a5317e29e06d6be3aca91a096ea7c7a1530e23 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Mon, 22 Aug 2022 11:02:09 +0200 Subject: [PATCH 2/4] rm console --- libs/remix-ui/editor/src/lib/providers/completionProvider.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/libs/remix-ui/editor/src/lib/providers/completionProvider.ts b/libs/remix-ui/editor/src/lib/providers/completionProvider.ts index 2182d4409b..d9e9c05022 100644 --- a/libs/remix-ui/editor/src/lib/providers/completionProvider.ts +++ b/libs/remix-ui/editor/src/lib/providers/completionProvider.ts @@ -310,7 +310,6 @@ export class RemixCompletionProvider implements languages.CompletionItemProvider nodes = [...Object.values(fileNodes.imports), ...nodes] // at the nodes at the block itself nodes = [...nodes, ...await this.getBlockNodesAtPosition(position)] - console.log(await this.getBlockNodesAtPosition(position)) // filter private nodes, only allow them when contract ID is the same as the current contract nodes = nodes.filter(node => { if (node.visibility) { From c9af11963ce8a53cc980b7c314b6a1eee8bbb064 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Mon, 22 Aug 2022 11:02:56 +0200 Subject: [PATCH 3/4] whitespace --- libs/remix-ui/editor/src/lib/providers/completionProvider.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ui/editor/src/lib/providers/completionProvider.ts b/libs/remix-ui/editor/src/lib/providers/completionProvider.ts index d9e9c05022..745c5e395b 100644 --- a/libs/remix-ui/editor/src/lib/providers/completionProvider.ts +++ b/libs/remix-ui/editor/src/lib/providers/completionProvider.ts @@ -310,7 +310,7 @@ export class RemixCompletionProvider implements languages.CompletionItemProvider nodes = [...Object.values(fileNodes.imports), ...nodes] // at the nodes at the block itself nodes = [...nodes, ...await this.getBlockNodesAtPosition(position)] - // filter private nodes, only allow them when contract ID is the same as the current contract + // filter private nodes, only allow them when contract ID is the same as the current contract nodes = nodes.filter(node => { if (node.visibility) { if (node.visibility === 'private') { From 50137bc519b3448e1e75fd6c268a1c57f13b15e7 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Mon, 22 Aug 2022 11:02:09 +0200 Subject: [PATCH 4/4] rm console whitespace --- libs/remix-ui/editor/src/lib/providers/completionProvider.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libs/remix-ui/editor/src/lib/providers/completionProvider.ts b/libs/remix-ui/editor/src/lib/providers/completionProvider.ts index 2182d4409b..745c5e395b 100644 --- a/libs/remix-ui/editor/src/lib/providers/completionProvider.ts +++ b/libs/remix-ui/editor/src/lib/providers/completionProvider.ts @@ -310,8 +310,7 @@ export class RemixCompletionProvider implements languages.CompletionItemProvider nodes = [...Object.values(fileNodes.imports), ...nodes] // at the nodes at the block itself nodes = [...nodes, ...await this.getBlockNodesAtPosition(position)] - console.log(await this.getBlockNodesAtPosition(position)) - // filter private nodes, only allow them when contract ID is the same as the current contract + // filter private nodes, only allow them when contract ID is the same as the current contract nodes = nodes.filter(node => { if (node.visibility) { if (node.visibility === 'private') {