mirror of
https://github.com/mattn/emmet-vim.git
synced 2026-11-02 01:17:29 +08:00
support treesitter
This commit is contained in:
1 parent
3fb2f63799
commit
c5c5188a0b
2 files changed
+31
-2
No files matched your search
@@ -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
|
||||
Reference in new issue
Block a user