summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-08-01 15:39:13 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-08-01 15:39:13 +0800
commitc2340047debdfa00c1946a113008f7982f68dcb7 (patch)
tree9d388739cb0809f7fc93f0ed1ff1610d3328e7f8 /test
parentf18a56604200f7ac19a785f6ce52cb7be67979e6 (diff)
downloadlua-language-server-c2340047debdfa00c1946a113008f7982f68dcb7.zip
fix #1418
Diffstat (limited to 'test')
-rw-r--r--test/full/projects.lua2
-rw-r--r--test/tclient/init.lua1
-rw-r--r--test/tclient/tests/hover-set-local.lua45
3 files changed, 47 insertions, 1 deletions
diff --git a/test/full/projects.lua b/test/full/projects.lua
index dedb42e5..dacc101c 100644
--- a/test/full/projects.lua
+++ b/test/full/projects.lua
@@ -57,4 +57,4 @@ local function doProjects(pathname)
end
--doProjects [[C:\SSSEditor\client\Output\Lua]]
-doProjects [[C:\W3-Server\script]]
+--doProjects [[C:\W3-Server\script]]
diff --git a/test/tclient/init.lua b/test/tclient/init.lua
index 828b5d6f..6f861142 100644
--- a/test/tclient/init.lua
+++ b/test/tclient/init.lua
@@ -10,4 +10,5 @@ require 'tclient.tests.hover-pairs'
require 'tclient.tests.change-workspace-folder'
require 'tclient.tests.jump-source'
require 'tclient.tests.load-relative-library'
+require 'tclient.tests.hover-set-local'
require 'tclient.tests.build-meta'
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)