linting fix

pull/4052/head
aniket-engg 1 year ago committed by Aniket
parent 6f35119ca4
commit 09cd371138
  1. 80
      libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts

@ -50,46 +50,46 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi
for (const fix of fixes) {
if (fix && nodeAtPosition && fix.nodeType && fix.nodeType !== nodeAtPosition.nodeType) continue
switch (fix.id) {
case 2: {
// To add specific pragma based on error
const startIndex = error.message.indexOf('pragma')
const endIndex = error.message.indexOf(';')
const msg = error.message.substring(startIndex, endIndex + 1)
this.addQuickFix(actions, error, model.uri, {
title: fix.title,
range: fix.range,
text: msg
})
break
}
case 6: {
// To add `abstract` in the contract
const lineContent: string = model.getValueInRange(error)
this.addQuickFix(actions, error, model.uri, {
title: fix.title,
range: error,
text: fix.message + lineContent
})
break
}
case 7: {
// To update pragma same as selected compiler version
const startIndex = error.message.indexOf('is')
const endIndex = error.message.indexOf('+')
const msg = error.message.substring(startIndex + 2, endIndex)
this.addQuickFix(actions, error, model.uri, {
title: `Update pragma to ${msg}`,
range: error,
text: 'pragma solidity' + msg + ';'
})
break
}
default:
this.addQuickFix(actions, error, model.uri, {
title: fix.title,
range: fix.range || error,
text: fix.message
})
case 2: {
// To add specific pragma based on error
const startIndex = error.message.indexOf('pragma')
const endIndex = error.message.indexOf(';')
const msg = error.message.substring(startIndex, endIndex + 1)
this.addQuickFix(actions, error, model.uri, {
title: fix.title,
range: fix.range,
text: msg
})
break
}
case 6: {
// To add `abstract` in the contract
const lineContent: string = model.getValueInRange(error)
this.addQuickFix(actions, error, model.uri, {
title: fix.title,
range: error,
text: fix.message + lineContent
})
break
}
case 7: {
// To update pragma same as selected compiler version
const startIndex = error.message.indexOf('is')
const endIndex = error.message.indexOf('+')
const msg = error.message.substring(startIndex + 2, endIndex)
this.addQuickFix(actions, error, model.uri, {
title: `Update pragma to ${msg}`,
range: error,
text: 'pragma solidity' + msg + ';'
})
break
}
default:
this.addQuickFix(actions, error, model.uri, {
title: fix.title,
range: fix.range || error,
text: fix.message
})
}
}
}

Loading…
Cancel
Save