Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes issue with plugin closing new tabs opened with telescope-helpgrep.nvim #22

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,18 @@ Here is the default configuration:
},
},
custom_filetypes = {} -- see the extension section to learn how it works
supported_filetypes = {
"html",
"css",
"php",
"twig",
"vue",
"svelte",
"astro",
"htmldjango",
"javascriptreact",
"typescriptreact",

}
```

Expand Down
2 changes: 2 additions & 0 deletions lua/tailwind-tools/conceal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ end
M.enable = function()
vim.api.nvim_create_autocmd({ "TextChanged", "TextChangedI" }, {
group = vim.g.tailwind_tools.conceal_au,
pattern = config.options.supported_filetypes,
callback = function(args) set_conceal(args.buf) end,
})
-- Workaround to reset conceallevel per buffer
vim.api.nvim_create_autocmd("BufEnter", {
group = vim.g.tailwind_tools.conceal_au,
pattern = config.options.supported_filetypes,
callback = function(args)
vim.wo.conceallevel = vim.opt.conceallevel:get()
if state.conceal.enabled then set_conceal(args.buf) end
Expand Down
12 changes: 12 additions & 0 deletions lua/tailwind-tools/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ M.options = {
},
},
custom_filetypes = {},
supported_filetypes = {
"html",
"css",
"php",
"twig",
"vue",
"svelte",
"astro",
"htmldjango",
"javascriptreact",
"typescriptreact",
},
}

return M
1 change: 1 addition & 0 deletions lua/tailwind-tools/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ M.setup = function(options)

vim.api.nvim_create_autocmd("LspAttach", {
group = vim.g.tailwind_tools.conceal_au,
pattern = config.options.supported_filetypes,
callback = lsp.on_attach,
})

Expand Down
16 changes: 2 additions & 14 deletions lua/tailwind-tools/treesitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,12 @@ local log = require("tailwind-tools.log")
local config = require("tailwind-tools.config")
local parsers = require("nvim-treesitter.parsers")

local supported_filetypes = {
"html",
"css",
"php",
"twig",
"vue",
"svelte",
"astro",
"htmldjango",
"javascriptreact",
"typescriptreact",
}

---@param bufnr number
---@param all boolean?
M.get_class_nodes = function(bufnr, all)
local ft = vim.bo[bufnr].ft
local filetypes = vim.tbl_extend("keep", config.options.custom_filetypes, supported_filetypes)
local filetypes =
vim.tbl_extend("keep", config.options.custom_filetypes, config.options.supported_filetypes)
local results = {}

if not vim.tbl_contains(filetypes, ft) then return end
Expand Down