mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-03 23:25:14 +00:00
Allow diagnostics to generate multi-edit fixes (#3709)
This commit is contained in:
parent
32be63fd1e
commit
e603382cf0
731 changed files with 17319 additions and 13447 deletions
|
@ -57,27 +57,27 @@ export default function SourceEditor({
|
|||
.filter((check) => check.fix)
|
||||
.map((check) => ({
|
||||
title: check.fix
|
||||
? `${check.code}: ${check.fix.message}` ?? `Fix ${check.code}`
|
||||
? check.fix.message
|
||||
? `${check.code}: ${check.fix.message}`
|
||||
: `Fix ${check.code}`
|
||||
: "Autofix",
|
||||
id: `fix-${check.code}`,
|
||||
kind: "quickfix",
|
||||
edit: check.fix
|
||||
? {
|
||||
edits: [
|
||||
{
|
||||
resource: model.uri,
|
||||
versionId: model.getVersionId(),
|
||||
edit: {
|
||||
range: {
|
||||
startLineNumber: check.fix.location.row,
|
||||
startColumn: check.fix.location.column + 1,
|
||||
endLineNumber: check.fix.end_location.row,
|
||||
endColumn: check.fix.end_location.column + 1,
|
||||
},
|
||||
text: check.fix.content,
|
||||
edits: check.fix.edits.map((edit) => ({
|
||||
resource: model.uri,
|
||||
versionId: model.getVersionId(),
|
||||
edit: {
|
||||
range: {
|
||||
startLineNumber: edit.location.row,
|
||||
startColumn: edit.location.column + 1,
|
||||
endLineNumber: edit.end_location.row,
|
||||
endColumn: edit.end_location.column + 1,
|
||||
},
|
||||
text: edit.content,
|
||||
},
|
||||
],
|
||||
})),
|
||||
}
|
||||
: undefined,
|
||||
}));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue