my_utils.lua -> emmet_utils.lua

This commit is contained in:
kola
2024-08-10 09:29:20 +08:00
parent c5c5188a0b
commit 8f1581550d
2 changed files with 1 additions and 1 deletions

25
lua/emmet_utils.lua Normal file
View File

@@ -0,0 +1,25 @@
local M = {}
M.get_node_at_cursor = function()
local ts_utils = require("nvim-treesitter.ts_utils")
local node = ts_utils.get_node_at_cursor()
if not node then
return nil
end
while node do
local node_type = node:type()
if node_type == "element" then
return "html"
elseif node_type == "stylesheet" then
return "css"
end
node = node:parent()
end
return ""
end
return M