-
-
Notifications
You must be signed in to change notification settings - Fork 330
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
---@alias
es don't work in v3.x as they did in v2.6.8
#1061
Comments
---@alias
es don't work in v3.x as they did in v2.6.8
see #980 |
Such a shame. This allowed providing autocomplete for functions with enumeration constants in a separate table. That also means that there are some |
The new syntax will be used to implement this function in the plan: ---@alias ngx.log.level
---| `ngx.DEBUG` # debug
---| `ngx.INFO` # info
---| `ngx.NOTICE` # notice |
Nice. Also, it does make sense to treat the values inside |
Thanks for responding quickly. Your project is so good! |
Have supported, need to update meta files |
Thanks @sumneko! I am trying to update the OpenResty annotations for this now and running into a hiccup. Right now completion support isn't working how I expect. Can you tell me if I'm doing something wrong here? ---@class ns
local ns = {}
ns.A = 1 ---@class ns.A
ns.B = 2 ---@class ns.B
---@alias ClassEnum
---| `ns.A`
---| `ns.B`
---@param e ClassEnum
local function foo(e)
print(e)
return e
end
foo(ns.A)
---@alias IntEnum
---| 1
---| 2
---@param e IntEnum
local function bar(e)
print(e)
return e
end hover works as expected for However, |
Hi @flrgh! According to the commit that implements this feature, it is now supposed to be written as: ---@type `CONST.X` | `CONST.Y`
local x
if x == -- suggest `CONST.X` and `CONST.Y` here So, a new local table with the constants needs to be constructed and then used as a parameter to functions that accept those. |
@flrgh this feature dose not include in v3.2.5, please checkout master |
Thanks for implementing this! |
Describe the bug
In v3.x fields defined in
---@alias
with''
get converted to string literals (inside""
). That wasn't the behavior of the older versions.To Reproduce
Steps to reproduce the behavior, use the following code:
Expected behavior
The expected behavior is the behavior from v2.6.8. The alias entries enclosed in single
''
shouldn't be converted to string literals (enclosed with""
).Screenshots
What the autocomplete expands to.
v2.6.8:
Environment:
Additional context
If there is a reason why this is changed, could you instruct me on how to achieve the same result with a different approach?
The text was updated successfully, but these errors were encountered: