Skip to content

Commit

Permalink
chore(fmt): stylua
Browse files Browse the repository at this point in the history
  • Loading branch information
hedyhli committed Nov 27, 2023
1 parent 71437d9 commit dc942d0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
6 changes: 3 additions & 3 deletions lua/outline/preview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ end
function Preview:close()
-- TODO: Why was this in symbols-outline.nvim?
-- if self.s:has_code_win() then
if self.win ~= nil and vim.api.nvim_win_is_valid(self.win) then
vim.api.nvim_win_close(self.win, true)
end
if self.win ~= nil and vim.api.nvim_win_is_valid(self.win) then
vim.api.nvim_win_close(self.win, true)
end
-- end
end

Expand Down
3 changes: 2 additions & 1 deletion lua/outline/providers/nvim-lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ function M.rename_symbol(sidebar)
bufnr = sidebar.code.buf,
newName = new_name,
}
local status, err = client.request_sync('textDocument/rename', params, request_timeout, sidebar.code.buf)
local status, err =
client.request_sync('textDocument/rename', params, request_timeout, sidebar.code.buf)
if status == nil or status.err or err or status.result == nil then
return false
end
Expand Down
17 changes: 13 additions & 4 deletions lua/outline/sidebar.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local View = require('outline.view')
local Preview = require('outline.preview')
local View = require('outline.view')
local cfg = require('outline.config')
local folding = require('outline.folding')
local parser = require('outline.parser')
Expand Down Expand Up @@ -168,12 +168,16 @@ function Sidebar:setup_buffer_autocmd()
if cfg.o.preview_window.auto_preview then
vim.api.nvim_create_autocmd('CursorMoved', {
buffer = 0,
callback = function() self.preview:show() end,
callback = function()
self.preview:show()
end,
})
else
vim.api.nvim_create_autocmd('CursorMoved', {
buffer = 0,
callback = function() self.preview:close() end,
callback = function()
self.preview:close()
end,
})
end
if cfg.o.outline_window.auto_jump then
Expand Down Expand Up @@ -471,7 +475,12 @@ function Sidebar:_set_all_folded(folded, nodes)
end

function Sidebar:has_code_win()
return self.code.win and self.code.buf and self.code.win ~= 0 and self.code.buf ~= 0 and vim.api.nvim_win_is_valid(self.code.win) and vim.api.nvim_buf_is_valid(self.code.buf)
return self.code.win
and self.code.buf
and self.code.win ~= 0
and self.code.buf ~= 0
and vim.api.nvim_win_is_valid(self.code.win)
and vim.api.nvim_buf_is_valid(self.code.buf)
end

---@see outline.follow_cursor
Expand Down

0 comments on commit dc942d0

Please sign in to comment.