diff --git a/README.md b/README.md index d209c4c..5dda42e 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,9 @@ focus changed), and not for `focus_location` (simrat39/symbols-outline.nvim#119) - The preview window is positioned to be vertically center-aligned (rather than fixed to the top). This is planned to be configurable. +- Feat: Added function and command to show provider and outline window status, + somewhat like `:LspInfo`. + Fixes: - Fix symbol preview (simrat39/symbols-outline.nvim#176) @@ -419,6 +422,10 @@ local opts = { Focus on source window +- **:SymbolsOutlineStatus** + + Display current provider and outline window status in the messages area. + ### Lua API @@ -441,11 +448,11 @@ require'symbols-outline' - **close_outline()** - Close the outline window + Close the outline window. - **focus_toggle()** - Toggle cursor focus between code and outline window + Toggle cursor focus between code and outline window. - **focus_outline()** @@ -457,7 +464,11 @@ require'symbols-outline' - **is_open()** - Return whether the outline window is open + Return whether the outline window is open. + +- **show_status()** + + Display current provider and outline window status in the messages area. ## Default keymaps @@ -488,3 +499,4 @@ require'symbols-outline' | Pmenu | Highlight of the preview popup windows | | SymbolsOutlineConnector | Highlight of the table connectors | | Comment | Highlight of the info virtual text | + diff --git a/lua/symbols-outline.lua b/lua/symbols-outline.lua index a837890..f4205a0 100644 --- a/lua/symbols-outline.lua +++ b/lua/symbols-outline.lua @@ -61,6 +61,7 @@ local function setup_commands() cmd('FocusOutline', M.focus_outline, { nargs = 0 }) cmd('FocusCode', M.focus_code, { nargs = 0 }) cmd('Focus', M.focus_toggle, { nargs = 0 }) + cmd('Status', M.show_status, { nargs = 0 }) end ------------------------- @@ -394,6 +395,20 @@ function M.is_open() return M.view:is_open() end +function M.show_status() + if providers.has_provider() and _G._symbols_outline_current_provider then + print("Current provider:") + print(_G._symbols_outline_current_provider.name) + if M.view:is_open() then + print("Outline window is open") + else + print("Outline window is not open") + end + else + print("No providers") + end +end + function M.setup(opts) config.setup(opts) ui.setup_highlights() diff --git a/lua/symbols-outline/providers/init.lua b/lua/symbols-outline/providers/init.lua index 8f11389..c37cab6 100644 --- a/lua/symbols-outline/providers/init.lua +++ b/lua/symbols-outline/providers/init.lua @@ -26,6 +26,7 @@ function M.request_symbols(on_symbols) local provider = require(value) if provider.should_use_provider(0) then _G._symbols_outline_current_provider = provider + _G._symbols_outline_current_provider.name = value provider.request_symbols(on_symbols) break end