-
Notifications
You must be signed in to change notification settings - Fork 624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lua: function declared inside an object is not tagged correctly #1798
Comments
Thank you for contacting. The lua parser is incomplete to implement what you want quickly. For example, it doesn't capture Difficulties are in what kind of output do we want for a dynamic language like lua. Js input:
ctags output:
Capturing I tried the same thing in lua:
If I rewrite the lua parser, the parser may print:
How do you think about this output? Another question is Solving the above things I can work on the original issue you reported. |
Thanks for your reply, I hope it will be easy enough to rewrite the lua parser as you say. First of all, the thing that is most important for me to point out in this discussion, is that myVar = {
obj = 12,
myMethod = function()
end,
str = "bafsg"
}
myOtherVar = {
obj = 10,
myMethod = function(a, b)
return a, b
end,
str = "aaadsgsg"
} Currently it produces the following
Which gives text editors several locations to look for when searching for the definition of As for the In Lua, you can declare a function inside a table using both x = {
foo = function(a,b)
return a
end,
bar = function(a,b)
return b
end
} I'd consider the following tags file the best:
In addition, there is another issue which perplexes me: myVar = {
obj = 12,
myMethod = function()
end,
str = "bafsg"
}
return myVar And it is being loaded in another lua file with foo:myMethod foo.lua /^ myMethod = function()$/;" f (Since the myVar:myMethod foo.lua /^ myMethod = function()$/;" f ? |
I'm very interested in improvement of Lua's parser. There's a lot of things to consider, but it looks like it should kinda work like JS/Python/Ruby parsers which are pretty good, as far as I know. @masatake, what would be a good starting point for improving the parser? |
@eliasdaler, thank you!
Give variety input to the JavaScript parser, and see the output.
|
@doronbehar, thank you. Ctags is not an interpreter nor compiler. So I think tagging
Instead, just tagging tags file can have fields names scope.
By extending or rewriting the lua parser, ctags can emit:
See As I wrote to @eliasdaler, providing low-level information to a client tool like an editor is the mission of ctags though some parsers violate this principle. However, I know tag entries, Following example shows how
|
@masatake, that's a great suggestion, using something like It is clear to me that the text editor should be prepared to read the |
wait for complete. If the plugin can write by golang, I want to contribute. |
The name of the parser:
lua
The command line you used to run ctags:
The content of input file:
The tags output you are not satisfied with:
The tags output you expect:
The version of ctags:
ctags
was build from source from this repository.The text was updated successfully, but these errors were encountered: