mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 18:49:00 +01:00
Only accept WorkspaceEdit, #34664
This commit is contained in:
@@ -314,9 +314,7 @@ class CodeActionAdapter {
|
||||
title: candidate.title,
|
||||
command: candidate.command && this._commands.toInternal(candidate.command),
|
||||
diagnostics: candidate.diagnostics && candidate.diagnostics.map(DiagnosticCollection.toMarkerData),
|
||||
edits: Array.isArray(candidate.edits)
|
||||
? TypeConverters.WorkspaceEdit.fromTextEdits(resource, candidate.edits)
|
||||
: candidate.edits && TypeConverters.WorkspaceEdit.from(candidate.edits),
|
||||
edits: candidate.edit && TypeConverters.WorkspaceEdit.from(candidate.edit),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,18 +241,6 @@ export namespace WorkspaceEdit {
|
||||
return result;
|
||||
}
|
||||
|
||||
export function fromTextEdits(uri: vscode.Uri, textEdits: vscode.TextEdit[]): modes.WorkspaceEdit {
|
||||
const result: modes.WorkspaceEdit = { edits: [] };
|
||||
for (let textEdit of textEdits) {
|
||||
result.edits.push({
|
||||
resource: uri,
|
||||
newText: textEdit.newText,
|
||||
range: fromRange(textEdit.range)
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
export function to(value: modes.WorkspaceEdit) {
|
||||
const result = new types.WorkspaceEdit();
|
||||
for (const edit of value.edits) {
|
||||
|
||||
Reference in New Issue
Block a user