From 486ad493425397295e38ae19de9ba7051696d61b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 21 Jan 2019 18:17:55 +0800 Subject: =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=B8=8B=E5=88=92=E7=BA=BF=E9=98=BB?= =?UTF-8?q?=E6=96=AD=E8=87=AA=E5=8A=A8=E5=AE=8C=E6=88=90=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/method/textDocument/completion.lua | 4 ++-- server/test/completion/init.lua | 4 ++-- server/test/crossfile/completion.lua | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/server/src/method/textDocument/completion.lua b/server/src/method/textDocument/completion.lua index 1e9030b8..b6dd55c4 100644 --- a/server/src/method/textDocument/completion.lua +++ b/server/src/method/textDocument/completion.lua @@ -33,12 +33,12 @@ local function findWord(position, text) local word = text for i = position-1, 1, -1 do local c = text:sub(i, i) - if not c:find '%w' then + if not c:find '[%w_]' then word = text:sub(i+1, position) break end end - return word:match('^(%w*)') + return word:match('^([%w_]*)') end return function (lsp, params) diff --git a/server/test/completion/init.lua b/server/test/completion/init.lua index df841b96..6131ceb8 100644 --- a/server/test/completion/init.lua +++ b/server/test/completion/init.lua @@ -74,12 +74,12 @@ local function findWord(position, text) local word = text for i = position-1, 1, -1 do local c = text:sub(i, i) - if not c:find '%w' then + if not c:find '[%w_]' then word = text:sub(i+1, position) break end end - return word:match('^(%w*)') + return word:match('^([%w_]*)') end rawset(_G, 'TEST', true) diff --git a/server/test/crossfile/completion.lua b/server/test/crossfile/completion.lua index 6039d1ef..61908dbd 100644 --- a/server/test/crossfile/completion.lua +++ b/server/test/crossfile/completion.lua @@ -78,12 +78,12 @@ local function findWord(position, text) local word = text for i = position-1, 1, -1 do local c = text:sub(i, i) - if not c:find '%w' then + if not c:find '[%w_]' then word = text:sub(i+1, position) break end end - return word:match('^(%w*)') + return word:match('^([%w_]*)') end function TEST(data) -- cgit v1.2.3