Skip to content

Commit

Permalink
ref: adds supported_filetypes to config
Browse files Browse the repository at this point in the history
  • Loading branch information
catgoose committed Apr 25, 2024
1 parent 1ac7b7a commit 9b92719
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 14 deletions.
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
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
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

0 comments on commit 9b92719

Please sign in to comment.