IntelliJ-EmmyLua icon indicating copy to clipboard operation
IntelliJ-EmmyLua copied to clipboard

Contents of init.lua not indexed for packages

Open posborne opened this issue 3 years ago • 0 comments

Environment(环境)

name version
IDEA version CLion 2020.3.3
EmmyLua version 1.3.5.194-IDEA203
OS Ubuntu 20.04

What are the steps to reproduce this issue?(重现步骤?)

  1. Define package with contents in an init.lua file under the directory
  2. Attempt to use code intelligence features that should detect functions, etc. defined in the init.lua file.

For instance, consider the following directory structure:

test.lua
mypkg/
   init.lua

In mypkg/init.lua, let's say we have the following:

-- mypkg/init.lua
local module = {}
module.greting = "hi"
return module
-- test.lua
local mypkg = require "mypkg"

print("mypkg says: ", mypkg.greeting)

What happens?(出现什么问题?)

Going to definition on the require target and on mypkg.greeting do not work. The default package.path used for lookups includes the pattern $base/?/init.lua which EmmyLua does not seem to consider.

Replacing test.lua with the following works but should not be necessary:

local mypkg = require "mypkg.init"

-- ...

What were you expecting to happen?(期望?)

EmmyLua should be aware of the init.lua lookup pattern and code intelligence features should look for this file.

Any logs, error output, etc?(有没有什么log, error输出?)

(If it’s long, please paste to https://ghostbin.com/ and insert the link here.)

Any other comments?(其它说明)

Thank you for building a great product! …

posborne avatar Mar 17 '21 19:03 posborne