From fe1fe866f3fd0a7bb542debaae782470f107b7c1 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 11 Aug 2018 16:10:34 +0300 Subject: Simplify code --- code/src/extension.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'code') diff --git a/code/src/extension.ts b/code/src/extension.ts index bdad1568a..0fa092573 100644 --- a/code/src/extension.ts +++ b/code/src/extension.ts @@ -26,15 +26,13 @@ export function activate(context: vscode.ExtensionContext) { let request: ExtendSelectionParams = { textDocument: { uri: editor.document.uri.toString() }, selections: editor.selections.map((s) => { - return { start: s.start, end: s.end }; + return client.code2ProtocolConverter.asRange(s) }) } let response = await client.sendRequest("m/extendSelection", request) editor.selections = response.selections.map((range) => { - return new vscode.Selection( - new vscode.Position(range.start.line, range.start.character), - new vscode.Position(range.end.line, range.end.character), - ) + let r = client.protocol2CodeConverter.asRange(range) + return new vscode.Selection(r.start, r.end) }) }) @@ -158,7 +156,9 @@ function setHighlights( console.log(`unknown tag ${d.tag}`) continue } - byTag[d.tag].push(d.range) + byTag[d.tag].push( + client.protocol2CodeConverter.asRange(d.range) + ) } for (let tag in byTag) { -- cgit v1.2.3