diff options
author | kevinhwang91 <kevin.hwang@live.com> | 2022-04-04 23:48:08 +0800 |
---|---|---|
committer | kevinhwang91 <kevin.hwang@live.com> | 2022-04-04 23:58:23 +0800 |
commit | d539858421bd550b8731cef036ff4da1e7d623c0 (patch) | |
tree | 8070b6bae645ed41d264a5f013d8067d6ca9381e /script/provider | |
parent | 53ce34380c42036ca2d1ccc9f1ad969e354ba635 (diff) | |
download | lua-language-server-d539858421bd550b8731cef036ff4da1e7d623c0.zip |
fix(completion): avoid unnecessary file sep as trigger chars
Language clients such as coc.nvim have multiple completion sources that
may contain a file path completion source triggered by `/` or `\`.
However, if users use the default requireSeparator `.` setting under
lua-language-server, type `/` or `\` in a string will fire a lot of unless
items whose priority is high than file path items and make file path
items at the bottom of candidates.
Diffstat (limited to 'script/provider')
-rw-r--r-- | script/provider/completion.lua | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/script/provider/completion.lua b/script/provider/completion.lua index 3c0c82d7..7714525a 100644 --- a/script/provider/completion.lua +++ b/script/provider/completion.lua @@ -7,7 +7,7 @@ local ws = require 'workspace' local isEnable = false local function allWords() - local str = '\t\n.:(\'"[,#*@|=-{/\\ +?' + local str = '\t\n.:(\'"[,#*@|=-{ +?' local mark = {} local list = {} for c in str:gmatch '.' do @@ -20,6 +20,11 @@ local function allWords() list[#list+1] = postfix mark[postfix] = true end + local separator = config.get(scp.uri, 'Lua.completion.requireSeparator') + if not mark[separator] then + list[#list+1] = separator + mark[separator] = true + end end return list end |