From 5c9b1b467af1636ea21a9bd3d398e220790eea54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 23 Sep 2021 15:00:50 +0800 Subject: cleanup --- script/core/command/solve.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'script/core/command/solve.lua') diff --git a/script/core/command/solve.lua b/script/core/command/solve.lua index a493de24..790adbee 100644 --- a/script/core/command/solve.lua +++ b/script/core/command/solve.lua @@ -1,7 +1,8 @@ -local files = require 'files' -local guide = require 'parser.guide' -local proto = require 'proto' -local lang = require 'language' +local files = require 'files' +local guide = require 'parser.guide' +local proto = require 'proto' +local lang = require 'language' +local converter = require 'proto.converter' local opMap = { ['+'] = true, @@ -34,8 +35,7 @@ return function (data) return end - local start = files.offsetOfWord(uri, data.range.start) - local finish = files.offsetOfWord(uri, data.range['end']) + local start, finish = converter.unpackRange(uri, data.range) local result = guide.eachSourceContain(ast.ast, start, function (source) if source.start ~= start -- cgit v1.2.3 From 466874e8a8e360634833a07508fb48131530b704 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 23 Sep 2021 16:02:08 +0800 Subject: cleanup --- script/core/command/solve.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'script/core/command/solve.lua') diff --git a/script/core/command/solve.lua b/script/core/command/solve.lua index 790adbee..9428d065 100644 --- a/script/core/command/solve.lua +++ b/script/core/command/solve.lua @@ -85,7 +85,7 @@ return function (data) changes = { [uri] = { { - range = files.range(uri, result.start, result.finish), + range = converter.packRange(uri, result.start, result.finish), newText = ('(%s)'):format(text:sub(result.start, result.finish)), } }, -- cgit v1.2.3