QF to add data location to method params

pull/5370/head
aniket-engg 1 year ago committed by Aniket
parent 99fb7eef56
commit 3a7e460b20
  1. 8
      libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts
  2. 16
      libs/remix-ui/editor/src/lib/providers/quickfixes.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, {

@ -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 '
}

Loading…
Cancel
Save