From 3ce90e014efa2262bbb4e34c6c686b04d5455cf6 Mon Sep 17 00:00:00 2001 From: Tom Lau Date: Thu, 16 Jan 2025 20:33:28 +0800 Subject: [PATCH] fix: bind variables with `@class` using tail comments --- changelog.md | 1 + script/parser/luadoc.lua | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 30926783a..313cb53bf 100644 --- a/changelog.md +++ b/changelog.md @@ -15,6 +15,7 @@ * `FIX` Fixed the error that the configuration file pointed to by the `--configpath` option was not read and loaded. * `FIX` Generic return can be optional. * `FIX` Fixed the comment calculating in docs `---@param a string?Comment` - now its `Comment` instead of `omment`. +* `FIX` Fixed cannot bind variables using tail comment `@class` [#2673](https://github.com/LuaLS/lua-language-server/issues/2673) * `NEW` `---@class` supports attribute `partial`, which will not check missing inherited fields [#3023](https://github.com/LuaLS/lua-language-server/issues/3023) ```lua ---@class Config diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua index d0a1d38c6..72e5dc18d 100644 --- a/script/parser/luadoc.lua +++ b/script/parser/luadoc.lua @@ -2181,7 +2181,7 @@ local function bindDocs(state) if doc.specialBindGroup then bindDocWithSources(sources, doc.specialBindGroup) binded = nil - elseif isTailComment(text, doc) and doc.type ~= "doc.class" and doc.type ~= "doc.field" then + elseif isTailComment(text, doc) and doc.type ~= "doc.field" then bindDocWithSources(sources, binded) binded = nil else