Skip to content

Commit

Permalink
fix #847
Browse files Browse the repository at this point in the history
  • Loading branch information
sumneko committed Dec 16, 2021
1 parent 6924e8a commit 028460e
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 22 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# changelog

## 2.5.4
* `FIX` [#847](https://github.com/sumneko/lua-language-server/issues/847)
* `FIX` [#848](https://github.com/sumneko/lua-language-server/issues/848)
* `FIX` completion: incorrect cache
* `FIX` hover: always view string
Expand Down
2 changes: 0 additions & 2 deletions script/workspace/require-path.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,8 @@ function m.getVisiblePath(path)
pos = currentPath:match('[/\\]+()', pos)
if platform.OS == 'Windows' then
searcher = searcher :gsub('[/\\]+', '\\')
:gsub('^[/\\]+', '')
else
searcher = searcher :gsub('[/\\]+', '/')
:gsub('^[/\\]+', '')
end
local expect = getOnePath(cutedPath, searcher)
if expect then
Expand Down
84 changes: 64 additions & 20 deletions test/crossfile/definition.lua
Original file line number Diff line number Diff line change
Expand Up @@ -891,25 +891,69 @@ print(t.<?x?>)
}
}

--config.set('Lua.runtime.path', {
-- '/home/?.lua'
--})
--TEST {
-- {
-- path = '/home/a.lua',
-- content = [[
--return {
-- <!x!> = 1,
--}
--]],
-- },
-- {
-- path = 'b.lua',
-- content = [[
--local t = require 'a'
--print(t.<?x?>)
-- ]]
-- }
--}
config.set('Lua.runtime.path', {
'/home/?.lua'
})
TEST {
{
path = '/home/a.lua',
content = [[
return {
<!x!> = 1,
}
]],
},
{
path = 'b.lua',
content = [[
local t = require 'a'
print(t.<?x?>)
]]
}
}

config.set('Lua.runtime.pathStrict', true)
config.set('Lua.runtime.path', {
'./?.lua'
})
TEST {
{
path = 'a.lua',
content = [[
return {
<!x!> = 1,
}
]],
},
{
path = 'b.lua',
content = [[
local t = require 'a'
print(t.<?x?>)
]]
}
}

config.set('Lua.runtime.path', {
'/home/?.lua'
})
TEST {
{
path = '/home/a.lua',
content = [[
return {
<!x!> = 1,
}
]],
},
{
path = 'b.lua',
content = [[
local t = require 'a'
print(t.<?x?>)
]]
}
}

config.set('Lua.runtime.pathStrict', false)
config.set('Lua.runtime.path', originRuntimePath)

0 comments on commit 028460e

Please sign in to comment.