summaryrefslogtreecommitdiff
path: root/test/tclient
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-01-18 17:02:45 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-01-18 17:02:45 +0800
commit9e8901c5d09b4537a5741fd20dc5cc77c5a23dce (patch)
treee51ba03f013fcb40b994737f48ed60f10622b1ce /test/tclient
parentb7fdf179a9015e3bef83f89c5a0811f1a67ef4d0 (diff)
downloadlua-language-server-9e8901c5d09b4537a5741fd20dc5cc77c5a23dce.zip
`FIX` library files not recognized correctly
Diffstat (limited to 'test/tclient')
-rw-r--r--test/tclient/lclient.lua11
-rw-r--r--test/tclient/tests/library-ignore-limit.lua8
2 files changed, 15 insertions, 4 deletions
diff --git a/test/tclient/lclient.lua b/test/tclient/lclient.lua
index 52b72290..fa94481f 100644
--- a/test/tclient/lclient.lua
+++ b/test/tclient/lclient.lua
@@ -63,6 +63,11 @@ function mt:start(callback)
local finished = false
+ await.setErrorHandle(function (...)
+ local msg = log.error(...)
+ error(msg)
+ end)
+
---@async
await.call(function ()
callback(self)
@@ -144,7 +149,7 @@ function mt:update()
if callback then
proto.doResponse {
id = out.id,
- params = callback(out.params),
+ result = callback(out.params),
}
elseif out.method:sub(1, 2) ~= '$/' then
error('Unknown method: ' .. out.method)
@@ -164,10 +169,12 @@ end
function mt:registerFakers()
for _, method in ipairs {
+ 'textDocument/publishDiagnostics',
'workspace/configuration',
'workspace/semanticTokens/refresh',
'window/workDoneProgress/create',
- 'textDocument/publishDiagnostics',
+ 'window/showMessage',
+ 'window/logMessage',
} do
self:register(method, function ()
return nil
diff --git a/test/tclient/tests/library-ignore-limit.lua b/test/tclient/tests/library-ignore-limit.lua
index 66d6cc09..baf42978 100644
--- a/test/tclient/tests/library-ignore-limit.lua
+++ b/test/tclient/tests/library-ignore-limit.lua
@@ -3,6 +3,7 @@ local util = require 'utility'
local ws = require 'workspace'
local files = require 'files'
local furi = require 'file-uri'
+local fs = require 'bee.filesystem'
local libraryPath = LOGPATH .. '/large-file-library'
local largeFilePath = LOGPATH .. '/large-file-library/large-file.lua'
@@ -13,11 +14,14 @@ lclient():start(function (client)
client:register('workspace/configuration', function ()
return {
- ['Lua.workspace.library'] = { libraryPath }
+ {
+ ['workspace.library'] = { libraryPath }
+ },
}
end)
- util.saveFile(largeFilePath, string.rep('--this is a large file\n', 20000))
+ fs.create_directories(fs.path(libraryPath))
+ util.saveFile(largeFilePath, string.rep('--this is a large file\n', 100000))
client:initialize()