Alloyed / lua-lsp

A Lua language server
MIT License
288 stars 21 forks source link

Goto definition is not working on field methods #25

Closed pyericz closed 4 years ago

pyericz commented 5 years ago

I'm using neoclide/coc.nvim as language client support in my vim editor. However, when I move the cursor to self:foo() inside the module:bar() function, and try gd key, which is mapped to <Plug>(coc-definition), it will output the error about finding no definition.

local module = {}

function module:foo()
end

function module:bar()
    self:foo()
end
Alloyed commented 5 years ago

yep, tracked as #14. Right now there isn't a special case for self, but it would definitely be handy to assume that the first parameter of a method call is an object that looks like setmetatable({}, {__index = module}) and follow references/track mutations accordingly

Alloyed commented 4 years ago

duplicate