Skip to content

Commit e5808f3

Browse files
committed
chore: set min requirement to neovim 0.9
1 parent 35b3943 commit e5808f3

10 files changed

Lines changed: 57 additions & 147 deletions

File tree

.github/workflows/vimdoc.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- uses: rhysd/action-setup-vim@v1
1515
with:
1616
neovim: true
17-
version: v0.10.3
17+
version: v0.10.4
1818
- name: Setup treesitter
1919
run: |
2020
mkdir -p ~/.local/share/nvim/site/pack/vendor/start
@@ -28,7 +28,7 @@ jobs:
2828
run: |
2929
export PATH="${PWD}/build/:${PATH}"
3030
export PACKPATH=$HOME/.local/share/nvim/site
31-
nvim --headless -u ~/.local/share/nvim/site/pack/vendor/start/ts-vimdoc.nvim/scripts/init.lua -c "lua require('ts-vimdoc').docgen({input_file='README.md', output_file='doc/fzf-lua.txt', project_name='fzf-lua', version='For Neovim >= 0.7.0'})" -c "qa"
31+
nvim --headless -u ~/.local/share/nvim/site/pack/vendor/start/ts-vimdoc.nvim/scripts/init.lua -c "lua require('ts-vimdoc').docgen({input_file='README.md', output_file='doc/fzf-lua.txt', project_name='fzf-lua', version='For Neovim >= 0.9.0'})" -c "qa"
3232
- name: Commit changes
3333
env:
3434
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# fzf :heart: lua
44

