diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-11-29 19:59:00 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-11-29 19:59:00 +0800 |
commit | 7e374277a3d8b4dc3856b64772ce0c47650b7a8b (patch) | |
tree | c117f5ecae7f96b15da0c70ebd6ef1a02da5694b /script/provider/capability.lua | |
parent | c6271c7022c91a366b6c81ecda60e9946266c1bd (diff) | |
download | lua-language-server-7e374277a3d8b4dc3856b64772ce0c47650b7a8b.zip |
fix
Diffstat (limited to 'script/provider/capability.lua')
-rw-r--r-- | script/provider/capability.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/script/provider/capability.lua b/script/provider/capability.lua index 873fbfd3..4e63f571 100644 --- a/script/provider/capability.lua +++ b/script/provider/capability.lua @@ -11,6 +11,7 @@ require 'provider.inlay-hint' local m = {} m.fillings = {} +m.resolvedMap = {} local function mergeFillings(provider) for _, filling in ipairs(m.fillings) do @@ -29,6 +30,19 @@ local function mergeFillings(provider) end end +local function resolve(t) + for k, v in pairs(t) do + if type(v) == 'table' then + resolve(v) + end + if type(v) == 'string' then + t[k] = v:gsub('%{(.-)%}', function (key) + return m.resolvedMap[key] or '' + end) + end + end +end + function m.getProvider() local provider = { offsetEncoding = client.getOffsetEncoding(), @@ -52,6 +66,7 @@ function m.getProvider() nonil.disable() mergeFillings(provider) + resolve(provider) return provider end @@ -60,4 +75,8 @@ function m.filling(t) m.fillings[#m.fillings+1] = t end +function m.resolve(key, value) + m.resolvedMap[key] = value +end + return m |