From 81507913f43d51bd809575f166ed264e29bb07c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 13 Apr 2021 10:40:35 +0800 Subject: fix #502 --- changelog.md | 1 + script/core/hover/description.lua | 3 ++- script/jsonrpc.lua | 1 - test/crossfile/hover.lua | 18 ++++++++++++++++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 5622f6c9..c5832b37 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,7 @@ ## 1.20.4 `FIX` [#497](https://github.com/sumneko/lua-language-server/issues/497) +`FIX` [#502](https://github.com/sumneko/lua-language-server/issues/502) ## 1.20.3 `2021-4-6` diff --git a/script/core/hover/description.lua b/script/core/hover/description.lua index 72ff561f..14da4fcf 100644 --- a/script/core/hover/description.lua +++ b/script/core/hover/description.lua @@ -105,7 +105,8 @@ local function getBindComment(source, docGroup, base) break else continue = false - if doc.type == 'doc.field' then + if doc.type == 'doc.field' + or doc.type == 'doc.class' then lines = nil end end diff --git a/script/jsonrpc.lua b/script/jsonrpc.lua index 17e6e73d..8b8be6f2 100644 --- a/script/jsonrpc.lua +++ b/script/jsonrpc.lua @@ -2,7 +2,6 @@ local json = require 'json' local pcall = pcall local tonumber = tonumber local util = require 'utility' -local log = require 'brave.log' ---@class jsonrpc local m = {} diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua index c8c333f0..521f5a49 100644 --- a/test/crossfile/hover.lua +++ b/test/crossfile/hover.lua @@ -713,3 +713,21 @@ hover = { name = 'G.A', description = 'BBB' }} + +TEST {{ path = 'a.lua', content = '', }, { + path = 'b.lua', + content = [[ +---I am the class description. +---@class Food +---@field firstField number +---@field secondField number +local food = {} + +food. = 0 +food.secondField = 2 +]] +}, +hover = { + label = 'field Food.firstField: integer = 0', + name = 'food.firstField', +}} -- cgit v1.2.3