Skip to content

Commit 395d1c0

Browse files
authored
fix(nvim-0.12): upgrade deprecated api "vim.lsp.client_is_stopped()" (#156)
Close #154
1 parent a1ed126 commit 395d1c0

File tree

13 files changed

+50
-37
lines changed

13 files changed

+50
-37
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ jobs:
1212
if: ${{ github.ref != 'refs/heads/main' }}
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v5
1616
- uses: amannn/action-semantic-pull-request@v5
1717
env:
1818
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1919
lint:
2020
name: Lint
2121
runs-on: ubuntu-latest
2222
steps:
23-
- uses: actions/checkout@v4
23+
- uses: actions/checkout@v5
2424
- uses: stevearc/nvim-typecheck-action@v2
2525
with:
2626
path: lua
@@ -34,7 +34,7 @@ jobs:
3434
with:
3535
token: ${{ secrets.GITHUB_TOKEN }}
3636
version: latest
37-
args: --config-path .stylua.toml ./lua ./test
37+
args: --config-path .stylua.toml ./lua ./spec
3838
- uses: stefanzweifel/git-auto-commit-action@v5
3939
if: ${{ github.ref != 'refs/heads/main' }}
4040
with:
@@ -44,41 +44,16 @@ jobs:
4444
name: Unit test
4545
strategy:
4646
matrix:
47-
nvim_version: [stable, nightly, v0.6.0, v0.7.0]
47+
nvim_version: [stable, nightly, v0.8.0, v0.9.0, v0.10.0]
4848
runs-on: ubuntu-latest
4949
steps:
50-
- uses: actions/checkout@v4
50+
- uses: actions/checkout@v5
5151
- uses: rhysd/action-setup-vim@v1
52-
id: vim
5352
with:
5453
neovim: true
5554
version: ${{ matrix.nvim_version }}
56-
- uses: leafo/gh-actions-lua@v10
57-
with:
58-
luaVersion: "luajit-openresty"
59-
- uses: leafo/gh-actions-luarocks@v4
60-
- name: Run Tests
61-
shell: bash
62-
run: |
63-
luarocks install luacov
64-
luarocks install vusted
65-
vusted --coverage ./test
66-
- name: Generate Coverage Report
67-
shell: bash
68-
run: |
69-
echo "ls ."
70-
ls -l .
71-
echo "run luacov"
72-
luacov
73-
echo "ls ."
74-
ls -l .
75-
echo "cat ./luacov.report.out"
76-
cat ./luacov.report.out
77-
- uses: codecov/codecov-action@v4
78-
with:
79-
files: luacov.report.out
80-
env:
81-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
55+
- name: Run Test Cases
56+
run: make test
8257
release:
8358
name: Release
8459
if: ${{ github.ref == 'refs/heads/main' }}
@@ -92,7 +67,7 @@ jobs:
9267
with:
9368
release-type: simple
9469
package-name: lsp-progress.nvim
95-
- uses: actions/checkout@v4
70+
- uses: actions/checkout@v5
9671
- name: LuaRocks Upload
9772
uses: nvim-neorocks/luarocks-tag-release@v5
9873
if: ${{ steps.release.outputs.release_created }}

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
TESTS_INIT=spec_init.lua
2+
TESTS_DIR=spec/
3+
4+
.PHONY: test
5+
6+
test:
7+
@nvim \
8+
--headless \
9+
--noplugin \
10+
-u ${TESTS_INIT} \
11+
-c "PlenaryBustedDirectory ${TESTS_DIR} { minimal_init = '${TESTS_INIT}' }"
12+

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
# lsp-progress.nvim
44

55
<p>
6-
<a href="https://github.com/neovim/neovim/releases/v0.6.0"><img alt="Neovim" src="https://img.shields.io/badge/require-0.6%2B-blue" /></a>
6+
<a href="https://github.com/neovim/neovim/releases/v0.8.0"><img alt="Neovim" src="https://img.shields.io/badge/require-0.8%2B-blue" /></a>
77
<a href="https://luarocks.org/modules/linrongbin16/lsp-progress.nvim"><img alt="luarocks" src="https://img.shields.io/luarocks/v/linrongbin16/lsp-progress.nvim" /></a>
88
<a href="https://github.com/linrongbin16/lsp-progress.nvim/actions/workflows/ci.yml"><img alt="ci.yml" src="https://img.shields.io/github/actions/workflow/status/linrongbin16/lsp-progress.nvim/ci.yml?label=ci" /></a>
9-
<a href="https://app.codecov.io/github/linrongbin16/lsp-progress.nvim"><img alt="codecov" src="https://img.shields.io/codecov/c/github/linrongbin16/lsp-progress.nvim/main?label=codecov" /></a>
109
</p>
1110

1211
<p align="center"><i> A performant lsp progress status for Neovim. </i></p>
@@ -157,7 +156,7 @@ For more details, please see [Design & Technologies](https://linrongbin16.github
157156

158157
## Requirement
159158

160-
- Neovim &ge; 0.6.
159+
- Neovim &ge; 0.8.
161160
- [Nerd fonts](https://www.nerdfonts.com/) for icons.
162161

163162
## Install

lua/lsp-progress.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ local function spin(client_id, token)
134134
-- )
135135
end
136136
-- if client is stopped, remove this client later
137-
if vim.lsp.client_is_stopped(client_id) then
137+
if api.lsp_client_is_stopped(client_id) then
138138
vim.defer_fn(function()
139139
-- check client id again
140140
if not _has_client(client_id) then

lua/lsp-progress/api.lua

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---@diagnostic disable: deprecated
22
local NVIM_VERSION_010 = vim.fn.has("nvim-0.10") > 0
3+
local NVIM_VERSION_012 = vim.fn.has("nvim-0.12") > 0
34

45
local M = {}
56

@@ -11,4 +12,14 @@ M.lsp_clients = function()
1112
end
1213
end
1314

15+
--- @param client_id integer
16+
--- @return boolean
17+
M.lsp_client_is_stopped = function(client_id)
18+
if NVIM_VERSION_012 then
19+
return vim.lsp.client_is_stopped(client_id)
20+
else
21+
return vim.lsp.get_client_by_id(client_id) == nil
22+
end
23+
end
24+
1425
return M
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)