5-
![Neovim version](https://img.shields.io/badge/Neovim-0.7-57A143?style=flat-square&logo=neovim)
5+
![Neovim version](https://img.shields.io/badge/Neovim-0.9-57A143?style=flat-square&logo=neovim)
66

77
[Quickstart](#quickstart)[Installation](#installation)[Usage](#usage)[Commands](#commands)[Customization](#customization)[Wiki](https://github.com/ibhagwan/fzf-lua/wiki)
88

@@ -55,7 +55,7 @@ Using [lazy.nvim](https://github.com/folke/lazy.nvim)
5555

5656
### Dependencies
5757

58-
- [`neovim`](https://github.com/neovim/neovim/releases) version > `0.7.0`
58+
- [`neovim`](https://github.com/neovim/neovim/releases) version >= `0.9`
5959
- [`fzf`](https://github.com/junegunn/fzf) version > `0.25`
6060
or [`skim`](https://github.com/skim-rs/skim) binary installed
6161
- [nvim-web-devicons](https://github.com/nvim-tree/nvim-web-devicons)

lua/fzf-lua/devicons.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ function NvimWebDevicons:new()
4545
end
4646

4747
function NvimWebDevicons:load(do_not_lazy_load)
48-
-- limit devicons support to nvim >=0.8, although official support is >=0.7
49-
-- running setup on 0.7 errs with "W18: Invalid character in group name"
5048
if not self._package_loaded
5149
-- do not trigger lazy loading
5250
and (not do_not_lazy_load or package.loaded[self._package_name])
@@ -180,7 +178,7 @@ function MiniIcons:new()
180178
end
181179

182180
function MiniIcons:load(do_not_lazy_load)
183-
if not self._package_loaded and utils.__HAS_NVIM_08
181+
if not self._package_loaded
184182
-- do not trigger lazy loading
185183
and (not do_not_lazy_load or package.loaded[self._package_name])
186184
then

lua/fzf-lua/init.lua

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,7 @@ function M.setup_highlights(override)
8484
{ "FzfLuaScrollFloatFull", "scrollfloat_f", { default = default, link = "PmenuThumb" } },
8585
{ "FzfLuaDirIcon", "dir_icon", { default = default, link = "Directory" } },
8686
{ "FzfLuaDirPart", "dir_part", { default = default, link = "Comment" } },
87-
{ "FzfLuaFilePart", "file_part",
88-
{
89-
default = default,
90-
link = utils.__HAS_NVIM_08 and "@none" or "Normal",
91-
}
92-
},
87+
{ "FzfLuaFilePart", "file_part", { default = default, link = "@none" } },
9388
-- Fzf terminal hls, colors from `vim.api.nvim_get_color_map()`
9489
{ "FzfLuaHeaderBind", "header_bind",
9590
{ default = default, fg = is_light and "MediumSpringGreen" or "BlanchedAlmond" } },
@@ -146,20 +141,6 @@ function M.setup_highlights(override)
146141
vim.api.nvim_set_hl(0, hl_name, hl_def)
147142
end
148143

149-
-- linking to a cleared hl is bugged in neovim 0.8.x
150-
-- resulting in a pink background for hls linked to `Normal`
151-
if not utils.__HAS_NVIM_09 and utils.__HAS_NVIM_08 then
152-
for _, a in ipairs(highlights) do
153-
local hl_name, opt_name = a[1], a[2]
154-
if utils.is_hl_cleared(hl_name) then
155-
-- reset any invalid hl, this will cause our 'winhighlight'
156-
-- string to look something akin to `Normal:,FloatBorder:`
157-
-- which uses terminal fg|bg colors instead
158-
utils.map_set(config.setup_opts, "__HLS." .. opt_name, "")
159-
end
160-
end
161-
end
162-
163144
-- Init the colormap singleton
164145
utils.COLORMAP()
165146
end

lua/fzf-lua/previewer/builtin.lua

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -957,40 +957,37 @@ function Previewer.buffer_or_file:do_syntax(entry)
957957
))
958958
end
959959
if syntax_limit_reached == 0 then
960-
local fallback = not utils.__HAS_NVIM_09
961-
if utils.__HAS_NVIM_09 then
962-
fallback = (function()
963-
local ft = entry.filetype
964-
or self.ext_ft_override and self.ext_ft_override[path.extension(entry.path)]
965-
or vim.filetype.match({ buf = bufnr, filename = entry.path })
966-
if type(ft) ~= "string" then
967-
return true
968-
end
969-
local ts_enabled = (function()
970-
if not self.treesitter or
971-
self.treesitter.enabled == false or
972-
self.treesitter.disabled == true or
973-
(type(self.treesitter.enabled) == "table" and
974-
not utils.tbl_contains(self.treesitter.enabled, ft)) or
975-
(type(self.treesitter.disabled) == "table" and
976-
utils.tbl_contains(self.treesitter.disabled, ft)) then
977-
return false
978-
end
979-
return true
980-
end)()
981-
local ts_success = ts_enabled and ts_attach(bufnr, ft)
982-
if not ts_success then
983-
pcall(function() vim.bo[bufnr].syntax = ft end)
984-
else
985-
-- Use buf local var as setting ft might have unintended consequences
986-
-- currently only being used in `update_render_markdown` but might be
987-
-- of use in the future?
988-
vim.b[bufnr]._ft = ft
989-
self:update_render_markdown()
990-
self:update_ts_context()
960+
local fallback = (function()
961+
local ft = entry.filetype
962+
or self.ext_ft_override and self.ext_ft_override[path.extension(entry.path)]
963+
or vim.filetype.match({ buf = bufnr, filename = entry.path })
964+
if type(ft) ~= "string" then
965+
return true
966+
end
967+
local ts_enabled = (function()
968+
if not self.treesitter or
969+
self.treesitter.enabled == false or
970+
self.treesitter.disabled == true or
971+
(type(self.treesitter.enabled) == "table" and
972+
not utils.tbl_contains(self.treesitter.enabled, ft)) or
973+
(type(self.treesitter.disabled) == "table" and
974+
utils.tbl_contains(self.treesitter.disabled, ft)) then
975+
return false
991976
end
977+
return true
992978
end)()
993-
end
979+
local ts_success = ts_enabled and ts_attach(bufnr, ft)
980+
if not ts_success then
981+
pcall(function() vim.bo[bufnr].syntax = ft end)
982+
else
983+
-- Use buf local var as setting ft might have unintended consequences
984+
-- currently only being used in `update_render_markdown` but might be
985+
-- of use in the future?
986+
vim.b[bufnr]._ft = ft
987+
self:update_render_markdown()
988+
self:update_ts_context()
989+
end
990+
end)()
994991
if fallback then
995992
if entry.filetype == "help" then
996993
-- if entry.filetype and #entry.filetype>0 then

lua/fzf-lua/profiles/default.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
return {
22
desc = "fzf-lua default options",
3-
-- Defaults to picker info in win title if neovim version >= 0.9, prompt otherwise
4-
require("fzf-lua").utils.__HAS_NVIM_09 and "default-title" or "default-prompt"
3+
"default-title",
54
}

lua/fzf-lua/providers/lsp.lua

Lines changed: 10 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,6 @@ local make_entry = require "fzf-lua.make_entry"
88

99
local M = {}
1010

11-
local function handler_capability(handler)
12-
if utils.__HAS_NVIM_08 then
13-
return handler.server_capability
14-
else
15-
return handler.resolved_capability
16-
end
17-
end
18-
1911
local function check_capabilities(handler, silent)
2012
local clients = utils.lsp_get_clients({ bufnr = core.CTX().bufnr })
2113

@@ -24,25 +16,14 @@ local function check_capabilities(handler, silent)
2416
local num_clients = 0
2517

2618
for _, client in pairs(clients) do
27-
if utils.__HAS_NVIM_09 then
28-
-- https://github.com/neovim/neovim/blob/65738202f8be3ca63b75197d48f2c7a9324c035b/runtime/doc/news.txt#L118-L122
29-
-- Dynamic registration of LSP capabilities. An implication of this change is
30-
-- that checking a client's `server_capabilities` is no longer a sufficient
31-
-- indicator to see if a server supports a feature. Instead use
32-
-- `client.supports_method(<method>)`. It considers both the dynamic
33-
-- capabilities and static `server_capabilities`.
34-
if client:supports_method(handler.prep or handler.method) then
35-
num_clients = num_clients + 1
36-
end
37-
elseif utils.__HAS_NVIM_08 then
38-
if client.server_capabilities[handler.server_capability] then
39-
num_clients = num_clients + 1
40-
end
41-
else
42-
---@diagnostic disable-next-line: undefined-field
43-
if client.resolved_capabilities[handler.resolved_capability] then
44-
num_clients = num_clients + 1
45-
end
19+
-- https://github.com/neovim/neovim/blob/65738202f8be3ca63b75197d48f2c7a9324c035b/runtime/doc/news.txt#L118-L122
20+
-- Dynamic registration of LSP capabilities. An implication of this change is
21+
-- that checking a client's `server_capabilities` is no longer a sufficient
22+
-- indicator to see if a server supports a feature. Instead use
23+
-- `client.supports_method(<method>)`. It considers both the dynamic
24+
-- capabilities and static `server_capabilities`.
25+
if client:supports_method(handler.prep or handler.method) then
26+
num_clients = num_clients + 1
4627
end
4728
end
4829

@@ -318,78 +299,67 @@ end
318299
local handlers = {
319300
["code_actions"] = {
320301
label = "Code Actions",
321-
resolved_capability = "code_action",
322302
server_capability = "codeActionProvider",
323303
method = "textDocument/codeAction",
324304
handler = code_action_handler
325305
},
326306
["references"] = {
327307
label = "References",
328-
resolved_capability = "find_references",
329308
server_capability = "referencesProvider",
330309
method = "textDocument/references",
331310
handler = location_handler
332311
},
333312
["definitions"] = {
334313
label = "Definitions",
335-
resolved_capability = "goto_definition",
336314
server_capability = "definitionProvider",
337315
method = "textDocument/definition",
338316
handler = location_handler
339317
},
340318
["declarations"] = {
341319
label = "Declarations",
342-
resolved_capability = "goto_declaration",
343320
server_capability = "declarationProvider",
344321
method = "textDocument/declaration",
345322
handler = location_handler
346323
},
347324
["typedefs"] = {
348325
label = "Type Definitions",
349-
resolved_capability = "type_definition",
350326
server_capability = "typeDefinitionProvider",
351327
method = "textDocument/typeDefinition",
352328
handler = location_handler
353329
},
354330
["implementations"] = {
355331
label = "Implementations",
356-
resolved_capability = "implementation",
357332
server_capability = "implementationProvider",
358333
method = "textDocument/implementation",
359334
handler = location_handler
360335
},
361336
["document_symbols"] = {
362337
label = "Document Symbols",
363-
resolved_capability = "document_symbol",
364338
server_capability = "documentSymbolProvider",
365339
method = "textDocument/documentSymbol",
366340
handler = symbol_handler
367341
},
368342
["workspace_symbols"] = {
369343
label = "Workspace Symbols",
370-
resolved_capability = "workspace_symbol",
371344
server_capability = "workspaceSymbolProvider",
372345
method = "workspace/symbol",
373346
handler = symbol_handler
374347
},
375348
["live_workspace_symbols"] = {
376349
label = "Workspace Symbols",
377-
resolved_capability = "workspace_symbol",
378350
server_capability = "workspaceSymbolProvider",
379351
method = "workspace/symbol",
380352
handler = symbol_handler
381353
},
382354
["incoming_calls"] = {
383355
label = "Incoming Calls",
384-
resolved_capability = "call_hierarchy",
385356
server_capability = "callHierarchyProvider",
386357
method = "callHierarchy/incomingCalls",
387358
prep = "textDocument/prepareCallHierarchy",
388359
handler = call_hierarchy_handler
389360
},
390361
["outgoing_calls"] = {
391362
label = "Outgoing Calls",
392-
resolved_capability = "call_hierarchy",
393363
server_capability = "callHierarchyProvider",
394364
method = "callHierarchy/outgoingCalls",
395365
prep = "textDocument/prepareCallHierarchy",
@@ -709,7 +679,7 @@ M.finder = function(opts)
709679
opts.silent = opts.silent == nil and true or opts.silent
710680
opts.no_autoclose = true
711681
opts.lsp_handler = handlers[method]
712-
opts.lsp_handler.capability = handler_capability(opts.lsp_handler)
682+
opts.lsp_handler.capability = opts.lsp_handler.server_capability
713683
opts.lsp_params = lsp_params -- reset previous calls params if existed
714684

715685
-- returns nil for no client attached, false for unsupported capability
@@ -1006,7 +976,7 @@ local function wrap_fn(key, fn)
1006976
return function(opts)
1007977
opts = opts or {}
1008978
opts.lsp_handler = handlers[key]
1009-
opts.lsp_handler.capability = handler_capability(opts.lsp_handler)
979+
opts.lsp_handler.capability = opts.lsp_handler.server_capability
1010980

1011981
-- check_capabilities will print the appropriate warning
1012982
if not check_capabilities(opts.lsp_handler) then

lua/fzf-lua/utils.lua

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ local uv = vim.uv or vim.loop
1010

1111
local M = {}
1212

13-
M.__HAS_NVIM_08 = vim.fn.has("nvim-0.8") == 1
14-
M.__HAS_NVIM_09 = vim.fn.has("nvim-0.9") == 1
1513
M.__HAS_NVIM_010 = vim.fn.has("nvim-0.10") == 1
1614
M.__HAS_NVIM_0102 = vim.fn.has("nvim-0.10.2") == 1
1715
M.__HAS_NVIM_011 = vim.fn.has("nvim-0.11") == 1
@@ -587,21 +585,9 @@ end
587585

588586
-- Helper func to test for invalid (cleared) highlights
589587
function M.is_hl_cleared(hl)
590-
-- `vim.api.nvim_get_hl_by_name` is deprecated since v0.9.0
591-
if vim.api.nvim_get_hl then
592-
local ok, hl_def = pcall(vim.api.nvim_get_hl, 0, { name = hl, link = false })
593-
if not ok or M.tbl_isempty(hl_def) then
594-
return true
595-
end
596-
else
597-
---@diagnostic disable-next-line: deprecated
598-
local ok, hl_def = pcall(vim.api.nvim_get_hl_by_name, hl, true)
599-
-- Not sure if this is the right way but it seems that cleared
600-
-- highlights return 'hl_def[true] == 6' (?) and 'hl_def[true]'
601-
-- does not exist at all otherwise
602-
if not ok or hl_def[true] then
603-
return true
604-
end
588+
local ok, hl_def = pcall(vim.api.nvim_get_hl, 0, { name = hl, link = false })
589+
if not ok or M.tbl_isempty(hl_def) then
590+
return true
605591
end
606592
end
607593

@@ -1011,14 +997,6 @@ function M.nvim_buf_get_name(bufnr, bufinfo)
1011997
return bufname
1012998
end
1013999

1014-
function M.wo(win, k, v)
1015-
if M.__HAS_NVIM_08 then
1016-
vim.api.nvim_set_option_value(k, v, { scope = "local", win = win })
1017-
else
1018-
vim.wo[win][k] = v
1019-
end
1020-
end
1021-
10221000
function M.zz()
10231001
-- skip for terminal buffers
10241002
if M.is_term_buffer() then return end

0 commit comments

Comments
 (0)