From 74eb42c4f89b06a57e5c157b0b9b7a93b4d7139f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Sun, 10 Nov 2019 23:22:30 +0800 Subject: =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=96=87=E4=BB=B6=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E5=8C=B9=E9=85=8D=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server-beta/src/service/service.lua | 4 ++-- server-beta/src/workspace/workspace.lua | 19 +++++++++++++------ server-beta/test.lua | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) (limited to 'server-beta') diff --git a/server-beta/src/service/service.lua b/server-beta/src/service/service.lua index 388f96c4..7b0b8ad5 100644 --- a/server-beta/src/service/service.lua +++ b/server-beta/src/service/service.lua @@ -42,7 +42,7 @@ function m.reportMemory() local lines = {} lines[#lines+1] = ' --------------- Memory ---------------' - lines[#lines+1] = (' Total: %.3 MB'):format(totalMem / 1000.0) + lines[#lines+1] = (' Total: %.3f MB'):format(totalMem / 1000.0) for i = 0, #mems do lines[#lines+1] = (' # %02d : %.3f MB'):format(i, mems[i] / 1000.0) end @@ -92,7 +92,7 @@ function m.reportCache() end local lines = {} - lines[#lines+1] = ' --------------- Coroutine ---------------' + lines[#lines+1] = ' --------------- Cache ---------------' lines[#lines+1] = (' Total: %d'):format(total) lines[#lines+1] = (' Dead: %d'):format(dead) return table.concat(lines, '\n') diff --git a/server-beta/src/workspace/workspace.lua b/server-beta/src/workspace/workspace.lua index b335c51a..d5e6310e 100644 --- a/server-beta/src/workspace/workspace.lua +++ b/server-beta/src/workspace/workspace.lua @@ -146,13 +146,20 @@ function m.findUrisByFilePath(path, whole) for uri in files.eachFile() do local pathLen = #path local uriLen = #uri - for i = uriLen, uriLen - pathLen + 1, -1 do - local see = uri:sub(i - pathLen + 1, i) - if files.eq(see, path) then - results[#results+1] = uri + if whole then + local seg = uri:sub(uriLen - pathLen, uriLen - pathLen) + if seg == '/' or seg == '\\' or seg == '' then + local see = uri:sub(uriLen - pathLen + 1, uriLen) + if files.eq(see, path) then + results[#results+1] = uri + end end - if not whole then - break + else + for i = uriLen, uriLen - pathLen + 1, -1 do + local see = uri:sub(i - pathLen + 1, i) + if files.eq(see, path) then + results[#results+1] = uri + end end end end diff --git a/server-beta/test.lua b/server-beta/test.lua index ad282687..3ebfca70 100644 --- a/server-beta/test.lua +++ b/server-beta/test.lua @@ -38,7 +38,7 @@ local function main() test 'definition' test 'diagnostics' - test 'references' + --test 'references' --test 'highlight' --test 'rename' --test 'type_inference' -- cgit v1.2.3