Skip to content
This repository has been archived by the owner on Jan 17, 2024. It is now read-only.

Floating window zindex in config. #108

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ require "nvim-treesitter.configs".setup {
disable = {},
updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code
persist_queries = false, -- Whether the query persists across vim sessions
floating_window_zindex = 200,
keybindings = {
toggle_query_editor = 'o',
toggle_hl_groups = 'i',
Expand Down
1 change: 1 addition & 0 deletions lua/nvim-treesitter-playground.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ function M.init()
module_path = "nvim-treesitter-playground.internal",
updatetime = 25,
persist_queries = false,
floating_window_zindex = 200,
keybindings = {
toggle_query_editor = "o",
toggle_hl_groups = "i",
Expand Down
11 changes: 9 additions & 2 deletions lua/nvim-treesitter-playground/hl-info.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,16 @@ local utils = require "nvim-treesitter-playground.utils"
local highlighter = require "vim.treesitter.highlighter"
local ts_utils = require "nvim-treesitter.ts_utils"
local parsers = require "nvim-treesitter.parsers"
local configs = require "nvim-treesitter.configs"

local M = {}

local function get_float_zindex()
local config = configs.get_module "playground"

return config and config.floating_window_zindex or 200
end

function M.get_treesitter_hl()
local bufnr = vim.api.nvim_get_current_buf()
local row, col = unpack(vim.api.nvim_win_get_cursor(0))
Expand Down Expand Up @@ -67,7 +74,7 @@ function M.show_hl_captures()
table.insert(result, "* No highlight groups found")
end

vim.lsp.util.open_floating_preview(result, "markdown", { border = "single", pad_left = 4, pad_right = 4 })
vim.lsp.util.open_floating_preview(result, "markdown", { border = "single", pad_left = 4, pad_right = 4, zindex = get_float_zindex() })
end

-- Show Node at Cursor
Expand Down Expand Up @@ -172,7 +179,7 @@ function M.show_ts_node(opts)
})
end

return vim.lsp.util.open_floating_preview(lines, "markdown", { border = "single", pad_left = 4, pad_right = 4 })
return vim.lsp.util.open_floating_preview(lines, "markdown", { border = "single", pad_left = 4, pad_right = 4, zindex = get_float_zindex() })
end

return M