diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-01-28 17:57:58 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-01-28 17:57:58 +0800 |
commit | f231ada25549502c60839a1b1de1edd1314541bb (patch) | |
tree | b38c9c7ef622c2a2b94ac42a5e2ceb79e54d6366 /server/src/path_filter.lua | |
parent | 21f4c487be07960ffeac86e6842c5e159333e71c (diff) | |
download | lua-language-server-f231ada25549502c60839a1b1de1edd1314541bb.zip |
修正bug
Diffstat (limited to 'server/src/path_filter.lua')
-rw-r--r-- | server/src/path_filter.lua | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/server/src/path_filter.lua b/server/src/path_filter.lua index fb39a6f8..403c938c 100644 --- a/server/src/path_filter.lua +++ b/server/src/path_filter.lua @@ -1,6 +1,6 @@ local m = require 'lpeglabel' -local m_cut = m.S'/\\' +local m_cut = m.S'\\' local m_path = (1-m_cut)^1 local function match_any(p, pass) @@ -20,16 +20,17 @@ local function compile_format(fmt) end local function compile_exp(exp) - if exp:sub(1, 1) == '/' then + exp = exp:gsub('/', '\\') + if exp:sub(1, 1) == '\\' then exp = exp:sub(2) else - exp = '**/' .. exp + exp = '**\\' .. exp end - if exp:sub(-1) == '/' then + if exp:sub(-1) == '\\' then exp = exp:sub(1, -2) end local function next(cur) - local pos, fn = exp:find('[/\\]+', cur) + local pos, fn = exp:find('[\\]+', cur) if not pos then return compile_format(exp:sub(cur)) end |