From fdaa883d9d3603586e0005f85eea176a93d24483 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20To=C5=82kacz?= Date: Mon, 12 Aug 2024 10:43:26 -0400 Subject: [PATCH 1/5] Show lspkind error message just once Instead of showing an error message for every symbol in every outline window, show just one error on opening nvim. --- lua/outline/symbols.lua | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/lua/outline/symbols.lua b/lua/outline/symbols.lua index ac6c542..01e27c2 100644 --- a/lua/outline/symbols.lua +++ b/lua/outline/symbols.lua @@ -45,6 +45,24 @@ for k, v in pairs(M.kinds) do M.str_to_kind[v] = k end +---@return table +local function get_lspkind() + local has_lspkind, lspkind = pcall(require, 'lspkind') + if has_lspkind then + return lspkind + end + vim.notify( + '[outline]: icon_source set to lspkind but failed to require lspkind!', + vim.log.levels.ERROR + ) + -- return lspkind stub + return { + symbolic = function(kind, opts) return '' end + } +end + +local lspkind = get_lspkind() + ---@param kind string|integer ---@param bufnr integer ---@return string icon @@ -66,17 +84,9 @@ function M.icon_from_kind(kind, bufnr) end if cfg.o.symbols.icon_source == 'lspkind' then - local has_lspkind, lspkind = pcall(require, 'lspkind') - if not has_lspkind then - vim.notify( - '[outline]: icon_source set to lspkind but failed to require lspkind!', - vim.log.levels.ERROR - ) - else - local icon = lspkind.symbolic(kindstr, { with_text = false }) - if icon and icon ~= '' then - return icon - end + local icon = lspkind.symbolic(kindstr, { with_text = false }) + if icon and icon ~= '' then + return icon end end From 7df74ef5ed4f0f557d7179945d22622766f57da3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20To=C5=82kacz?= Date: Mon, 12 Aug 2024 11:00:33 -0400 Subject: [PATCH 2/5] Fix: do not require lspkind if not configured --- lua/outline/init.lua | 2 ++ lua/outline/symbols.lua | 43 ++++++++++++++++++++--------------------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/lua/outline/init.lua b/lua/outline/init.lua index b57b10b..f02ecef 100644 --- a/lua/outline/init.lua +++ b/lua/outline/init.lua @@ -3,6 +3,7 @@ local cfg = require('outline.config') local highlight = require('outline.highlight') local providers = require('outline.providers.init') local utils = require('outline.utils.init') +local symbols = require('outline.symbols') local M = { ---@type outline.Sidebar[] @@ -354,6 +355,7 @@ function M.setup(opts) cfg.setup(opts) highlight.setup() + symbols.setup() setup_global_autocmd() setup_commands() diff --git a/lua/outline/symbols.lua b/lua/outline/symbols.lua index 01e27c2..a3a4b68 100644 --- a/lua/outline/symbols.lua +++ b/lua/outline/symbols.lua @@ -45,23 +45,10 @@ for k, v in pairs(M.kinds) do M.str_to_kind[v] = k end ----@return table -local function get_lspkind() - local has_lspkind, lspkind = pcall(require, 'lspkind') - if has_lspkind then - return lspkind - end - vim.notify( - '[outline]: icon_source set to lspkind but failed to require lspkind!', - vim.log.levels.ERROR - ) - -- return lspkind stub - return { - symbolic = function(kind, opts) return '' end - } -end - -local lspkind = get_lspkind() +-- use a stub if lspkind is missing or not configured +local lspkind = { + symbolic = function(kind, opts) return '' end +} ---@param kind string|integer ---@param bufnr integer @@ -83,14 +70,26 @@ function M.icon_from_kind(kind, bufnr) end end - if cfg.o.symbols.icon_source == 'lspkind' then - local icon = lspkind.symbolic(kindstr, { with_text = false }) - if icon and icon ~= '' then - return icon - end + local icon = lspkind.symbolic(kindstr, { with_text = false }) + if icon and icon ~= '' then + return icon end return cfg.o.symbols.icons[kindstr].icon end +function M.setup() + if cfg.o.symbols.icon_source == 'lspkind' then + local has_lspkind, _lspkind = pcall(require, 'lspkind') + if has_lspkind then + lspkind = _lspkind + else + vim.notify( + '[outline]: icon_source set to lspkind but failed to require lspkind!', + vim.log.levels.ERROR + ) + end + end +end + return M From 44dd1c0ab9c6adae8208bc8c65a965bb9240d1c9 Mon Sep 17 00:00:00 2001 From: ~hedy Date: Tue, 13 Aug 2024 12:24:58 +0800 Subject: [PATCH 3/5] Add issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 27 +++++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 19 ++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..419cfc8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,27 @@ +--- +name: Bug report +about: Something isn't working +title: '' +labels: bug +assignees: '' + +--- + +## Description + + + + +## Neovim setup + +- Neovim version: +- Outline.nvim version: +- Neovim distro (if applicable): +- Plugin manager: + + + +Config: +``` + +``` diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..5ceff9f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,19 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: enhancement +assignees: '' + +--- + +## Description + + + From c1ec56808e3c4de16b5f56764ea3df7d33624aa7 Mon Sep 17 00:00:00 2001 From: hedyhli Date: Tue, 13 Aug 2024 04:25:17 +0000 Subject: [PATCH 4/5] chore(vimdoc): Auto update --- doc/outline.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/outline.txt b/doc/outline.txt index 21fee6c..f3674a7 100644 --- a/doc/outline.txt +++ b/doc/outline.txt @@ -1,4 +1,4 @@ -*outline.txt* For NVIM v0.7.0 Last change: 2024 July 05 +*outline.txt* For NVIM v0.7.0 Last change: 2024 August 13 ============================================================================== Table of Contents *outline-table-of-contents* From 1459e8c555b1c2d1dd165045803c9dcbd4dab2b9 Mon Sep 17 00:00:00 2001 From: ~hedy Date: Tue, 13 Aug 2024 12:28:08 +0800 Subject: [PATCH 5/5] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 419cfc8..8bb1f50 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -9,7 +9,11 @@ assignees: '' ## Description - + ## Neovim setup