Skip to content

Commit 028460e

Browse files
committed
fix #847
1 parent 6924e8a commit 028460e

File tree

3 files changed

+65
-22
lines changed

3 files changed

+65
-22
lines changed

changelog.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# changelog
22

33
## 2.5.4
4+
* `FIX` [#847](https://github.com/sumneko/lua-language-server/issues/847)
45
* `FIX` [#848](https://github.com/sumneko/lua-language-server/issues/848)
56
* `FIX` completion: incorrect cache
67
* `FIX` hover: always view string

script/workspace/require-path.lua

-2
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,8 @@ function m.getVisiblePath(path)
6060
pos = currentPath:match('[/\\]+()', pos)
6161
if platform.OS == 'Windows' then
6262
searcher = searcher :gsub('[/\\]+', '\\')
63-
:gsub('^[/\\]+', '')
6463
else
6564
searcher = searcher :gsub('[/\\]+', '/')
66-
:gsub('^[/\\]+', '')
6765
end
6866
local expect = getOnePath(cutedPath, searcher)
6967
if expect then

test/crossfile/definition.lua

+64-20
Original file line numberDiff line numberDiff line change
@@ -891,25 +891,69 @@ print(t.<?x?>)
891891
}
892892
}
893893

894-
--config.set('Lua.runtime.path', {
895-
-- '/home/?.lua'
896-
--})
897-
--TEST {
898-
-- {
899-
-- path = '/home/a.lua',
900-
-- content = [[
901-
--return {
902-
-- <!x!> = 1,
903-
--}
904-
--]],
905-
-- },
906-
-- {
907-
-- path = 'b.lua',
908-
-- content = [[
909-
--local t = require 'a'
910-
--print(t.<?x?>)
911-
-- ]]
912-
-- }
913-
--}
894+
config.set('Lua.runtime.path', {
895+
'/home/?.lua'
896+
})
897+
TEST {
898+
{
899+
path = '/home/a.lua',
900+
content = [[
901+
return {
902+
<!x!> = 1,
903+
}
904+
]],
905+
},
906+
{
907+
path = 'b.lua',
908+
content = [[
909+
local t = require 'a'
910+
print(t.<?x?>)
911+
]]
912+
}
913+
}
914914

915+
config.set('Lua.runtime.pathStrict', true)
916+
config.set('Lua.runtime.path', {
917+
'./?.lua'
918+
})
919+
TEST {
920+
{
921+
path = 'a.lua',
922+
content = [[
923+
return {
924+
<!x!> = 1,
925+
}
926+
]],
927+
},
928+
{
929+
path = 'b.lua',
930+
content = [[
931+
local t = require 'a'
932+
print(t.<?x?>)
933+
]]
934+
}
935+
}
936+
937+
config.set('Lua.runtime.path', {
938+
'/home/?.lua'
939+
})
940+
TEST {
941+
{
942+
path = '/home/a.lua',
943+
content = [[
944+
return {
945+
<!x!> = 1,
946+
}
947+
]],
948+
},
949+
{
950+
path = 'b.lua',
951+
content = [[
952+
local t = require 'a'
953+
print(t.<?x?>)
954+
]]
955+
}
956+
}
957+
958+
config.set('Lua.runtime.pathStrict', false)
915959
config.set('Lua.runtime.path', originRuntimePath)

0 commit comments

Comments
 (0)