multiple quick fix for SPDX license

pull/5370/head
aniket-engg 2 years ago committed by Aniket
parent 92595ebd49
commit 84d1fc447a
  1. 54
      libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts
  2. 17
      libs/remix-ui/editor/src/lib/providers/quickfixes.ts

@ -104,23 +104,45 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi
} }
} else if (fix && nodeAtPosition && fix.nodeType !== nodeAtPosition.nodeType) return } else if (fix && nodeAtPosition && fix.nodeType !== nodeAtPosition.nodeType) return
actions.push({ if (Array.isArray(fix)) {
title: fix.title, for (const element of fix) {
diagnostics: [error], actions.push({
kind: "quickfix", title: element.title,
edit: { diagnostics: [error],
edits: [ kind: "quickfix",
{ edit: {
resource: model.uri, edits: [
edit: { {
range: fix.range || error, resource: model.uri,
text: msg || fix.message edit: {
range: element.range || error,
text: msg || element.message
}
}
]
},
isPreferred: true
})
}
} else
actions.push({
title: fix.title,
diagnostics: [error],
kind: "quickfix",
edit: {
edits: [
{
resource: model.uri,
edit: {
range: fix.range || error,
text: msg || fix.message
}
} }
} ]
] },
}, isPreferred: true
isPreferred: true })
})
} }
} }

@ -1,13 +1,18 @@
export default { export default {
"Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing \"SPDX-License-Identifier: <SPDX-License>\" to each source file. Use \"SPDX-License-Identifier: UNLICENSED\" for non-open-source code. Please see https://spdx.org for more information.": { "Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing \"SPDX-License-Identifier: <SPDX-License>\" to each source file. Use \"SPDX-License-Identifier: UNLICENSED\" for non-open-source code. Please see https://spdx.org for more information.": [{
"id": 1, "id": 1.1,
"nodeType": "SourceUnit",
"title": "Add open-source license", "title": "Add open-source license",
"message": "// SPDX-License-Identifier: GPL-3.0", "message": "// SPDX-License-Identifier: GPL-3.0"
"nodeType": "SourceUnit" },{
}, "id": 1.2,
"nodeType": "SourceUnit",
"title": "Add non-open-source license",
"message": "// SPDX-License-Identifier: UNLICENSED"
}],
"Warning: Source file does not specify required compiler version! Consider adding" : { "Warning: Source file does not specify required compiler version! Consider adding" : {
"id": 2, "id": 2,
"title": "Add pragma line", "title": "Add Solidity pragma",
"message": "pragma solidity ^0.*.*;", "message": "pragma solidity ^0.*.*;",
"nodeType": "PragmaDirective", "nodeType": "PragmaDirective",
"range": { "range": {

Loading…
Cancel
Save