From c2340047debdfa00c1946a113008f7982f68dcb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 1 Aug 2022 15:39:13 +0800 Subject: fix #1418 --- test/tclient/tests/hover-set-local.lua | 45 ++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 test/tclient/tests/hover-set-local.lua (limited to 'test/tclient/tests') diff --git a/test/tclient/tests/hover-set-local.lua b/test/tclient/tests/hover-set-local.lua new file mode 100644 index 00000000..cf99aebc --- /dev/null +++ b/test/tclient/tests/hover-set-local.lua @@ -0,0 +1,45 @@ +local lclient = require 'lclient' +local ws = require 'workspace' +local await = require 'await' + +---@async +lclient():start(function (client) + client:registerFakers() + client:initialize() + + client:notify('textDocument/didOpen', { + textDocument = { + uri = 'file://test.lua', + languageId = 'lua', + version = 0, + text = [[ +---@class Class +local m + +---@return Class +function m:f() end + +---@type Class +local v +v = v:f() +]] + } + }) + + ws.awaitReady() + + await.sleep(0.1) + + local hover1 = client:awaitRequest('textDocument/hover', { + textDocument = { uri = 'file://test.lua' }, + position = { line = 7, character = 6 }, + }) + + local hover2 = client:awaitRequest('textDocument/hover', { + textDocument = { uri = 'file://test.lua' }, + position = { line = 8, character = 0 }, + }) + + assert(hover1.contents.value:find 'Class') + assert(hover2.contents.value:find 'Class') +end) -- cgit v1.2.3