diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-08-05 20:32:14 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-08-05 20:32:14 +0800 |
commit | de11f4a1d0f6dc17c115c729f878820985236602 (patch) | |
tree | a8b05e9c42ef6b5dd56a0d4524c5d753df954f4c /server/src | |
parent | fdb6fcbab260ffc829550ac59c952791d0ed18b6 (diff) | |
download | lua-language-server-de11f4a1d0f6dc17c115c729f878820985236602.zip |
修正因字符串字面量为不可见字符导致hover无法显示的bug
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/core/hover/hover.lua | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/server/src/core/hover/hover.lua b/server/src/core/hover/hover.lua index dbbafc30..ca1e03d4 100644 --- a/server/src/core/hover/hover.lua +++ b/server/src/core/hover/hover.lua @@ -32,8 +32,12 @@ local function formatString(str) str = str:sub(1000) end if str:find('[\r\n]') then + str = str:gsub('[\000-\008\011-\012\014-\031\127]', '') return longString(str) else + str = str:gsub('[\000-\008\011-\012\014-\031\127]', function (char) + return ('\\%03d'):format(char:byte()) + end) local single = str:find("'", 1, true) local double = str:find('"', 1, true) if single and double then |