diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-01-17 21:12:15 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-01-17 21:12:15 +0800 |
commit | b6eed1d1f301706f51fc3dcef45f64ae4400eadd (patch) | |
tree | 89942f14778c012351a066b89c4dd87ac51ebf83 /test/tclient/tests | |
parent | c2d2e7a92461dafab0b3446cd30db67d00eed570 (diff) | |
download | lua-language-server-b6eed1d1f301706f51fc3dcef45f64ae4400eadd.zip |
stash
Diffstat (limited to 'test/tclient/tests')
-rw-r--r-- | test/tclient/tests/single-mode.lua | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/tclient/tests/single-mode.lua b/test/tclient/tests/single-mode.lua new file mode 100644 index 00000000..bdf831f4 --- /dev/null +++ b/test/tclient/tests/single-mode.lua @@ -0,0 +1,46 @@ +local await = require 'await' +local lclient = require 'tclient.lclient' +local ws = require 'workspace' +local util = require 'utility' + +---@async +lclient():start(function (client) + client:awaitRequest('initialize', { + clientInfo = { + name = 'unit-test', + version = 'single-mode', + }, + rootUri = nil, + }) + + client:notify('initialized') + + client:notify('textDocument/didOpen', { + textDocument = { + uri = 'test://single-file.lua', + languageId = 'lua', + version = 0, + text = [[ +local x +print(x) +]] + } + }) + + ws.awaitReady() + + local locations = client:awaitRequest('textDocument.definition', { + textDocument = { uri = 'test://single-file.lua' }, + position = { line = 1, character = 7 }, + }) + + assert(util.equal(locations, { + { + uri = 'test://single-file.lua', + range = { + start = { line = 0, character = 6 }, + ['end'] = { line = 0, character = 7 }, + } + } + })) +end) |