1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-13 15:18:00 +08:00

perf(projectmanager): improve projectmanager log format

This commit is contained in:
wsdjeg 2022-10-29 14:47:29 +08:00
parent c25c711d50
commit a6baae5924

View File

@ -138,10 +138,8 @@ local function compare_time(d1, d2)
end 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.')
return false return false
else else
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 return true
end end
@ -297,10 +295,11 @@ function M.current_name()
end end
function M.RootchandgeCallback() function M.RootchandgeCallback()
-- this function only will be called when switch to other project.
local path = sp_file.unify_path(fn.getcwd(), ':p') local path = sp_file.unify_path(fn.getcwd(), ':p')
local name = fn.fnamemodify(path, ':h:t') local name = fn.fnamemodify(path, ':h:t')
logger.debug('project name is:' .. name) logger.info('switch to project:[' .. name .. ']')
logger.debug('project path is:' .. path) logger.info(' rootdir is:' .. path)
local project = { local project = {
['path'] = path, ['path'] = path,
['name'] = name, ['name'] = name,