-
-
Notifications
You must be signed in to change notification settings - Fork 369
Description
How are you using the lua-language-server?
Kakoune
Which OS are you using?
MacOS
What is the issue affecting?
Other
Expected Behaviour
When a module is written by assigning functions to table members with the following syntax:
local lib={}
lib.func = function()
-- ...
end
return lib
Performing a "Go to definition" on this function from another file that require
s the module should go to the function defintion.
Actual Behaviour
Instead when doing a "Go to defintion", there are 2 results, and the user must choose one. They both point to the same line, one points to the table member's name and the other to the start of the function
declaration.

Reproduction steps
- Create a project with two files,
lib.lua
andother.lua
, and populate them as follows:
lib.lua
:
local lib={}
lib.func = function() end
return lib
other.lua
:
local lib = require('lib')
lib.func()
-
From
other.lua
, perform a "Go to definition" onfunc
. Note that it has two results that must be chosen, one will take you to the table member's name, and the other will take you to the start of the function declaration. -
Change
lib.lua
to:
local lib={}
function lib.func() end
return lib
- From
other.lua
, perform a "Go to definition" onfunc
. It takes you directly to the start of the function declaration (which is also the table member's name).
Additional Notes
I know that the function lib.func()
syntax is preferred, but this is an issue for me when using libraries that use the lib.func = function()
syntax. I wasn't able to find any discussions of this issue, but it seems likely that others have run into it, so I am wondering if there is a solution that I just haven't found.