Allow diagnostics to generate multi-edit fixes (#3709)

This commit is contained in:
Charlie Marsh 2023-03-26 16:45:19 -04:00 committed by GitHub
parent 32be63fd1e
commit e603382cf0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
731 changed files with 17319 additions and 13447 deletions

View file

@ -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,
}));