Skip to content

Commit 40c6bb3

Browse files
committed
Neovim removed/replaced 0.10 deprecated API
1 parent 2def227 commit 40c6bb3

21 files changed

+118
-257
lines changed

README.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
- Easy code navigation, view diagnostic errors, see relationships of functions, variables
66

7-
- A plugin combines the power of LSP and 🌲🏡 Treesitter together. Not only provids a better highlight but also help you analyse symbol context effectively.
7+
- A plugin combines the power of LSP and 🌲🏡 Treesitter together. Not only provides a better highlight but also help you analyse symbol context effectively.
88

99
- ctags fuzzy search & build ctags symbols
1010

@@ -140,7 +140,7 @@ I'd like to go beyond what the system is offering.
140140

141141
## Install
142142

143-
Require nvim-0.6.1 or above, nightly (0.8) prefered
143+
Require nvim-0.9 or above, nightly (0.10 or greater) preferred
144144

145145
You can remove your lspconfig setup and use this plugin.
146146
The plugin depends on lspconfig and [guihua.lua](https://github.com/ray-x/guihua.lua), which provides GUI and fzy support(migrate from [romgrk's project](romgrk/fzy-lua-native)).
@@ -364,7 +364,7 @@ require'navigator'.setup({
364364
diagnostic_virtual_text = true, -- show virtual for diagnostic message
365365
diagnostic_update_in_insert = false, -- update diagnostic message in insert mode
366366
display_diagnostic_qf = true, -- always show quickfix if there are diagnostic errors, set to false if you want to ignore it
367-
-- set to 'trouble' to show diagnositcs in Trouble
367+
-- set to 'trouble' to show diagnostcs in Trouble
368368
tsserver = {
369369
filetypes = {'typescript'} -- disable javascript etc,
370370
-- set to {} to disable the lspclient for all filetypes
@@ -401,7 +401,7 @@ require'navigator'.setup({
401401
sumneko_root_path = vim.fn.expand("$HOME") .. "/github/sumneko/lua-language-server",
402402
sumneko_binary = vim.fn.expand("$HOME") .. "/github/sumneko/lua-language-server/bin/macOS/lua-language-server",
403403
},
404-
servers = {'cmake', 'ltex'}, -- by default empty, and it should load all LSP clients avalible based on filetype
404+
servers = {'cmake', 'ltex'}, -- by default empty, and it should load all LSP clients available based on filetype
405405
-- but if you want navigator load e.g. `cmake` and `ltex` for you , you
406406
-- can put them in the `servers` list and navigator will auto load them.
407407
-- you could still specify the custom config like this
@@ -425,7 +425,7 @@ local servers = {
425425
}
426426
```
427427

428-
Navigator will try to load avalible lsp server/client based on filetype. The clients has none default on_attach.
428+
Navigator will try to load available lsp server/client based on filetype. The clients has none default on_attach.
429429
incremental sync and debounce is enabled by navigator. And the lsp
430430
snippet will be enabled. So you could use COQ and nvim-cmp snippet expand.
431431

@@ -572,7 +572,7 @@ LspDiagnosticsXXX are used for diagnostic. Please check highlight.lua and dochig
572572
- treesitter (list treesitter symbols, object analysis)
573573
- lsp-signature (better signature help)
574574

575-
The plugin can be loaded lazily (packer `opt = true` ), And it will check if optional plugins existance and load those plugins only if they existed.
575+
The plugin can be loaded lazily (packer `opt = true` ), And it will check if optional plugins existence and load those plugins only if they existed.
576576

577577
The terminal will need to be able to output nerdfont and emoji correctly. I am using Kitty with nerdfont (Victor Mono).
578578

@@ -778,16 +778,16 @@ You can override the above highlight to fit your current colorscheme
778778
| command | function |
779779
| --------------- | ------------------------------------------------------------------------- |
780780
| LspToggleFmt | toggle lsp auto format |
781-
| LspKeymaps | show LSP releated keymaps |
781+
| LspKeymaps | show LSP related keymaps |
782782
| Nctags {args} | show ctags symbols, args: -g regen ctags |
783783
| LspRestart | reload lsp |
784784
| LspToggleFmt | toggle lsp format |
785785
| LspSymbols | document symbol in side panel |
786-
| LspAndDiag | document symbol and diagnostics in side panel |
786+
| LspAndDiag | document symbol and diagnostics in side panel |
787787
| NRefPanel | show symbol reference in side panel |
788788
| TSymbols | treesitter symbol in side panel |
789-
| TsAndDiag | treesitter symbol and diagnostics in side panel |
790-
| Calltree {args} | lsp call hierarchy call tree, args: -i (incomming default), -o (outgoing) |
789+
| TsAndDiag | treesitter symbol and diagnostics in side panel |
790+
| Calltree {args} | lsp call hierarchy call tree, args: -i (incoming default), -o (outgoing) |
791791

792792
## Screenshots
793793

@@ -866,7 +866,7 @@ You can in place edit your code in floating window
866866

867867
<https://user-images.githubusercontent.com/1681295/121832919-89cbc080-cd0e-11eb-9778-11d0f356b38d.mov>
868868

869-
(Note: This feature only avalible in `find reference` and `find diagnostic`, You can not add/remove lines in floating window)
869+
(Note: This feature only available in `find reference` and `find diagnostic`, You can not add/remove lines in floating window)
870870

871871
### Implementation
872872

@@ -897,7 +897,7 @@ You can in place edit your code in floating window
897897
Treetsitter symbols in all buffers
898898
![treesitter](https://user-images.githubusercontent.com/1681295/118734953-cc6eba00-b882-11eb-9db8-0a052630d57e.jpg?raw=true)
899899

900-
### Call hierarchy (incomming/outgoing calls)
900+
### Call hierarchy (incoming/outgoing calls)
901901

902902
![incomming_calls](https://user-images.githubusercontent.com/1681295/142348079-49b71486-4f16-4f10-95c9-483aad11c262.jpg)
903903

@@ -987,7 +987,7 @@ end
987987

988988
## API and extensions
989989
The plugin built on top of guihua, you can extend the plugin based on your requirements.
990-
e.g. A side pannel of lsp symbols and lsp diagnostics:
990+
e.g. A side panel of lsp symbols and lsp diagnostics:
991991

992992

993993
```lua
@@ -1040,10 +1040,11 @@ end
10401040

10411041
## Errors and Bug Reporting
10421042

1043-
- Please double check your setup and check if minium setup works or not
1044-
- It should works for 0.6.1, neovim 0.8.x prefered.
1043+
- Please double check your setup and check if minimum setup works or not
1044+
- It should works for 0.6.1, neovim 0.8.x preferred.
10451045
- Check console output
10461046
- Check `LspInfo` and treesitter status with `checkhealth`
10471047
- Turn on log and attach the log to your issue if possible you can remove any personal/company info in the log
1048-
- Submit Issue with minium vimrc. Please check playground/init.lua as a vimrc template. !!!Please DONOT use a packer vimrc.
1049-
That installs everything to default folder!!! Also check this repo [navigator bug report](https://github.com/fky2015/navigator.nvim-bug-report)
1048+
- Submit Issue with minium init.lua. Please check playground/init.lua as a vimrc template.
1049+
Also check this repo [navigator bug report](https://github.com/fky2015/navigator.nvim-bug-report) on how to report bug
1050+
with minimum setup.

lua/navigator.lua

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,16 +186,16 @@ _NgConfigValues = {
186186

187187
-- Diagnostics (floating window)
188188
diagnostic_head_severity_1 = '🈲',
189-
diagnostic_head_severity_2 = '',
190-
diagnostic_head_severity_3 = '👎',
189+
diagnostic_head_severity_2 = '🛠',
190+
diagnostic_head_severity_3 = '🔧',
191191
diagnostic_head_description = '👹', -- suffix for severities
192192
diagnostic_virtual_text = '🦊', -- floating text preview (set to empty to disable)
193193
diagnostic_file = '🚑', -- icon in floating window, indicates the file contains diagnostics
194194

195195
-- Values (floating window)
196196
value_definition = '🐶🍡', -- identifier defined
197197
value_changed = '📝', -- identifier modified
198-
context_separator = ' ', -- separator between text and value
198+
context_separator = '', -- separator between text and value
199199

200200
-- Formatting for Side Panel
201201
side_panel = {
@@ -206,7 +206,7 @@ _NgConfigValues = {
206206
outer_node = '╰○',
207207
bracket_left = '',
208208
bracket_right = '',
209-
tab = '󰌒'
209+
tab = '󰌒',
210210
},
211211
fold = {
212212
prefix = '',
@@ -247,6 +247,10 @@ M.deprecated = function(cfg)
247247
warn('ts_fold option changed, refer to README for more details')
248248
cfg.ts_fold = { enable = cfg.ts_fold }
249249
end
250+
local has_nvim_011 = vim.fn.has('nvim-0.11.0')
251+
if not has_nvim_011 then
252+
vim.lsp.get_clients = vim.lsp.get_active_clients
253+
end
250254
end
251255

252256
local extend_config = function(opts)
@@ -381,15 +385,19 @@ M.setup = function(cfg)
381385
_NgConfigValues.loaded = true
382386
end
383387

384-
if _NgConfigValues.ts_fold.enable == true and not vim.tbl_contains(_NgConfigValues.ts_fold.disable_filetypes, vim.o.filetype) and not vim.wo.diff then
388+
if
389+
_NgConfigValues.ts_fold.enable == true
390+
and not vim.tbl_contains(_NgConfigValues.ts_fold.disable_filetypes, vim.o.filetype)
391+
and not vim.wo.diff
392+
then
385393
require('navigator.foldts').on_attach()
386394
end
387395

388396
local _start_client = vim.lsp.start_client
389397
vim.lsp.start_client = function(lsp_config)
390398
-- add highlight for Lspxxx
391399
require('navigator.lspclient.highlight').add_highlight()
392-
require('navigator.lspclient.highlight').diagnositc_config_sign()
400+
require('navigator.lspclient.highlight').config_signs()
393401
-- require('navigator.lspclient.mapping').setup()
394402
require('navigator.lspclient.lspkind').init()
395403
return _start_client(lsp_config)

lua/navigator/cclshierarchy.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ local function call_hierarchy_handler(direction, err, result, ctx, cfg, error_me
1414
log('call_hierarchy')
1515
log('call_hierarchy', direction, err, result, ctx, cfg)
1616

17-
assert(next(vim.lsp.get_active_clients()), 'Must have a client running to use lsp_tags')
17+
assert(next(vim.lsp.get_clients()), 'Must have a client running to use lsp_tags')
1818
if err ~= nil then
1919
log('hierarchy error', ctx, 'dir', direction, 'result', result, 'err', err)
2020
vim.notify('ERROR: ' .. error_message, vim.log.levels.WARN)
@@ -54,7 +54,7 @@ local call_hierarchy_handler_to = partial(call_hierarchy_handler, 'to')
5454

5555
local function incoming_calls_handler(_, err, result, ctx, cfg)
5656
local bufnr = vim.api.nvim_get_current_buf()
57-
assert(next(vim.lsp.get_active_clients({buffer = bufnr})), 'Must have a client running to use lsp_tags' )
57+
assert(next(vim.lsp.get_clients({buffer = bufnr})), 'Must have a client running to use lsp_tags' )
5858

5959
local results = call_hierarchy_handler_from(err, result, ctx, cfg, 'Incoming calls not found')
6060

@@ -72,7 +72,7 @@ end
7272

7373
function M.incoming_calls(bang, opts)
7474
local bufnr = vim.api.nvim_get_current_buf()
75-
assert(next(vim.lsp.get_active_clients({buffer = bufnr})), 'Must have a client running to use lsp_tags' )
75+
assert(next(vim.lsp.get_clients({buffer = bufnr})), 'Must have a client running to use lsp_tags' )
7676
-- if not lsphelper.check_capabilities("call_hierarchy") then
7777
-- return
7878
-- end
@@ -89,7 +89,7 @@ end
8989

9090
function M.outgoing_calls(bang, opts)
9191
local bufnr = vim.api.nvim_get_current_buf()
92-
assert(next(vim.lsp.get_active_clients({buffer = bufnr})), 'Must have a client running to use lsp_tags')
92+
assert(next(vim.lsp.get_clients({buffer = bufnr})), 'Must have a client running to use lsp_tags')
9393
local params = vim.lsp.util.make_position_params()
9494
params['levels'] = 2
9595
params['callee'] = true

lua/navigator/codeAction.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ function code_action:render_action_virtual_text(line, diagnostics)
8181
return function(err, actions, context)
8282
trace(actions, context)
8383
if context and context.client_id then
84-
local cname = vim.lsp.get_active_clients({ id = context.client_id })[1].name
84+
local cname = vim.lsp.get_clients({ id = context.client_id })[1].name
8585
if cname == 'null-ls' and _NgConfigValues.lsp.disable_nulls_codeaction_sign then
8686
return
8787
end

lua/navigator/codelens.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ M.lsp_clients = {}
8484

8585
function M.refresh()
8686
local bufnr = vim.api.nvim_get_current_buf()
87-
if next(vim.lsp.get_active_clients({ buffer = bufnr })) == nil then
87+
if next(vim.lsp.get_clients({ buffer = bufnr })) == nil then
8888
log('Must have a client running to use lsp code action')
8989
return
9090
end
@@ -124,7 +124,7 @@ M.inline = function()
124124
end
125125

126126
local bufnr = api.nvim_get_current_buf()
127-
if next(vim.lsp.get_active_clients({ buffer = bufnr })) == nil then
127+
if next(vim.lsp.get_clients({ buffer = bufnr })) == nil then
128128
return
129129
end
130130
if vim.tbl_contains(M.disabled, bufnr) then

lua/navigator/definition.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ local function get_symbol()
5858
end
5959

6060
local function def_preview(timeout_ms, method)
61-
assert(next(vim.lsp.get_active_clients({ buffer = 0 })), 'Must have a client running')
61+
assert(next(vim.lsp.get_clients({ buffer = 0 })), 'Must have a client running')
6262
method = method or 'textDocument/definition'
6363
local params = vim.lsp.util.make_position_params()
6464
local result = vim.lsp.buf_request_sync(0, method, params, timeout_ms or 1000)

0 commit comments

Comments
 (0)