-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Local classes are recognized by lemmy-help but their methods aren't #66
Comments
If you look closely
Yes, ---@private
---@class Baz
local Baz = {} |
Oh, I think I got confused by Isn't this a problem though? I was kind of hoping lemmy-help parses its annotations in a similar way to Sumneko, where having a |
Well, sumneko's lua parser is designed to work with its LSP server. So, it's natural that it knows more about code than lemmy-help straight & simple top-down parser. And fun part, lemmy-help only parses the code that it needs to be able to generate help doc. |
What if we could manually annotate it? Something like: ---@owner Baz
function Baz:qux()
end Then lemmy-help will know that this function belongs to |
What's the point of it? In your example you are exporting |
My actual usecase is this: https://github.com/idanarye/nvim-channelot/blob/main/lua/channelot/init.lua But that's may be too long to read and discuss, so consider this: ---@mod my_module
local M = {}
---@class Foo
local Foo = {}
function Foo:bar()
end
---@return Foo
function M.make_foo()
end
return M I'm not exporting Still - users can get their hand on an instance of |
Also, it could be a workaround to the three-idents-name problem. |
How? You are only exporting |
local my_module = require('my_module')
local foo_instance = my_module.make_foo()
foo_instance:bar() |
Ahh, Now I understand. I was keep thinking about the same file. Hmm, it's an interesting use case. I guess we can directly look for exported identifiers, let say
|
What was the intended use then? Were classes supposed to be their own files, so each file is either a class or a bundle of free functions? |
That's subjective, You could separate classes into their own files. But you can also use |
I've created this file:
The I ran lemmy-help version 0.10.0 on it:
The
Foo
class was exported and its methodbar
was recognized by lemmy-help, butqux
did not get an entry even though its classBaz
did. Is it becauseBaz
is declaredlocal
? But these classes' methods should still get into the docs because users can still get them via functions.The text was updated successfully, but these errors were encountered: