diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-01-30 19:17:05 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-01-30 19:17:05 +0800 |
commit | 438056d664afab8a2a89f817892be690b557e052 (patch) | |
tree | 8428c3e12a035c9e528dc2e3469df9333570b083 /script/provider/provider.lua | |
parent | 219db07808f65eecf81fd0ad8408bb2a8615272c (diff) | |
download | lua-language-server-438056d664afab8a2a89f817892be690b557e052.zip |
add setting of typeHint
Diffstat (limited to 'script/provider/provider.lua')
-rw-r--r-- | script/provider/provider.lua | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/script/provider/provider.lua b/script/provider/provider.lua index 6c042f7a..be9b6fc9 100644 --- a/script/provider/provider.lua +++ b/script/provider/provider.lua @@ -736,23 +736,26 @@ proto.on('$/didChangeVisibleRanges', function (params) end -- compute type-hint - for _, range in ipairs(params.ranges) do - local start, finish = files.unrange(uri, range) - local piece = typeHint(uri, start, finish) - if piece then - for _, edit in ipairs(piece) do - edits[#edits+1] = { - newText = edit.newText, - range = files.range(uri, edit.start, edit.finish) - } + if config.config.typeHint.enable then + local _ <close> = progress.create(lang.script.WINDOW_PROCESSING_TYPE_HINT, 0.5) + for _, range in ipairs(params.ranges) do + local start, finish = files.unrange(uri, range) + local piece = typeHint(uri, start, finish) + if piece then + for _, edit in ipairs(piece) do + edits[#edits+1] = { + newText = edit.newText, + range = files.range(uri, edit.start, edit.finish) + } + end end end + if #edits == 0 then + return + end + proto.notify('$/typeHint', { + uri = uri, + edits = edits, + }) end - if #edits == 0 then - return - end - proto.notify('$/typeHint', { - uri = uri, - edits = edits, - }) end) |