|
|
|
@ -104,51 +104,34 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi |
|
|
|
|
} |
|
|
|
|
} else if (fix && nodeAtPosition && fix.nodeType !== nodeAtPosition.nodeType) return |
|
|
|
|
|
|
|
|
|
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 |
|
|
|
|
if (Array.isArray(fix))
|
|
|
|
|
for (const element of fix) |
|
|
|
|
this.addQuickFix(actions, error, model.uri, {title: element.title, range: element.range || error, text: msg || element.message}) |
|
|
|
|
else this.addQuickFix(actions, error, model.uri, {title: fix.title, range: fix.range || error, text: msg || fix.message}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}, |
|
|
|
|
isPreferred: true |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
actions: actions, |
|
|
|
|
dispose: () => {} |
|
|
|
|
} |
|
|
|
|
} else |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
addQuickFix(actions, error, uri, fixDetails) { |
|
|
|
|
const {title, range, text} = fixDetails |
|
|
|
|
actions.push({ |
|
|
|
|
title: fix.title, |
|
|
|
|
title, |
|
|
|
|
diagnostics: [error], |
|
|
|
|
kind: "quickfix", |
|
|
|
|
edit: { |
|
|
|
|
edits: [ |
|
|
|
|
{ |
|
|
|
|
resource: model.uri, |
|
|
|
|
edit: { |
|
|
|
|
range: fix.range || error, |
|
|
|
|
text: msg || fix.message |
|
|
|
|
} |
|
|
|
|
resource: uri, |
|
|
|
|
edit: { range, text } |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}, |
|
|
|
|
isPreferred: true |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
actions: actions, |
|
|
|
|
dispose: () => {} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |