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
actions.push({
title: fix.title,
diagnostics: [error],
kind: "quickfix",
edit: {
edits: [
{
resource: model.uri,
edit: {
range: fix.range || error,
text: msg || fix.message
if (Array.isArray(fix)) {
for (const element of fix) {
actions.push({
title: element.title,
diagnostics: [error],
kind: "quickfix",
edit: {
edits: [
{
resource: model.uri,
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 {
"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,
"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.1,
"nodeType": "SourceUnit",
"title": "Add open-source license",
"message": "// SPDX-License-Identifier: GPL-3.0",
"nodeType": "SourceUnit"
},
"message": "// SPDX-License-Identifier: GPL-3.0"
},{
"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" : {
"id": 2,
"title": "Add pragma line",
"title": "Add Solidity pragma",
"message": "pragma solidity ^0.*.*;",
"nodeType": "PragmaDirective",
"range": {

Loading…
Cancel
Save