From 3a7e460b201142ffe4e483fd2890787ab70a7990 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Wed, 6 Sep 2023 18:39:52 +0530 Subject: [PATCH] QF to add data location to method params --- .../src/lib/providers/codeActionProvider.ts | 8 ++++---- .../editor/src/lib/providers/quickfixes.ts | 16 ++++++++++++++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts index 34e5e6ee08..9670282e9f 100644 --- a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts +++ b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts @@ -24,14 +24,12 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi const errStrings: string[] = Object.keys(fixesList) const errStr: string = errStrings.find((es) => error.message.includes(es)) if (errStr) { - console.log('error=========>', error) fixes = fixesList[errStr] const cursorPosition: number = this.props.editorAPI.getHoverPosition({ lineNumber: error.startLineNumber, column: error.startColumn }) const nodeAtPosition = await this.props.plugin.call('codeParser', 'definitionAtPosition', cursorPosition) - console.log('nodeAtPosition=========>', nodeAtPosition) // Check if a function is hovered if (nodeAtPosition && nodeAtPosition.nodeType === 'FunctionDefinition') { // Identify type of AST node @@ -78,8 +76,10 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi case 9.2: case 10.1: case 10.2: - case 10.3: { - console.log('sssss') + case 10.3: + case 11.1: + case 11.2: { + // To add data location in constructor params, function params and variables const lineContent: string = model.getValueInRange(error) const words = lineContent.split(' ') this.addQuickFix(actions, error, model.uri, { diff --git a/libs/remix-ui/editor/src/lib/providers/quickfixes.ts b/libs/remix-ui/editor/src/lib/providers/quickfixes.ts index 190ce42a8c..93f289de08 100644 --- a/libs/remix-ui/editor/src/lib/providers/quickfixes.ts +++ b/libs/remix-ui/editor/src/lib/providers/quickfixes.ts @@ -145,16 +145,28 @@ export default { 'TypeError: Data location must be "storage", "memory" or "calldata" for variable, but none was given.': [ { id: 10.1, - title: "Add 'storage' to param", + title: "Add 'storage' to variable", message: ' storage ' }, { id: 10.2, - title: "Add 'memory' to param", + title: "Add 'memory' to variable", message: ' memory ' }, { id: 10.3, + title: "Add 'calldata' to variable", + message: ' calldata ' + } + ], + 'TypeError: Data location must be "memory" or "calldata" for parameter in function, but none was given.': [ + { + id: 11.1, + title: "Add 'memory' to param", + message: ' memory ' + }, + { + id: 11.2, title: "Add 'calldata' to param", message: ' calldata ' }