diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-08-23 16:27:20 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-08-23 16:27:20 +0800 |
commit | 4220ff641c7c2dba943eefe3d0a2e6d99cc523c6 (patch) | |
tree | dc4a7c96334a6c977b48e15a2a9c5e5d296f5f3c /script | |
parent | edeadaad1c8b168e010236b72a0dfa5dfc43c915 (diff) | |
download | lua-language-server-4220ff641c7c2dba943eefe3d0a2e6d99cc523c6.zip |
cleanup
Diffstat (limited to 'script')
-rw-r--r-- | script/core/hint.lua | 13 | ||||
-rw-r--r-- | script/proto/define.lua | 6 | ||||
-rw-r--r-- | script/provider/provider.lua | 4 |
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 |