diff --git a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts index 215b4889a5..fb6f339aa6 100644 --- a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts +++ b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts @@ -30,6 +30,8 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi column: error.startColumn }) const nodeAtPosition = await this.props.plugin.call('codeParser', 'definitionAtPosition', cursorPosition) + console.log('nodeAtPosition------>', nodeAtPosition) + console.log('error------>', error) // Check if a function is hovered if (nodeAtPosition && nodeAtPosition.nodeType === 'FunctionDefinition') { // Identify type of AST node @@ -46,6 +48,15 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi text: msg }) } + } else if (nodeAtPosition && nodeAtPosition.nodeType === 'ContractDefinition') { + for (const fix of fixes) { + const lineContent: string = model.getValueInRange(error) + this.addQuickFix(actions, error, model.uri, { + title: fix.title, + range: error, + text: fix.message + lineContent + }) + } } else { for (const fix of fixes) { if (fix && nodeAtPosition && fix.nodeType !== nodeAtPosition.nodeType) continue diff --git a/libs/remix-ui/editor/src/lib/providers/quickfixes.ts b/libs/remix-ui/editor/src/lib/providers/quickfixes.ts index a93834674d..8897dc856d 100644 --- a/libs/remix-ui/editor/src/lib/providers/quickfixes.ts +++ b/libs/remix-ui/editor/src/lib/providers/quickfixes.ts @@ -106,5 +106,13 @@ export default { message: 'pure ', nodeType: 'FunctionDefinition' } + ], + 'should be marked as abstract': [ + { + id: 6, + title: "Add 'abstract' to contract", + message: 'abstract ', + nodeType: 'ContractDefinition' + } ] }