Skip to content

Commit 76fd35e

Browse files
authored
Fix for Nvim 0.4.0 (#60)
* Update floats to new API * Fix docs for java symbols
1 parent 0262af1 commit 76fd35e

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

β€Žlua/acid/features.luaβ€Ž

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,11 @@ features.docs = function(symbol, ns)
142142
coords = coords,
143143
accessor = function(_, data)
144144
local lines = {}
145-
table.insert(lines, data.ns .. "/" .. data.name)
145+
if data.name ~= nil then
146+
table.insert(lines, data.ns .. "/" .. data.name)
147+
elseif data.member ~= nil then
148+
table.insert(lines, data.member)
149+
end
146150
for _, v in ipairs(data.eldoc) do
147151
table.insert(lines, "[" .. table.concat(v, " ") .. "]")
148152
end

β€Žlua/acid/middlewares/floats.luaβ€Ž

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
-- luacheck: globals vim
2-
local forms = require("acid.forms")
32
local utils = require("acid.utils")
43
local floats = {}
54

@@ -55,8 +54,10 @@ floats.middleware = function(config)
5554

5655
local pos = config:get_positions(lines)
5756

58-
config.winid = vim.api.nvim_open_win(config.buff, false, pos.width, pos.height, {
57+
config.winid = vim.api.nvim_open_win(config.buff, false, {
5958
relative = pos.relative,
59+
width = pos.width,
60+
height = pos.height,
6061
row = pos.row,
6162
col = pos.col
6263
})
@@ -82,17 +83,18 @@ floats.middleware = function(config)
8283
end
8384

8485
floats.set_cleaner = function(buffer)
85-
vim.api.nvim_command(
86-
[[au CursorMoved * once call luaeval('require("acid.middlewares.floats").close(]] ..
87-
buffer ..
88-
")', v:null)"
89-
)
90-
91-
vim.api.nvim_command(
92-
[[au CursorMovedI * once call luaeval('require("acid.middlewares.floats").close(]] ..
93-
buffer ..
94-
")', v:null)"
95-
)
86+
for _, event in ipairs{"CursorMoved", "CursorMovedI"} do
87+
vim.api.nvim_command(
88+
"au " ..
89+
event ..
90+
" <buffer=" ..
91+
buffer ..
92+
[[> ++once call luaeval('require("acid.middlewares.floats").close(]] ..
93+
buffer ..
94+
")', v:null)"
95+
)
96+
end
97+
9698
end
9799

98100
floats.close = function(buffer)
@@ -102,6 +104,8 @@ floats.close = function(buffer)
102104
vim.api.nvim_win_close(winid, true)
103105
floats.cache[buffer] = nil
104106
end
107+
108+
vim.api.nvim_command("delfunction! DynamicAcidSetCleaner" .. buffer)
105109
end
106110

107111
return floats

0 commit comments

Comments
 (0)