refactor(status,help): Rename module and make naming more descriptive

This commit is contained in:
hedy
2023-11-24 17:16:44 +08:00
parent ecc814f846
commit 842f2c4a86
3 changed files with 13 additions and 7 deletions

View File

@@ -4,7 +4,7 @@ local utils = require('outline.utils')
local M = {}
function M.show_help()
function M.show_keymap_help()
local keyhint = 'Press q or <Esc> to close this window.'
local title = 'Current keymaps:'
local lines = { keyhint, '', title, '' }
@@ -90,7 +90,7 @@ function M.show_status(ctx)
if ctx.ft then
pref = 'Filetype of current or attached buffer: '
table.insert(lines, pref .. ctx.ft)
table.insert(hl, { line = #lines - 1, from = #pref, to = -1, name = 'OutlineStatusFt'})
table.insert(hl, { line = #lines - 1, from = #pref, to = -1, name = 'OutlineStatusFt' })
table.insert(lines, 'Symbols filter:')
table.insert(lines, '')
for _, line in ipairs(get_filter_list_lines(ctx.filter)) do
@@ -117,14 +117,20 @@ function M.show_status(ctx)
table.insert(lines, pref .. table.concat(priority, ', ') .. '.')
local i = #pref
for _, name in ipairs(priority) do
table.insert(hl, { line = #lines - 1, from = i, to = i + #name, name = 'OutlineStatusProvider' })
table.insert(
hl,
{ line = #lines - 1, from = i, to = i + #name, name = 'OutlineStatusProvider' }
)
i = i + #name + 2
end
else
pref = 'config '
local content = 'providers.priority'
table.insert(lines, pref .. content .. ' is an empty list!')
table.insert(hl, { line = #lines - 1, from = #pref, to = #pref + #content, name = 'OutlineStatusError' })
table.insert(
hl,
{ line = #lines - 1, from = #pref, to = #pref + #content, name = 'OutlineStatusError' }
)
end
if p ~= nil then

View File

@@ -176,7 +176,7 @@ function M.show_status()
if vim.api.nvim_buf_is_valid(buf) then
ctx.ft = vim.api.nvim_buf_get_option(buf, 'ft')
ctx.filter = cfg.o.symbols.user_config_filter[ctx.ft]
-- 'else' is handled in docs.lua
-- 'else' is handled in help.lua
end
ctx.default_filter = cfg.o.symbols.user_config_filter.default
@@ -197,7 +197,7 @@ function M.show_status()
end
end
return require('outline.docs').show_status(ctx)
return require('outline.help').show_status(ctx)
end
local function setup_commands()

View File

@@ -132,7 +132,7 @@ function Sidebar:setup_keymaps()
toggle_preview = { require('outline.preview').toggle, {} },
rename_symbol = { require('outline.rename').rename, {} },
code_actions = { require('outline.code_action').show_code_actions, {} },
show_help = { require('outline.docs').show_help, {} },
show_help = { require('outline.help').show_keymap_help, {} },
close = { function() self.view:close() end, {} },
fold_toggle = { '_toggle_fold', {} },
fold = { '_set_folded', { true } },