mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 03:38:29 +00:00
Simplify code
This commit is contained in:
parent
ce06a9ddcb
commit
fe1fe866f3
@ -26,15 +26,13 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
let request: ExtendSelectionParams = {
|
let request: ExtendSelectionParams = {
|
||||||
textDocument: { uri: editor.document.uri.toString() },
|
textDocument: { uri: editor.document.uri.toString() },
|
||||||
selections: editor.selections.map((s) => {
|
selections: editor.selections.map((s) => {
|
||||||
return { start: s.start, end: s.end };
|
return client.code2ProtocolConverter.asRange(s)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
let response = await client.sendRequest<ExtendSelectionResult>("m/extendSelection", request)
|
let response = await client.sendRequest<ExtendSelectionResult>("m/extendSelection", request)
|
||||||
editor.selections = response.selections.map((range) => {
|
editor.selections = response.selections.map((range) => {
|
||||||
return new vscode.Selection(
|
let r = client.protocol2CodeConverter.asRange(range)
|
||||||
new vscode.Position(range.start.line, range.start.character),
|
return new vscode.Selection(r.start, r.end)
|
||||||
new vscode.Position(range.end.line, range.end.character),
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -158,7 +156,9 @@ function setHighlights(
|
|||||||
console.log(`unknown tag ${d.tag}`)
|
console.log(`unknown tag ${d.tag}`)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
byTag[d.tag].push(d.range)
|
byTag[d.tag].push(
|
||||||
|
client.protocol2CodeConverter.asRange(d.range)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let tag in byTag) {
|
for (let tag in byTag) {
|
||||||
|
Loading…
Reference in New Issue
Block a user