diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-11-15 11:28:00 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-11-15 11:28:00 +0800 |
commit | 6f0e8df7934b9c41aac83a6c0b4b0f50a9b50871 (patch) | |
tree | 6e342aec35fea50fbfc3ecccdb17e0b5f31c5965 /script/vm/infer.lua | |
parent | 51ee59203868cfe1177403a06d74ae7412c78f4d (diff) | |
download | lua-language-server-6f0e8df7934b9c41aac83a6c0b4b0f50a9b50871.zip |
fix #1698
Diffstat (limited to 'script/vm/infer.lua')
-rw-r--r-- | script/vm/infer.lua | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/script/vm/infer.lua b/script/vm/infer.lua index 00f1b014..b9dfb29a 100644 --- a/script/vm/infer.lua +++ b/script/vm/infer.lua @@ -534,11 +534,11 @@ end ---@return string|number|boolean|nil function vm.viewKey(source, uri) if source.type == 'doc.type' then - if #source == 1 then - return vm.viewKey(source[1], uri) + if #source.types == 1 then + return vm.viewKey(source.types[1], uri) else local key = vm.viewObject(source, uri) - return '[' .. key .. ']', key + return '[' .. key .. ']' end end if source.type == 'tableindex' then @@ -564,6 +564,9 @@ function vm.viewKey(source, uri) if source.type == 'doc.type.field' then return vm.viewKey(source.name, uri) end + if source.type == 'doc.type.name' then + return '[' .. source[1] .. ']' + end local key = vm.getKeyName(source) if key == nil then return nil |