Skip to content

Commit 5c0ad1f

Browse files
committed
feat!: remove support to older than 0.11 nvim versions
1 parent 7fc434e commit 5c0ad1f

20 files changed

Lines changed: 113 additions & 115 deletions

.github/ISSUE_TEMPLATE/bug_report.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ body:
4545
- **OS**: Ubuntu 20.04
4646
- **Flutter version**: 3.7.0
4747
- **Is flutter in $PATH**: yes
48-
- **neovim version**: 0.8.3
48+
- **neovim version**: 0.11.0
4949
value: |
5050
- OS:
5151
- Flutter version:

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
uses: kdheepak/panvimdoc@main
4343
with:
4444
vimdoc: flutter-tools
45-
version: "Neovim >= 0.8.0"
45+
version: "Neovim >= 0.11"
4646
demojify: true
4747
treesitter: true
4848
- name: Push changes

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,15 @@ nnoremap K <Cmd>lua vim.lsp.buf.hover()<CR>
3232
nnoremap gd <Cmd>lua vim.lsp.buf.definition()<CR>
3333
" Open code actions using the default lsp UI, if you want to change this please see the plugins above
3434
nnoremap <leader>ca <Cmd>lua vim.lsp.buf.code_action()<CR>
35-
" Open code actions for the selected visual range
36-
xnoremap <leader>ca <Cmd>lua vim.lsp.buf.range_code_action()<CR>
35+
xnoremap <leader>ca <Cmd>lua vim.lsp.buf.code_action()<CR>
3736
```
3837

3938
Please note this is not a replacement for reading the documentation, this is only to show new users what
4039
some basic setup might look like.
4140

4241
## Prerequisites
4342

44-
- neovim 0.8.0+
43+
- Neovim 0.11+
4544

4645
## Installation
4746

@@ -159,14 +158,21 @@ require("flutter-tools").setup {} -- use defaults
159158
- `FlutterDetach` - Ends a running session locally but keeps the process running on the device.
160159
- `FlutterOutlineToggle` - Toggle the outline window showing the widget tree for the given file.
161160
- `FlutterOutlineOpen` - Opens an outline window showing the widget tree for the given file.
161+
- `FlutterVisualDebug` - Toggle Flutter visual debugging.
162+
- `FlutterChangeTargetPlatform` - Cycle the target platform override for the running app.
163+
- `FlutterToggleBrightness` - Toggle the app brightness override.
162164
- `FlutterDevTools` - Starts a Dart Dev Tools server.
163165
- `FlutterDevToolsActivate` - Activates a Dart Dev Tools server.
166+
- `FlutterOpenDevTools` - Open the currently connected DevTools page.
167+
- `FlutterInspectWidget` - Toggle widget inspection for the running app.
164168
- `FlutterCopyProfilerUrl` - Copies the profiler url to your system clipboard (+ register). Note that commands `FlutterRun` and
165169
`FlutterDevTools` must be executed first.
170+
- `FlutterPubGet` - Run `flutter pub get` in the project root.
171+
- `FlutterPubUpgrade [args]` - Run `flutter pub upgrade` with optional extra arguments.
166172
- `FlutterLspRestart` - This command restarts the dart language server, and is intended for situations where it begins to work incorrectly.
167173
- `FlutterSuper` - Go to super class, method using custom LSP method `dart/textDocument/super`.
168174
- `FlutterReanalyze` - Forces LSP server reanalyze using custom LSP method `dart/reanalyze`.
169-
- `FlutterRename` - Renames and updates imports if `lsp.settings.renameFilesWithClasses == "always"`
175+
- `FlutterRename` - Rename a symbol and update imports if `lsp.settings.renameFilesWithClasses == "always"`.
170176
- `FlutterLogClear` - Clears the log buffer.
171177
- `FlutterLogToggle` - Toggles the log buffer.
172178

doc/flutter-tools.txt

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
*flutter-tools.txt*
2-
For Neovim >= 0.8.0 Last change: 2026 April 23
2+
For Neovim >= 0.11 Last change: 2026 May 03
33

44
==============================================================================
55
Table of Contents *flutter-tools-table-of-contents*
@@ -62,9 +62,8 @@ A minimal native LSP configuration might look like:
6262
" Jump to definition
6363
nnoremap gd <Cmd>lua vim.lsp.buf.definition()<CR>
6464
" Open code actions using the default lsp UI, if you want to change this please see the plugins above
65-
nnoremap <leader>ca <Cmd>lua vim.lsp.buf.code_action()<CR>
66-
" Open code actions for the selected visual range
67-
xnoremap <leader>ca <Cmd>lua vim.lsp.buf.range_code_action()<CR>
65+
nnoremap <leader>ca <Cmd>lua vim.lsp.buf.code_action()<CR>
66+
xnoremap <leader>ca <Cmd>lua vim.lsp.buf.code_action()<CR>
6867
<
6968

7069
Please note this is not a replacement for reading the documentation, this is
@@ -73,7 +72,7 @@ only to show new users what some basic setup might look like.
7372

7473
PREREQUISITES *flutter-tools-flutter-tools.nvim-prerequisites*
7574

76-
- neovim 0.8.0+
75+
- Neovim 0.11+
7776

7877

7978
INSTALLATION *flutter-tools-flutter-tools.nvim-installation*
@@ -193,14 +192,21 @@ APP VERSION
193192
- `FlutterDetach` - Ends a running session locally but keeps the process running on the device.
194193
- `FlutterOutlineToggle` - Toggle the outline window showing the widget tree for the given file.
195194
- `FlutterOutlineOpen` - Opens an outline window showing the widget tree for the given file.
195+
- `FlutterVisualDebug` - Toggle Flutter visual debugging.
196+
- `FlutterChangeTargetPlatform` - Cycle the target platform override for the running app.
197+
- `FlutterToggleBrightness` - Toggle the app brightness override.
196198
- `FlutterDevTools` - Starts a Dart Dev Tools server.
197199
- `FlutterDevToolsActivate` - Activates a Dart Dev Tools server.
200+
- `FlutterOpenDevTools` - Open the currently connected DevTools page.
201+
- `FlutterInspectWidget` - Toggle widget inspection for the running app.
198202
- `FlutterCopyProfilerUrl` - Copies the profiler url to your system clipboard (+ register). Note that commands `FlutterRun` and
199203
`FlutterDevTools` must be executed first.
204+
- `FlutterPubGet` - Run `flutter pub get` in the project root.
205+
- `FlutterPubUpgrade [args]` - Run `flutter pub upgrade` with optional extra arguments.
200206
- `FlutterLspRestart` - This command restarts the dart language server, and is intended for situations where it begins to work incorrectly.
201207
- `FlutterSuper` - Go to super class, method using custom LSP method `dart/textDocument/super`.
202208
- `FlutterReanalyze` - Forces LSP server reanalyze using custom LSP method `dart/reanalyze`.
203-
- `FlutterRename` - Renames and updates imports if `lsp.settings.renameFilesWithClasses == "always"`
209+
- `FlutterRename` - Rename a symbol and update imports if `lsp.settings.renameFilesWithClasses == "always"`.
204210
- `FlutterLogClear` - Clears the log buffer.
205211
- `FlutterLogToggle` - Toggles the log buffer.
206212

lua/flutter-tools/config.lua

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,9 @@ local function validate_prefs(prefs)
6565
end
6666
)
6767
end
68-
if vim.fn.has("nvim-0.11") == 1 then
69-
vim.validate("outline", prefs.outline, "table", true)
70-
vim.validate("dev_log", prefs.dev_log, "table", true)
71-
vim.validate("closing_tags", prefs.closing_tags, "table", true)
72-
else
73-
vim.validate({
74-
outline = { prefs.outline, "table", true },
75-
dev_log = { prefs.dev_log, "table", true },
76-
closing_tags = { prefs.closing_tags, "table", true },
77-
})
78-
end
68+
vim.validate("outline", prefs.outline, "table", true)
69+
vim.validate("dev_log", prefs.dev_log, "table", true)
70+
vim.validate("closing_tags", prefs.closing_tags, "table", true)
7971
end
8072

8173
---Create a proportional split using a percentage specified as a float

lua/flutter-tools/dev_tools.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ end
207207

208208
function M.stop()
209209
if devtools_pid then
210-
local uv = vim.loop
210+
local uv = vim.uv
211211
uv.kill(devtools_pid, uv.constants.SIGTERM)
212212
devtools_pid = nil
213213
devtools_url = nil

lua/flutter-tools/devices.lua

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,15 @@ function M.to_selection_entries(result, device_type)
6464
if not result or #result < 1 then return {} end
6565
if not device_type then device_type = DEVICE end
6666
local devices = get_devices(result, device_type)
67-
if #devices == 0 then vim.tbl_map(function(item) return { text = item } end, result) end
67+
if #devices == 0 then
68+
return vim.tbl_map(function(item)
69+
return {
70+
text = item,
71+
type = ui.entry_type.INFO,
72+
data = nil,
73+
}
74+
end, result)
75+
end
6876
return vim.tbl_map(function(device)
6977
local has_platform = device.platform and device.platform ~= ""
7078
return {

lua/flutter-tools/executable.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ local Job = require("plenary.job")
3030

3131
local fn = vim.fn
3232
local fs = vim.fs
33-
local luv = vim.loop
33+
local uv = vim.uv
3434

3535
local M = {}
3636

@@ -124,13 +124,13 @@ end
124124

125125
local function flutter_bin_from_fvm()
126126
local fvm_root =
127-
fs.dirname(fs.find(".fvm", { path = luv.cwd(), upward = true, type = "directory" })[1])
127+
fs.dirname(fs.find(".fvm", { path = uv.cwd(), upward = true, type = "directory" })[1])
128128

129129
local binary_name = path.is_windows and "flutter.bat" or "flutter"
130130
local flutter_bin_symlink = path.join(fvm_root, ".fvm", "flutter_sdk", "bin", binary_name)
131131
flutter_bin_symlink = fn.exepath(flutter_bin_symlink)
132132

133-
local flutter_bin = luv.fs_realpath(flutter_bin_symlink)
133+
local flutter_bin = uv.fs_realpath(flutter_bin_symlink)
134134
if path.exists(flutter_bin_symlink) and path.exists(flutter_bin) then return flutter_bin end
135135
end
136136

lua/flutter-tools/lsp/color/utils.lua

Lines changed: 18 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -32,32 +32,15 @@ end
3232
---@return RGB rgb_table
3333
--- FIXME: this currently does not support transparent backgrounds. Need a replacement for bg_rgb
3434
function M.rgba_to_rgb(rgba, bg_rgb)
35-
if vim.fn.has("nvim-0.11") == 1 then
36-
vim.validate("rgba", rgba, "table", true)
37-
vim.validate("bg_rgb", bg_rgb, "table", false)
38-
vim.validate("r", rgba.r, "number", true)
39-
vim.validate("g", rgba.g, "number", true)
40-
vim.validate("b", rgba.b, "number", true)
41-
vim.validate("a", rgba.a, "number", true)
42-
vim.validate("bg_r", bg_rgb.r, "number", true)
43-
vim.validate("bg_g", bg_rgb.g, "number", true)
44-
vim.validate("bg_b", bg_rgb.b, "number", true)
45-
else
46-
vim.validate({
47-
rgba = { rgba, "table", true },
48-
bg_rgb = { bg_rgb, "table", false },
49-
r = { rgba.r, "number", true },
50-
g = { rgba.g, "number", true },
51-
b = { rgba.b, "number", true },
52-
a = { rgba.a, "number", true },
53-
})
54-
55-
vim.validate({
56-
bg_r = { bg_rgb.r, "number", true },
57-
bg_g = { bg_rgb.g, "number", true },
58-
bg_b = { bg_rgb.b, "number", true },
59-
})
60-
end
35+
vim.validate("rgba", rgba, "table", true)
36+
vim.validate("bg_rgb", bg_rgb, "table", false)
37+
vim.validate("r", rgba.r, "number", true)
38+
vim.validate("g", rgba.g, "number", true)
39+
vim.validate("b", rgba.b, "number", true)
40+
vim.validate("a", rgba.a, "number", true)
41+
vim.validate("bg_r", bg_rgb.r, "number", true)
42+
vim.validate("bg_g", bg_rgb.g, "number", true)
43+
vim.validate("bg_b", bg_rgb.b, "number", true)
6144

6245
local r = rgba.r * rgba.a + bg_rgb.r * (1 - rgba.a)
6346
local g = rgba.g * rgba.a + bg_rgb.g * (1 - rgba.a)
@@ -70,19 +53,10 @@ end
7053
---@param rgb RGB with keys 'r', 'g', 'b' in [0,255]
7154
---@return string 6 digit hex representing the rgb params
7255
local function rgb_to_hex(rgb)
73-
if vim.fn.has("nvim-0.11") == 1 then
74-
vim.validate("rgb", rgb, "table", false)
75-
vim.validate("r", rgb.r, "number", false)
76-
vim.validate("g", rgb.g, "number", false)
77-
vim.validate("b", rgb.b, "number", false)
78-
else
79-
vim.validate({
80-
rgb = { rgb, "table", false },
81-
r = { rgb.r, "number", false },
82-
g = { rgb.g, "number", false },
83-
b = { rgb.b, "number", false },
84-
})
85-
end
56+
vim.validate("rgb", rgb, "table", false)
57+
vim.validate("r", rgb.r, "number", false)
58+
vim.validate("g", rgb.g, "number", false)
59+
vim.validate("b", rgb.b, "number", false)
8660
return tohex(bor(lshift(rgb.r, 16), lshift(rgb.g, 8), rgb.b), 6)
8761
end
8862

@@ -98,11 +72,7 @@ function M.rgba_to_hex(rgba, bg_rgb) return rgb_to_hex(M.rgba_to_rgb(rgba, bg_rg
9872
---@param rgb_24bit number 24-bit RGB value
9973
---@return RGB
10074
function M.decode_24bit_rgb(rgb_24bit)
101-
if vim.fn.has("nvim-0.11") == 1 then
102-
vim.validate("rgb_24bit", rgb_24bit, "number", true)
103-
else
104-
vim.validate({ rgb_24bit = { rgb_24bit, "number", true } })
105-
end
75+
vim.validate("rgb_24bit", rgb_24bit, "number", true)
10676
local r = band(rshift(rgb_24bit, 16), 255)
10777
local g = band(rshift(rgb_24bit, 8), 255)
10878
local b = band(rgb_24bit, 255)
@@ -219,15 +189,8 @@ end
219189
---@param color_infos table of `ColorInformation` objects to highlight.
220190
-- See https://microsoft.github.io/language-server-protocol/specification#textDocument_documentColor
221191
function M.buf_color(client_id, bufnr, color_infos, _)
222-
if vim.fn.has("nvim-0.11") == 1 then
223-
vim.validate("bufnr", bufnr, "number", true)
224-
vim.validate("color_infos", color_infos, "table", true)
225-
else
226-
vim.validate({
227-
bufnr = { bufnr, "number", true },
228-
color_infos = { color_infos, "table", true },
229-
})
230-
end
192+
vim.validate("bufnr", bufnr, "number", true)
193+
vim.validate("color_infos", color_infos, "table", true)
231194
if not color_infos or not bufnr then return end
232195
local c = config.lsp.color
233196

@@ -250,15 +213,8 @@ end
250213
---@param client_id number client id
251214
---@param bufnr number buffer id
252215
function M.buf_clear_color(client_id, bufnr)
253-
if vim.fn.has("nvim-0.11") == 1 then
254-
vim.validate("client_id", client_id, "number", true)
255-
vim.validate("bufnr", bufnr, "number", true)
256-
else
257-
vim.validate({
258-
client_id = { client_id, "number", true },
259-
bufnr = { bufnr, "number", true },
260-
})
261-
end
216+
vim.validate("client_id", client_id, "number", true)
217+
vim.validate("bufnr", bufnr, "number", true)
262218
if api.nvim_buf_is_valid(bufnr) then api.nvim_buf_clear_namespace(bufnr, CLIENT_NS, 0, -1) end
263219
end
264220

lua/flutter-tools/lsp/utils.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ local lsp = vim.lsp
44

55
M.SERVER_NAME = "dartls"
66

7-
-- TODO: Remove after compatibility with Neovim=0.9 is dropped
8-
local get_clients = vim.fn.has("nvim-0.10") == 1 and lsp.get_clients or lsp.get_active_clients
7+
local get_clients = lsp.get_clients
98

109
---@param bufnr number?
1110
---@return vim.lsp.Client?

0 commit comments

Comments
 (0)