-
Notifications
You must be signed in to change notification settings - Fork 40
Fix doc tag associations, warn about useless tags #647
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
Conversation
This commit fixes doc tag association for tags that appear after `@class` and other decls. It affects `@see`, `@return_cast`, `@source`, `@version`, `@deprecated`, visibility tags and custom (other) tags. It also adds diagnostics for doc tags that couldn't be attached to any object, and therefore are ignored. Fix EmmyLuaLs#575.
pub fn get_owner_id(analyzer: &mut DocAnalyzer) -> Option<LuaSemanticDeclId> { | ||
if let Some(current_type_id) = &analyzer.current_type_id { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: this is the main change, the rest is just error reporting.
Thank you so much! |
In Neovim we use other custom tags (e.g. We disable I think |
Sorry to do that again, but this PR introduced a regression (on nvim-treesitter, main branch):
---@alias nvim-ts.parsers table<string,ParserInfo> |
This is not a regression, |
This warning happens when a tag has no effect, i.e. it's not attached to anything. Unless you roll a custom source parser, there's really no point in disabling these warnings. Can you elaborate on how you use custom tags? |
The regression is that it now does: it throws an error where it didn't before (and doesn't anymore now). |
Then it should be a hint (like unused variable or unnecessary assert), not a hard error! |
Maybe we should demote Meanwhile, you can set a custom level for {
"diagnostics": {
"severity": {
"annotation-usage-error": "warning"
}
}
} For context, right now, there's only one additional case when we emit |
(My issue is already fixed, so I'm not going to open an issue about it.) |
BTW you can add custom tags into {
"doc": {
"knownTags": ["foo", ...]
}
} |
We have a custom parser, rolled with lpeg. We currently use the tags |
We use this to coerce the type of the expression in the return statement. Afaik this works in LuaLS. It should be semantically equivalent to. --- @type TYPE
local ret = EXPR
return ret |
The behavior is incorrect; |
As of right now, it doesn't have any effect. |
This commit fixes doc tag association for tags that appear after
@class
and other decls. It affects@see
,@return_cast
,@source
,@version
,@deprecated
, visibility tags and custom (other) tags.It also adds diagnostics for doc tags that couldn't be attached to any object, and therefore are ignored.
Fix #575.