From 1cf6c9d1d3ad7decb4fddd0e45b7aad288c6565f Mon Sep 17 00:00:00 2001 From: linrongbin16 Date: Fri, 9 Feb 2024 18:40:01 +0800 Subject: [PATCH 01/16] fix: fix '%' escape issue again --- lua/lsp-progress.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lua/lsp-progress.lua b/lua/lsp-progress.lua index 6694853..6f09ed0 100644 --- a/lua/lsp-progress.lua +++ b/lua/lsp-progress.lua @@ -293,16 +293,23 @@ local function progress(option) vim.inspect(client_messages) ) end + if result == nil then + return '' + end + if type(result) ~= 'string' then + logger.throw("invalid 'format' result, it must be a string! result:%s", vim.inspect(result)) + end local content = result if option.max_size >= 0 then if vim.fn.strdisplaywidth(content) > option.max_size then content = vim.fn.strpart( content, 0, - vim.fn.max({ option.max_size - 1, 0 }) + math.max(option.max_size - 1, 0) ) .. "…" end end + content = content:gsub('%%', '%%%%') logger.debug( "|lsp-progress.progress| returned content: %s", vim.inspect(content) From 65d3228f139fb0a18544f674a84fa98b32a8289b Mon Sep 17 00:00:00 2001 From: linrongbin16 Date: Fri, 9 Feb 2024 10:40:59 +0000 Subject: [PATCH 02/16] chore(pr): auto-commit --- lua/lsp-progress.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lua/lsp-progress.lua b/lua/lsp-progress.lua index 6f09ed0..105058d 100644 --- a/lua/lsp-progress.lua +++ b/lua/lsp-progress.lua @@ -294,10 +294,13 @@ local function progress(option) ) end if result == nil then - return '' + return "" end - if type(result) ~= 'string' then - logger.throw("invalid 'format' result, it must be a string! result:%s", vim.inspect(result)) + if type(result) ~= "string" then + logger.throw( + "invalid 'format' result, it must be a string! result:%s", + vim.inspect(result) + ) end local content = result if option.max_size >= 0 then @@ -309,7 +312,7 @@ local function progress(option) ) .. "…" end end - content = content:gsub('%%', '%%%%') + content = content:gsub("%%", "%%%%") logger.debug( "|lsp-progress.progress| returned content: %s", vim.inspect(content) From 36e12d64dd9088ebb5627bbd828320f547134e11 Mon Sep 17 00:00:00 2001 From: linrongbin16 Date: Fri, 9 Feb 2024 18:42:07 +0800 Subject: [PATCH 03/16] Update defaults.lua --- lua/lsp-progress/defaults.lua | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lua/lsp-progress/defaults.lua b/lua/lsp-progress/defaults.lua index 1d65b82..6162239 100644 --- a/lua/lsp-progress/defaults.lua +++ b/lua/lsp-progress/defaults.lua @@ -80,17 +80,15 @@ local Defaults = { local has_title = false local has_message = false if type(title) == "string" and string.len(title) > 0 then - local escaped_title = title:gsub("%%", "%%%%") - table.insert(builder, escaped_title) + table.insert(builder, title) has_title = true end if type(message) == "string" and string.len(message) > 0 then - local escaped_message = message:gsub("%%", "%%%%") - table.insert(builder, escaped_message) + table.insert(builder, message) has_message = true end if percentage and (has_title or has_message) then - table.insert(builder, string.format("(%.0f%%%%)", percentage)) + table.insert(builder, string.format("(%.0f%%)", percentage)) end if done and (has_title or has_message) then table.insert(builder, "- done") From c5e87e3c9dc329442feb935007d881199e6ed809 Mon Sep 17 00:00:00 2001 From: linrongbin16 Date: Fri, 9 Feb 2024 18:43:43 +0800 Subject: [PATCH 04/16] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 13f7902..eb63ebd 100644 --- a/README.md +++ b/README.md @@ -245,8 +245,8 @@ lua require('lsp-progress').setup() ```lua require("lualine").setup({ sections = { - lualine_a = { "mode" }, - lualine_b = { "filename" }, + lualine_a = { ... }, + lualine_b = { ... }, lualine_c = { -- invoke `progress` here. require('lsp-progress').progress, From 498831d45a08cfab0f3b91d3500240a190c2b86c Mon Sep 17 00:00:00 2001 From: linrongbin16 Date: Fri, 9 Feb 2024 18:44:46 +0800 Subject: [PATCH 05/16] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index eb63ebd..927052d 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ # lsp-progress.nvim -

-Neovim +

+Neovim luarocks ci.yml codecov From 357cf114b5e22fec6ac21ab423c5e4522e85a425 Mon Sep 17 00:00:00 2001 From: linrongbin16 Date: Fri, 9 Feb 2024 18:45:33 +0800 Subject: [PATCH 06/16] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 927052d..30e1730 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@

Neovim -luarocks +luarocks ci.yml codecov

From 80251ad1e69c4e146ec2a75ba92c421e46408709 Mon Sep 17 00:00:00 2001 From: linrongbin16 Date: Fri, 9 Feb 2024 18:46:26 +0800 Subject: [PATCH 07/16] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 30e1730..43b023e 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@

Neovim luarocks -ci.yml +ci.yml codecov

From 9634683c0127e972f51e66c3831cd56330ebfa12 Mon Sep 17 00:00:00 2001 From: linrongbin16 Date: Fri, 9 Feb 2024 18:47:24 +0800 Subject: [PATCH 08/16] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 43b023e..7c4ad9d 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Neovim luarocks ci.yml -codecov +codecov

A performant lsp progress status for Neovim.

From 497737ffd0a297319cf7fe9f4cb0c9dba58f68d9 Mon Sep 17 00:00:00 2001 From: linrongbin16 Date: Fri, 9 Feb 2024 19:10:34 +0800 Subject: [PATCH 09/16] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7c4ad9d..e99f021 100644 --- a/README.md +++ b/README.md @@ -167,7 +167,7 @@ For more details, please see [Design & Technics](https://github.com/linrongbin16 ## Requirement - Neovim ≥ 0.6.0. -- [Nerd fonts](https://www.nerdfonts.com/) for icons. +- [nerd fonts](https://www.nerdfonts.com/) for icons. ## Install @@ -245,6 +245,7 @@ lua require('lsp-progress').setup() ```lua require("lualine").setup({ sections = { + -- Other Status Line components lualine_a = { ... }, lualine_b = { ... }, lualine_c = { From 3069603fe38f41469857d4e2f7ffcb9fb7c44f0f Mon Sep 17 00:00:00 2001 From: linrongbin16 Date: Fri, 9 Feb 2024 19:10:56 +0800 Subject: [PATCH 10/16] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e99f021..1ad3930 100644 --- a/README.md +++ b/README.md @@ -166,7 +166,7 @@ For more details, please see [Design & Technics](https://github.com/linrongbin16 ## Requirement -- Neovim ≥ 0.6.0. +- neovim ≥ 0.6.0. - [nerd fonts](https://www.nerdfonts.com/) for icons. ## Install From a27f83c2fab300cb5280e3fb216849d9265bbdc7 Mon Sep 17 00:00:00 2001 From: linrongbin16 Date: Fri, 9 Feb 2024 19:11:49 +0800 Subject: [PATCH 11/16] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1ad3930..02bba6f 100644 --- a/README.md +++ b/README.md @@ -285,7 +285,8 @@ local StatusLine = { { ... }, -- Lsp progress status component here - LspProgress + LspProgress, + ... } require('heirline').setup({ From f6317203accafbfaf692dfc4d84c67cb0440746b Mon Sep 17 00:00:00 2001 From: linrongbin16 Date: Fri, 9 Feb 2024 19:15:13 +0800 Subject: [PATCH 12/16] Update ci.yml --- .github/workflows/ci.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3aca085..95a53e8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,13 +9,12 @@ on: - main - master jobs: - pr_conventional_commit: - name: PR Conventional Commit + conventional_commit: + name: Conventional Commit if: ${{ github.ref != 'refs/heads/main' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - # - uses: webiny/action-conventional-commits@v1.1.0 - uses: ytanikin/PRConventionalCommits@1.1.0 with: task_types: '["feat","fix","docs","test","ci","refactor","perf","chore","revert","break"]' @@ -37,7 +36,7 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} version: latest - args: --config-path .stylua.toml lua/ test/ + args: --config-path .stylua.toml ./lua ./test - uses: stefanzweifel/git-auto-commit-action@v4 if: ${{ github.ref != 'refs/heads/main' }} with: From 2fe1238b695bbfe079c80f86f211e45c6596a089 Mon Sep 17 00:00:00 2001 From: linrongbin16 Date: Fri, 9 Feb 2024 19:17:55 +0800 Subject: [PATCH 13/16] Update ci.yml --- .github/workflows/ci.yml | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 95a53e8..c0ad353 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,15 +58,34 @@ jobs: with: luaVersion: "luajit-2.1.0-beta3" - uses: leafo/gh-actions-luarocks@v4 - - name: Run test cases + - name: Run Tests + shell: bash + run: | + luarocks install luacheck + luarocks install vusted + vusted --shuffle ./test + code_coverage: + name: Code Coverage + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: rhysd/action-setup-vim@v1 + id: vim + with: + neovim: true + version: stable + - uses: leafo/gh-actions-lua@v10 + with: + luaVersion: "luajit-2.1.0-beta3" + - uses: leafo/gh-actions-luarocks@v4 + - name: Run Tests shell: bash run: | luarocks install luacheck luarocks install luacov - luarocks install cluacov luarocks install vusted - vusted --coverage --shuffle ./test - - name: Generate coverage reports + vusted --coverage ./test + - name: Generate Coverage Report shell: bash run: | echo "ls ." @@ -88,6 +107,7 @@ jobs: needs: - luacheck - unit_test + - code_coverage runs-on: ubuntu-latest steps: - uses: google-github-actions/release-please-action@v3 From 080eef072e806e336f7a0f68e0b24a12922263e0 Mon Sep 17 00:00:00 2001 From: linrongbin16 Date: Fri, 9 Feb 2024 20:02:18 +0800 Subject: [PATCH 14/16] Update lsp-progress.lua --- lua/lsp-progress.lua | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/lua/lsp-progress.lua b/lua/lsp-progress.lua index 105058d..f6c8ba2 100644 --- a/lua/lsp-progress.lua +++ b/lua/lsp-progress.lua @@ -292,16 +292,8 @@ local function progress(option) vim.inspect(result), vim.inspect(client_messages) ) - end - if result == nil then - return "" - end - if type(result) ~= "string" then - logger.throw( - "invalid 'format' result, it must be a string! result:%s", - vim.inspect(result) - ) - end + end + local content = result if option.max_size >= 0 then if vim.fn.strdisplaywidth(content) > option.max_size then @@ -312,7 +304,10 @@ local function progress(option) ) .. "…" end end + if type(content) == 'string' then content = content:gsub("%%", "%%%%") + end + logger.debug( "|lsp-progress.progress| returned content: %s", vim.inspect(content) From 606cf550eed34b253d4ee1bd948a5b3b6eb9ee6d Mon Sep 17 00:00:00 2001 From: linrongbin16 Date: Fri, 9 Feb 2024 12:02:58 +0000 Subject: [PATCH 15/16] chore(pr): auto-commit --- lua/lsp-progress.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/lsp-progress.lua b/lua/lsp-progress.lua index f6c8ba2..0614daf 100644 --- a/lua/lsp-progress.lua +++ b/lua/lsp-progress.lua @@ -292,7 +292,7 @@ local function progress(option) vim.inspect(result), vim.inspect(client_messages) ) - end + end local content = result if option.max_size >= 0 then @@ -304,9 +304,9 @@ local function progress(option) ) .. "…" end end - if type(content) == 'string' then - content = content:gsub("%%", "%%%%") - end + if type(content) == "string" then + content = content:gsub("%%", "%%%%") + end logger.debug( "|lsp-progress.progress| returned content: %s", From 30befd6f86a6b0ba38228a3ed955bec5d2582e7c Mon Sep 17 00:00:00 2001 From: linrongbin16 Date: Fri, 9 Feb 2024 20:04:04 +0800 Subject: [PATCH 16/16] Update lsp-progress.lua --- lua/lsp-progress.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/lsp-progress.lua b/lua/lsp-progress.lua index 0614daf..fefb86c 100644 --- a/lua/lsp-progress.lua +++ b/lua/lsp-progress.lua @@ -293,7 +293,6 @@ local function progress(option) vim.inspect(client_messages) ) end - local content = result if option.max_size >= 0 then if vim.fn.strdisplaywidth(content) > option.max_size then