summaryrefslogtreecommitdiff
path: root/script/provider/capability.lua
diff options
context:
space:
mode:
Diffstat (limited to 'script/provider/capability.lua')
-rw-r--r--script/provider/capability.lua19
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