diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2023-06-13 21:00:02 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2023-06-13 21:00:02 +0800 |
commit | 484f993c6a1026b7eb04d48ff4aee00e2dcafd54 (patch) | |
tree | 2ca3a0da2c4bc39a0c58a2983bb033a1fbefc7ec /script/vm | |
parent | 2b5257d3d097c2726e5098a43c333aa20a461c2e (diff) | |
download | lua-language-server-484f993c6a1026b7eb04d48ff4aee00e2dcafd54.zip |
completion for quoted fields
fix #2088
Diffstat (limited to 'script/vm')
-rw-r--r-- | script/vm/infer.lua | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/script/vm/infer.lua b/script/vm/infer.lua index 94fdfd88..3bc0b3f7 100644 --- a/script/vm/infer.lua +++ b/script/vm/infer.lua @@ -565,11 +565,12 @@ function vm.viewKey(source, uri) return vm.viewKey(source.types[1], uri) else local key = vm.getInfer(source):view(uri) - return '[' .. key .. ']' + return '[' .. key .. ']', key end end if source.type == 'tableindex' - or source.type == 'setindex' then + or source.type == 'setindex' + or source.type == 'getindex' then local index = source.index local name = vm.getInfer(index):viewLiterals() if not name then @@ -587,7 +588,11 @@ function vm.viewKey(source, uri) return vm.viewKey(source.name, uri) end if source.type == 'doc.type.name' then - return '[' .. source[1] .. ']' + return '[' .. source[1] .. ']', source[1] + end + if source.type == 'doc.type.string' then + local name = util.viewString(source[1], source[2]) + return ('[%s]'):format(name), name end local key = vm.getKeyName(source) if key == nil then |