lua-language-server icon indicating copy to clipboard operation
lua-language-server copied to clipboard

hover is not working as intended

Open qyte opened this issue 6 years ago • 7 comments

example follows

--a.lua local t = GlobalTable

t.settings = { test = 1 }

--b.lua

local b = GlobalTable.settings

print(b.test)

when hovering over settings i can see test = 1

when i type b. i get NO autocomplete and hovering over b says local b: any {} settings hover b hover

b shows test:any only because i hard coded it inside print. new b hover

Reverting to 0.21.12 for now

qyte avatar Nov 09 '20 21:11 qyte

Should be fixed in 1.0.2

sumneko avatar Nov 12 '20 03:11 sumneko

After version 2.0 this issue has again made it through of sorts

version 2.3.4 hover but the same exists for all version 2.x onwards image

version 1.21.3 (latest 1.x) image

a much cleaner hover that actually shows the values

qyte avatar Aug 09 '21 08:08 qyte

For performance reasons, I currently do not track the assignment of global variables to a local variable. It is recommended that you directly use global variables to define fields.

sumneko avatar Aug 09 '21 08:08 sumneko

I use lua for a WoW addon i maintain and since require is not supported there is literally no other way to share tables between files besides the namespace table provided by wow lua or using globals And i need to rely on/use subtables of subtables all the time

i use locals for shorthand access for easy auto-completion and hover for checking if i misstyped something somewhere.

qyte avatar Aug 09 '21 11:08 qyte

I am currently sacrificing some accuracy in exchange for performance optimization, but I continue to focus on this matter and explore better solutions that take into account accuracy and performance. In the worst case, I intend to provide options for you to customize whether to enable certain optimizations.

I will try some methods tomorrow to restore the search method mentioned in this issue.

sumneko avatar Aug 09 '21 13:08 sumneko

ok version 2.4.8 was working the best way possible but after the 2.4.9 onwards hover is broken again.

qyte avatar Dec 10 '21 08:12 qyte

@qyte see https://github.com/sumneko/lua-language-server/wiki/IntelliSense-optional-features

sumneko avatar Dec 10 '21 08:12 sumneko