diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-12-06 20:02:08 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-12-06 20:02:08 +0800 |
commit | d060e870a5d24e3e575459a0e02d229d9234109a (patch) | |
tree | b04b4913015fc2c1888afe386d23a8e061eb53ca /test/crossfile | |
parent | b1a1b3f46771ac5461182a8156452517c280b153 (diff) | |
download | lua-language-server-d060e870a5d24e3e575459a0e02d229d9234109a.zip |
cleanup
Diffstat (limited to 'test/crossfile')
-rw-r--r-- | test/crossfile/hover.lua | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua index 86471936..82af9c32 100644 --- a/test/crossfile/hover.lua +++ b/test/crossfile/hover.lua @@ -41,20 +41,17 @@ end function TEST(expect) files.removeAll() - local targetScript, targetList = catch(expect[1].content, '?') - local targetUri = furi.encode(expect[1].path) - - local sourceScript, sourceList = catch(expect[2].content, '?') - local sourceUri = furi.encode(expect[2].path) - - files.setText(targetUri, targetScript) - files.setText(sourceUri, sourceScript) - - if targetList['?'] then - local targetPos = (targetList['?'][1][1] + targetList['?'][1][2]) // 2 - core.byUri(targetUri, targetPos) + local sourcePos, sourceUri + for _, file in ipairs(expect) do + local script, list = catch(file.content, '?') + local uri = furi.encode(file.path) + files.setText(uri, script) + if list['?'] then + sourceUri = uri + sourcePos = (list['?'][1][1] + list['?'][1][2]) // 2 + end end - local sourcePos = (sourceList['?'][1][1] + sourceList['?'][1][2]) // 2 + local hover = core.byUri(sourceUri, sourcePos) assert(hover) hover = tostring(hover):gsub('\r\n', '\n') |