Skip to content

Duplicated (field and function) completion items for recursively called functions in module #613

Closed
@smackesey

Description

@smackesey

Describe the bug

Both a field and a function completion item are generated for functions that are called recursively in a module. Only a function item should be generated.

To Reproduce
Steps to reproduce the behavior:

Create this module:

# test.lua
local m = {}

function m.myfunc(n)
  print(n)
  if n == 1 then return
  else m.myfunc(n-1)
  end
end

function m.myotherfunc(n)
  print(n)
end

return m

Then require it in another module and look at the provided completions:

# test_other.lua

local test = require('test')

test. -- cursor here

I get three completion items from test (text representation here is from coc, but that's incidental):

  • myfunc~ m [LS]
  • myfunc(n)~ S [LS]
  • myotherfunc(n)~ S [LS]

Expected behavior

The first completion item should not show up.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: macOS big sur
  • Is WSL remote?
  • Client: Neovim 0.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions