1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-09 08:00:05 +08:00

fix(projectmanager): remove log info

This commit is contained in:
wsdjeg 2022-10-26 17:35:33 +08:00
parent d3a2916dc8
commit 665727ada3
2 changed files with 15 additions and 13 deletions

View File

@ -200,6 +200,7 @@ function! SpaceVim#autocmds#VimEnter() abort
call SpaceVim#layers#core#tabline#def_colors() call SpaceVim#layers#core#tabline#def_colors()
set showtabline=2 set showtabline=2
endif endif
call SpaceVim#logger#info('run root changed callback on VimEnter!')
call SpaceVim#plugins#projectmanager#RootchandgeCallback() call SpaceVim#plugins#projectmanager#RootchandgeCallback()
if !empty(get(g:, '_spacevim_bootstrap_after', '')) if !empty(get(g:, '_spacevim_bootstrap_after', ''))
try try

View File

@ -139,11 +139,11 @@ end
local function change_dir(dir) local function change_dir(dir)
if dir == sp_file.unify_path(fn.getcwd()) then if dir == sp_file.unify_path(fn.getcwd()) then
logger.debug('same as current directory, no need to change.') logger.debug('same as current directory, no need to change.')
return false
else else
if dir ~= nil then logger.info('change to root: ' .. dir)
logger.info('change to root: ' .. dir) sp.cmd(cd .. ' ' .. sp.fn.fnameescape(sp.fn.fnamemodify(dir, ':p')))
sp.cmd(cd .. ' ' .. sp.fn.fnameescape(sp.fn.fnamemodify(dir, ':p'))) return true
end
end end
end end
@ -170,14 +170,14 @@ end
local function find_root_directory() local function find_root_directory()
local fd = fn.bufname('%') local fd = fn.bufname('%')
if fn == '' then if fd == '' then
logger.debug('bufname is empty') logger.debug('bufname is empty, use current directory instead!')
fd = fn.getcwd() fd = fn.getcwd()
end end
logger.debug('start to find root for: ' .. fd) logger.debug('start to find root for: ' .. fd)
local dirs = {} local dirs = {}
logger.debug('searching rooter_patterns:' .. vim.inspect(project_rooter_patterns))
for _, pattern in pairs(project_rooter_patterns) do for _, pattern in pairs(project_rooter_patterns) do
logger.debug('searching rooter_patterns:' .. pattern)
local find_path = '' local find_path = ''
if string.sub(pattern, -1) == '/' then if string.sub(pattern, -1) == '/' then
if sp_opt.project_rooter_outermost == 1 then if sp_opt.project_rooter_outermost == 1 then
@ -245,10 +245,10 @@ if sp_opt.enable_projects_cache == 1 then
end end
sp.cmd([[ sp.cmd([[
let g:unite_source_menu_menus = get(g:,'unite_source_menu_menus',{}) let g:unite_source_menu_menus = get(g:,'unite_source_menu_menus',{})
let g:unite_source_menu_menus.Projects = {'description': 'Custom mapped keyboard shortcuts [SPC] p p'} let g:unite_source_menu_menus.Projects = {'description': 'Custom mapped keyboard shortcuts [SPC] p p'}
let g:unite_source_menu_menus.Projects.command_candidates = get(g:unite_source_menu_menus.Projects,'command_candidates', []) let g:unite_source_menu_menus.Projects.command_candidates = get(g:unite_source_menu_menus.Projects,'command_candidates', [])
]]) ]])
if sp_opt.project_auto_root == 1 then if sp_opt.project_auto_root == 1 then
sp.cmd('augroup spacevim_project_rooter') sp.cmd('augroup spacevim_project_rooter')
@ -382,8 +382,9 @@ function M.current_root()
end end
fn.setbufvar('%', 'rootDir', rootdir) fn.setbufvar('%', 'rootDir', rootdir)
end end
change_dir(rootdir) if change_dir(rootdir) then
M.RootchandgeCallback() M.RootchandgeCallback()
end
return rootdir return rootdir
end end