pull/3939/head
bunsenstraat 2 years ago
parent b35d97d72d
commit 866cc44d61
  1. 74
      libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts
  2. 26
      libs/remix-ui/editor/src/lib/providers/quickfixes.ts

@ -4,45 +4,45 @@ import { EditorUIProps } from "../remix-ui-editor"
import { default as fixes } from "./quickfixes"
export class RemixCodeActionProvider implements monaco.languages.CodeActionProvider {
props: EditorUIProps
monaco: Monaco
constructor(props: any, monaco: any) {
this.props = props
this.monaco = monaco
}
props: EditorUIProps
monaco: Monaco
constructor(props: any, monaco: any) {
this.props = props
this.monaco = monaco
}
async provideCodeActions (
model /**ITextModel*/,
range /**Range*/,
context /**CodeActionContext*/,
token /**CancellationToken*/
) {
async provideCodeActions (
model /**ITextModel*/,
range /**Range*/,
context /**CodeActionContext*/,
token /**CancellationToken*/
) {
const actions = context.markers.map(error => {
const errStrings = Object.keys(fixes)
const errStr = errStrings.find(es => error.message.includes(es))
const fix = fixes[errStr]
return {
title: fix.title,
diagnostics: [error],
kind: "quickfix",
edit: {
edits: [
{
resource: model.uri,
edit: {
range: fix.range || error,
text: fix.message
}
}
]
},
isPreferred: true
const actions = context.markers.map(error => {
const errStrings = Object.keys(fixes)
const errStr = errStrings.find(es => error.message.includes(es))
const fix = fixes[errStr]
return {
title: fix.title,
diagnostics: [error],
kind: "quickfix",
edit: {
edits: [
{
resource: model.uri,
edit: {
range: fix.range || error,
text: fix.message
}
}
})
return {
actions: actions,
dispose: () => {}
}
]
},
isPreferred: true
}
})
return {
actions: actions,
dispose: () => {}
}
}
}

@ -1,16 +1,16 @@
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.": {
"title": "Add open-source license",
"message": "// SPDX-License-Identifier: GPL-3.0"
},
"Warning: Source file does not specify required compiler version! Consider adding" : {
"title": "Add pragma line",
"message": "pragma solidity ^0.*.*;",
"range": {
startLineNumber: 2,
endLineNumber: 2,
startColumn: 1,
endColumn: 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.": {
"title": "Add open-source license",
"message": "// SPDX-License-Identifier: GPL-3.0"
},
"Warning: Source file does not specify required compiler version! Consider adding" : {
"title": "Add pragma line",
"message": "pragma solidity ^0.*.*;",
"range": {
startLineNumber: 2,
endLineNumber: 2,
startColumn: 1,
endColumn: 1
}
}
}
Loading…
Cancel
Save