summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script/core/hint.lua13
-rw-r--r--script/proto/define.lua6
-rw-r--r--script/provider/provider.lua4
3 files changed, 15 insertions, 8 deletions
diff --git a/script/core/hint.lua b/script/core/hint.lua
index 4050ccf9..accb8149 100644
--- a/script/core/hint.lua
+++ b/script/core/hint.lua
@@ -4,6 +4,7 @@ local vm = require 'vm'
local config = require 'config'
local guide = require 'parser.guide'
local await = require 'await'
+local define = require 'proto.define'
local function typeHint(uri, edits, start, finish)
local ast = files.getState(uri)
@@ -58,9 +59,9 @@ local function typeHint(uri, edits, start, finish)
end
mark[src] = true
edits[#edits+1] = {
- newText = (':%s'):format(view),
- start = src.finish,
- finish = src.finish,
+ text = view,
+ offset = src.finish,
+ kind = define.InlayHintKind.Type,
}
end)
end
@@ -145,9 +146,9 @@ local function paramName(uri, edits, start, finish)
mark[arg] = true
if args[i] and args[i] ~= '' then
edits[#edits+1] = {
- newText = ('%s:'):format(args[i]),
- start = arg.start,
- finish = arg.start - 1,
+ text = args[i],
+ offset = arg.start,
+ kind = define.InlayHintKind.Parameter,
}
end
end
diff --git a/script/proto/define.lua b/script/proto/define.lua
index 9fbbea35..2e61bc3e 100644
--- a/script/proto/define.lua
+++ b/script/proto/define.lua
@@ -301,4 +301,10 @@ m.BuiltinClass = {
['Function'] = true,
}
+m.InlayHintKind = {
+ Other = 0,
+ Type = 1,
+ Parameter = 2,
+}
+
return m
diff --git a/script/provider/provider.lua b/script/provider/provider.lua
index 6ffb0837..4734686b 100644
--- a/script/provider/provider.lua
+++ b/script/provider/provider.lua
@@ -821,8 +821,8 @@ do
if piece then
for _, edit in ipairs(piece) do
edits[#edits+1] = {
- newText = edit.newText,
- range = files.range(uri, edit.start, edit.finish)
+ newText = ':' .. edit.text,
+ range = files.range(uri, edit.offset, edit.offset)
}
end
end