summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelog.md1
-rw-r--r--script/core/hover/description.lua3
-rw-r--r--script/jsonrpc.lua1
-rw-r--r--test/crossfile/hover.lua18
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.<?firstField?> = 0
+food.secondField = 2
+]]
+},
+hover = {
+ label = 'field Food.firstField: integer = 0',
+ name = 'food.firstField',
+}}