From 1717d51a925f13a4f5bbb67e937f87d1a54bb71f Mon Sep 17 00:00:00 2001 From: linrongbin16 Date: Tue, 2 Apr 2024 17:45:28 +0800 Subject: [PATCH 1/8] test: add lualine minimal init --- minimal_init/minimal_lualine_init.lua | 67 +++++++++++++++++++ .../minimal_neodev_init.lua | 0 .../minimal_telescope_init.vim | 0 3 files changed, 67 insertions(+) create mode 100644 minimal_init/minimal_lualine_init.lua rename {test/minimal_init => minimal_init}/minimal_neodev_init.lua (100%) rename {test/minimal_init => minimal_init}/minimal_telescope_init.vim (100%) diff --git a/minimal_init/minimal_lualine_init.lua b/minimal_init/minimal_lualine_init.lua new file mode 100644 index 0000000..c3a093e --- /dev/null +++ b/minimal_init/minimal_lualine_init.lua @@ -0,0 +1,67 @@ +-- bootstrap lazy +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "/~https://github.com/folke/lazy.nvim.git", + lazypath, + }) +end +vim.opt.runtimepath:prepend(lazypath) + +-- install plugins +local plugins = { + { + "nvim-lualine/lualine.nvim", + event = "VimEnter", + dependencies = { + "nvim-tree/nvim-web-devicons", + { + "linrongbin16/lsp-progress.nvim", + opts = {}, + }, + }, + config = function(_, opts) + require("lualine").setup(opts) + + vim.api.nvim_create_augroup("lualine_augroup", { clear = true }) + vim.api.nvim_create_autocmd("User", { + group = "lualine_augroup", + pattern = "LspProgressStatusUpdated", + callback = require("lualine").refresh, + }) + end, + opts = { + options = { + component_separators = { left = "|", right = "|" }, + globalstatus = true, + }, + sections = { + lualine_a = { + { + "mode", + fmt = function(str) + return str:sub(1, 1) + end, + }, + }, + lualine_b = { + { "branch", icons_enabled = false }, + }, + lualine_c = { + require("lsp-progress").progress, + }, + }, + tabline = { + lualine_a = { + "buffers", + }, + }, + }, + }, +} + +-- Setup lazy.nvim +require("lazy").setup(plugins) diff --git a/test/minimal_init/minimal_neodev_init.lua b/minimal_init/minimal_neodev_init.lua similarity index 100% rename from test/minimal_init/minimal_neodev_init.lua rename to minimal_init/minimal_neodev_init.lua diff --git a/test/minimal_init/minimal_telescope_init.vim b/minimal_init/minimal_telescope_init.vim similarity index 100% rename from test/minimal_init/minimal_telescope_init.vim rename to minimal_init/minimal_telescope_init.vim From e8944729c3d4da2c6d8e67b645c6f33452b33a5d Mon Sep 17 00:00:00 2001 From: linrongbin16 Date: Tue, 2 Apr 2024 17:52:35 +0800 Subject: [PATCH 2/8] chore --- minimal_init/minimal_lualine_init.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/minimal_init/minimal_lualine_init.lua b/minimal_init/minimal_lualine_init.lua index c3a093e..824b02f 100644 --- a/minimal_init/minimal_lualine_init.lua +++ b/minimal_init/minimal_lualine_init.lua @@ -51,7 +51,9 @@ local plugins = { { "branch", icons_enabled = false }, }, lualine_c = { - require("lsp-progress").progress, + function() + return require("lsp-progress").progress() + end, }, }, tabline = { From f2ebf3d5dfabf41747faacf0c86741bf107c883a Mon Sep 17 00:00:00 2001 From: linrongbin16 Date: Tue, 2 Apr 2024 17:54:30 +0800 Subject: [PATCH 3/8] fix: fix integration tutorials for statusline --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8f88b29..b5fb4eb 100644 --- a/README.md +++ b/README.md @@ -248,7 +248,9 @@ require("lualine").setup({ lualine_b = { ... }, lualine_c = { -- invoke `progress` here. - require('lsp-progress').progress, + function() + return require('lsp-progress').progress() + end, }, ... } @@ -267,7 +269,9 @@ vim.api.nvim_create_autocmd("User", { ```lua local LspProgress = { - provider = require('lsp-progress').progress, + provider = function() + return require('lsp-progress').progress(), + end, update = { 'User', pattern = 'LspProgressStatusUpdated', From 478247487e155564c61d531be4548385880843fb Mon Sep 17 00:00:00 2001 From: linrongbin16 Date: Tue, 2 Apr 2024 17:55:06 +0800 Subject: [PATCH 4/8] chore --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index b5fb4eb..4563541 100644 --- a/README.md +++ b/README.md @@ -284,11 +284,9 @@ local LspProgress = { local StatusLine = { -- Other StatusLine components { ... }, - { ... }, -- Lsp progress status component here LspProgress, - ... } require('heirline').setup({ From d7e78337e9d3dd96b4de66f60f1a7ad9ea9ab51e Mon Sep 17 00:00:00 2001 From: linrongbin16 Date: Tue, 2 Apr 2024 17:55:22 +0800 Subject: [PATCH 5/8] chore --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 4563541..213a0cc 100644 --- a/README.md +++ b/README.md @@ -287,6 +287,8 @@ local StatusLine = { -- Lsp progress status component here LspProgress, + + { ... }, } require('heirline').setup({ From 54638b23c5eb02ff23a2d28813e5604ee508a073 Mon Sep 17 00:00:00 2001 From: linrongbin16 Date: Tue, 2 Apr 2024 17:55:33 +0800 Subject: [PATCH 6/8] chore --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 213a0cc..4563541 100644 --- a/README.md +++ b/README.md @@ -287,8 +287,6 @@ local StatusLine = { -- Lsp progress status component here LspProgress, - - { ... }, } require('heirline').setup({ From c262d5777280802198cd790c0b87d451dc2811ca Mon Sep 17 00:00:00 2001 From: linrongbin16 Date: Tue, 2 Apr 2024 17:57:44 +0800 Subject: [PATCH 7/8] chore --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 4563541..56a1c9a 100644 --- a/README.md +++ b/README.md @@ -238,6 +238,10 @@ lua require('lsp-progress').setup() ## Integration +> [!IMPORTANT] +> +> Do not directly put `require('lsp-progress').progress` as lualine component or heirline's component provider, wrap it with a function to avoid the dependency issue, see [#131](/~https://github.com/linrongbin16/lsp-progress.nvim/issues/131). + ### [lualine.nvim](/~https://github.com/nvim-lualine/lualine.nvim) ```lua From 4cc46d23919e921d56d4d6c7101b644f3333e555 Mon Sep 17 00:00:00 2001 From: linrongbin16 Date: Tue, 2 Apr 2024 17:57:57 +0800 Subject: [PATCH 8/8] chore --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 56a1c9a..f2a7478 100644 --- a/README.md +++ b/README.md @@ -240,7 +240,7 @@ lua require('lsp-progress').setup() > [!IMPORTANT] > -> Do not directly put `require('lsp-progress').progress` as lualine component or heirline's component provider, wrap it with a function to avoid the dependency issue, see [#131](/~https://github.com/linrongbin16/lsp-progress.nvim/issues/131). +> Don't directly put `require('lsp-progress').progress` as lualine component or heirline's component provider, wrap it with a function to avoid the dependency issue, see [#131](/~https://github.com/linrongbin16/lsp-progress.nvim/issues/131). ### [lualine.nvim](/~https://github.com/nvim-lualine/lualine.nvim)