mirror of
https://github.com/neovim/neovim.git
synced 2026-11-02 09:49:02 -06:00
fix(lua): don't remove first char of non-file stacktrace source (#37008)
This commit is contained in:
1 parent
c172fd9f46
commit
c08139d790
5 files changed
+5
-5
No files matched your search
+1
-1
@@ -236,7 +236,7 @@ Note:
|
|||||||
|
|
||||||
*lua-script-location*
|
*lua-script-location*
|
||||||
To get its own location, Lua scripts/modules can use |debug.getinfo()|: >
|
To get its own location, Lua scripts/modules can use |debug.getinfo()|: >
|
||||||
debug.getinfo(1, 'S').source:sub(2)
|
debug.getinfo(1, 'S').source:gsub('^@', '')
|
||||||
<
|
<
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|||||||
@@ -1252,7 +1252,7 @@ local function traceback()
|
|||||||
if not info then
|
if not info then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
local msg = (' %s:%s'):format(info.source:sub(2), info.currentline)
|
local msg = (' %s:%s'):format(info.source:gsub('^@', ''), info.currentline)
|
||||||
table.insert(backtrace, msg)
|
table.insert(backtrace, msg)
|
||||||
level = level + 1
|
level = level + 1
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -492,7 +492,7 @@ function M._profile(opts)
|
|||||||
|
|
||||||
if opts and opts.loaders then
|
if opts and opts.loaders then
|
||||||
for l, loader in pairs(loaders) do
|
for l, loader in pairs(loaders) do
|
||||||
local loc = debug.getinfo(loader, 'Sn').source:sub(2)
|
local loc = debug.getinfo(loader, 'Sn').source:gsub('^@', '')
|
||||||
loaders[l] = track('loader ' .. l .. ': ' .. loc, loader)
|
loaders[l] = track('loader ' .. l .. ': ' .. loc, loader)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -895,7 +895,7 @@ end
|
|||||||
|
|
||||||
--- @return string
|
--- @return string
|
||||||
local function get_script_path()
|
local function get_script_path()
|
||||||
local str = debug.getinfo(2, 'S').source:sub(2)
|
local str = debug.getinfo(2, 'S').source:gsub('^@', '')
|
||||||
return str:match('(.*[/\\])') or './'
|
return str:match('(.*[/\\])') or './'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1243,7 +1243,7 @@ describe('user config init', function()
|
|||||||
string.format(
|
string.format(
|
||||||
[[
|
[[
|
||||||
vim.g.exrc_file = "%s"
|
vim.g.exrc_file = "%s"
|
||||||
vim.g.exrc_path = debug.getinfo(1, 'S').source:sub(2)
|
vim.g.exrc_path = debug.getinfo(1, 'S').source:gsub('^@', '')
|
||||||
vim.g.exrc_count = (vim.g.exrc_count or 0) + 1
|
vim.g.exrc_count = (vim.g.exrc_count or 0) + 1
|
||||||
]],
|
]],
|
||||||
exrc_path
|
exrc_path
|
||||||
|
|||||||
Reference in new issue
Block a user