-
-
Notifications
You must be signed in to change notification settings - Fork 619
fix(hover): fix bad column offset at start #2629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Change looks good, however I'm not able to replicate the problem to verify the fix. Can you please provide a clean room replication and steps to reproduce? |
I'll try to provide it later. |
local thisInitFile = debug.getinfo(1).source:match('@?(.*)')
local configDir = vim.fs.dirname(thisInitFile)
vim.env['XDG_CONFIG_HOME'] = configDir
vim.env['XDG_DATA_HOME'] = vim.fs.joinpath(configDir, '.xdg/data')
vim.env['XDG_STATE_HOME'] = vim.fs.joinpath(configDir, '.xdg/state')
vim.env['XDG_CACHE_HOME'] = vim.fs.joinpath(configDir, '.xdg/cache')
local stdPathConfig = vim.fn.stdpath('config')
vim.opt.runtimepath:prepend(stdPathConfig)
vim.opt.packpath:prepend(stdPathConfig)
local function gitClone(url, installPath, branch)
if vim.fn.isdirectory(installPath) ~= 0 then
return
end
local command = {'git', 'clone', '--', url, installPath}
if branch then
table.insert(command, 3, '--branch')
table.insert(command, 4, branch)
end
local sysObj = vim.system(command, {}):wait()
if sysObj.code ~= 0 then
error(sysObj.stderr)
end
vim.notify(sysObj.stdout)
vim.notify(sysObj.stderr, vim.log.levels.WARN)
end
local pluginsPath = 'plugins'
vim.fn.mkdir(pluginsPath, 'p')
pluginsPath = vim.uv.fs_realpath(pluginsPath)
local plugins = {
['nvim-tree'] = {url = 'https://github.com/nvim-tree/nvim-tree.lua'},
['statuscol.nvim'] = {url = 'https://github.com/luukvbaal/statuscol.nvim'},
}
for name, repo in pairs(plugins) do
local installPath = vim.fs.joinpath(pluginsPath, name)
gitClone(repo.url, installPath, repo.branch)
vim.opt.runtimepath:append(installPath)
end
require("nvim-tree").setup {
view = {
signcolumn = 'no',
},
renderer = {
full_name = true,
},
}
local builtin = require('statuscol.builtin')
require('statuscol').setup({
segments = {
{text = {builtin.lnumfunc, ' '}}, -- these spaces turn out relevant ;)
}
})
local treeapi = require('nvim-tree.api')
local path = vim.uv.cwd() .. './plugins/nvim-tree/lua/nvim-tree/diagnostics.lua'
treeapi.tree.open({path = vim.uv.cwd(), find_file = true}) Let's give the init file some very long name init='iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiinit.lua'; nvim --clean -u "$init" "$init" |
I tested it on master branch of nvim, where statuscol should be used from branch local thisInitFile = debug.getinfo(1).source:match('@?(.*)')
local configDir = vim.fs.dirname(thisInitFile)
vim.env['XDG_CONFIG_HOME'] = configDir
vim.env['XDG_DATA_HOME'] = vim.fs.joinpath(configDir, '.xdg/data')
vim.env['XDG_STATE_HOME'] = vim.fs.joinpath(configDir, '.xdg/state')
vim.env['XDG_CACHE_HOME'] = vim.fs.joinpath(configDir, '.xdg/cache')
local stdPathConfig = vim.fn.stdpath('config')
vim.opt.runtimepath:prepend(stdPathConfig)
vim.opt.packpath:prepend(stdPathConfig)
local function gitClone(url, installPath, branch)
if vim.fn.isdirectory(installPath) ~= 0 then
return
end
local command = {'git', 'clone', '--', url, installPath}
if branch then
table.insert(command, 3, '--branch')
table.insert(command, 4, branch)
end
local sysObj = vim.system(command, {}):wait()
if sysObj.code ~= 0 then
error(sysObj.stderr)
end
vim.notify(sysObj.stdout)
vim.notify(sysObj.stderr, vim.log.levels.WARN)
end
local pluginsPath = 'plugins'
vim.fn.mkdir(pluginsPath, 'p')
pluginsPath = vim.uv.fs_realpath(pluginsPath)
local plugins = {
['nvim-tree'] = {url = 'https://github.com/nvim-tree/nvim-tree.lua'},
['statuscol.nvim'] = {url = 'https://github.com/luukvbaal/statuscol.nvim', branch = '0.10'},
}
for name, repo in pairs(plugins) do
local installPath = vim.fs.joinpath(pluginsPath, name)
gitClone(repo.url, installPath, repo.branch)
vim.opt.runtimepath:append(installPath)
end
local builtin = require('statuscol.builtin')
require("nvim-tree").setup {
view = {
signcolumn = 'no',
},
renderer = {
full_name = true,
},
}
require('statuscol').setup({
segments = {
{text = {builtin.lnumfunc, ' '}}, -- these spaces turn out relevant ;)
}
})
local treeapi = require('nvim-tree.api')
treeapi.tree.open({path = vim.uv.cwd(), find_file = true}) |
require('statuscol').setup({
ft_ignore = {'NvimTree'},
segments = {
{text = {builtin.lnumfunc, ' '}}, -- these spaces turn out relevant ;)
}
}) allows to work the problem around. |
Thanks for all the details; I'll get to this on the weekend. |
Took me a while... looks good on nvim master and 0.9 Next time please give a reproducer that works with nvim released... changing all those vim.fs and removing the joinpaths took a while |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many thanks for your contribution!
Good point: I did not check it on any stable version and didn't even mention what version I used to reproduction. |
No worries! Your work is gratefully appreciated. 0.9 -> 0.10 is a big one and we need to be mindful of both when testing now, although backwards compatibility is "guaranteed". |
No description provided.