mapped edits: restore backward compat

This commit is contained in:
Ulugbek Abdullaev
2023-09-21 16:29:44 +02:00
parent 4849a90efe
commit 63080adeb6

View File

@@ -1830,8 +1830,7 @@ class MappedEditsAdapter {
const uri = URI.revive(resource);
const doc = this._documents.getDocument(uri);
const ctx = {
documents: context.documents.map((docSubArray) =>
const usedContext = context.documents.map((docSubArray) =>
docSubArray.map((r) => {
return {
uri: URI.revive(r.uri),
@@ -1839,7 +1838,11 @@ class MappedEditsAdapter {
ranges: r.ranges.map((range) => typeConvert.Range.to(range)),
};
})
),
);
const ctx = {
documents: usedContext,
selections: usedContext[0]?.[0]?.ranges ?? [] // @ulugbekna: this is a hack for backward compatibility
};
const mappedEdits = await this._provider.provideMappedEdits(doc, codeBlocks, ctx, token);